Revert "trial implementation of private file mapping"

This reverts commit abe57218c4.
This commit is contained in:
NAKAMURA Gou
2013-07-26 16:44:39 +09:00
parent abe57218c4
commit 78d9d3fcd2
23 changed files with 173 additions and 1756 deletions

View File

@@ -635,12 +635,33 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
pthread_mutex_unlock(lock);
return w.sr.args[0];
case __NR_mmap:
case __NR_munmap:
case __NR_mprotect:
/* reserved for internal use */
do_syscall_return(fd, cpu, -ENOSYS, 0, 0, 0, 0);
break;
case __NR_mmap: {
// w.sr.args[0] is converted to MIC physical address
__dprintf("mcexec.c,mmap,MIC-paddr=%lx,len=%lx,prot=%lx,flags=%lx,fd=%lx,offset=%lx\n",
w.sr.args[0], w.sr.args[1], w.sr.args[2], w.sr.args[3], w.sr.args[4], w.sr.args[5]);
off_t old_off = lseek(w.sr.args[4], 0, SEEK_CUR);
if(old_off == -1) { __dprint("mcexec.c,mmap,lseek failed\n"); ret = -errno; goto mmap_out; }
off_t rlseek = lseek(w.sr.args[4], w.sr.args[5], SEEK_SET);
if(rlseek == -1) { __dprint("mcexec.c,mmap,lseek failed\n"); ret = -errno; goto mmap_out; }
ssize_t toread = w.sr.args[1];
ret = 0;
while(toread > 0) {
__dprintf("mcexec.c,mmap,read,addr=%lx,len=%lx\n", (long int)((void *)dma_buf + w.sr.args[1] - toread), toread);
ssize_t rread = read(w.sr.args[4], (void *)dma_buf + w.sr.args[1] - toread, toread);
if(rread == 0) {
__dprint("mcexec.c,mmap,read==0\n");
goto mmap_zero_out;
} else if(rread < 0) {
__dprint("mcexec.c,mmap,read failed\n"); ret = -errno; break;
}
toread -= rread;
}
mmap_zero_out:
rlseek = lseek(w.sr.args[4], old_off, SEEK_SET);
if(rlseek == -1) { __dprint("mcexec.c,mmap,lseek failed\n"); ret = -errno; }
mmap_out:
do_syscall_return(fd, cpu, ret, 1, (unsigned long)dma_buf, w.sr.args[0], w.sr.args[1]);
break; }
#ifdef USE_SYSCALL_MOD_CALL
case 303:{