Conditionalize more syscall implementations, by Mike Frysinger.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2576 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2007-04-01 18:31:35 +00:00
parent 2053152b7f
commit e5febef5f1
1 changed files with 62 additions and 2 deletions

View File

@ -2057,6 +2057,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_fork: case TARGET_NR_fork:
ret = get_errno(do_fork(cpu_env, SIGCHLD, 0)); ret = get_errno(do_fork(cpu_env, SIGCHLD, 0));
break; break;
#ifdef TARGET_NR_waitpid
case TARGET_NR_waitpid: case TARGET_NR_waitpid:
{ {
int status; int status;
@ -2065,6 +2066,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
tput32(arg2, status); tput32(arg2, status);
} }
break; break;
#endif
case TARGET_NR_creat: case TARGET_NR_creat:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(creat(p, arg2)); ret = get_errno(creat(p, arg2));
@ -2193,11 +2195,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
unlock_user(p3, arg3, 0); unlock_user(p3, arg3, 0);
break; break;
} }
#ifdef TARGET_NR_umount
case TARGET_NR_umount: case TARGET_NR_umount:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(umount(p)); ret = get_errno(umount(p));
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
break; break;
#endif
case TARGET_NR_stime: case TARGET_NR_stime:
{ {
time_t host_time; time_t host_time;
@ -2217,6 +2221,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_pause: case TARGET_NR_pause:
ret = get_errno(pause()); ret = get_errno(pause());
break; break;
#ifdef TARGET_NR_utime
case TARGET_NR_utime: case TARGET_NR_utime:
{ {
struct utimbuf tbuf, *host_tbuf; struct utimbuf tbuf, *host_tbuf;
@ -2235,6 +2240,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
} }
break; break;
#endif
case TARGET_NR_utimes: case TARGET_NR_utimes:
{ {
struct timeval *tvp, tv[2]; struct timeval *tvp, tv[2];
@ -2331,9 +2337,10 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_prof: case TARGET_NR_prof:
goto unimplemented; goto unimplemented;
#endif #endif
#ifdef TARGET_NR_signal
case TARGET_NR_signal: case TARGET_NR_signal:
goto unimplemented; goto unimplemented;
#endif
case TARGET_NR_acct: case TARGET_NR_acct:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(acct(path(p))); ret = get_errno(acct(path(p)));
@ -2391,6 +2398,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_setsid: case TARGET_NR_setsid:
ret = get_errno(setsid()); ret = get_errno(setsid());
break; break;
#ifdef TARGET_NR_sigaction
case TARGET_NR_sigaction: case TARGET_NR_sigaction:
{ {
#if !defined(TARGET_MIPS) #if !defined(TARGET_MIPS)
@ -2445,6 +2453,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
#endif #endif
} }
break; break;
#endif
case TARGET_NR_rt_sigaction: case TARGET_NR_rt_sigaction:
{ {
struct target_sigaction *act; struct target_sigaction *act;
@ -2486,6 +2495,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = target_set; ret = target_set;
} }
break; break;
#ifdef TARGET_NR_sigprocmask
case TARGET_NR_sigprocmask: case TARGET_NR_sigprocmask:
{ {
int how = arg1; int how = arg1;
@ -2522,6 +2532,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#endif
case TARGET_NR_rt_sigprocmask: case TARGET_NR_rt_sigprocmask:
{ {
int how = arg1; int how = arg1;
@ -2558,6 +2569,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#ifdef TARGET_NR_sigpending
case TARGET_NR_sigpending: case TARGET_NR_sigpending:
{ {
sigset_t set; sigset_t set;
@ -2569,6 +2581,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#endif
case TARGET_NR_rt_sigpending: case TARGET_NR_rt_sigpending:
{ {
sigset_t set; sigset_t set;
@ -2580,6 +2593,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#ifdef TARGET_NR_sigsuspend
case TARGET_NR_sigsuspend: case TARGET_NR_sigsuspend:
{ {
sigset_t set; sigset_t set;
@ -2589,6 +2603,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = get_errno(sigsuspend(&set)); ret = get_errno(sigsuspend(&set));
} }
break; break;
#endif
case TARGET_NR_rt_sigsuspend: case TARGET_NR_rt_sigsuspend:
{ {
sigset_t set; sigset_t set;
@ -2630,10 +2645,12 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo));
} }
break; break;
#ifdef TARGET_NR_sigreturn
case TARGET_NR_sigreturn: case TARGET_NR_sigreturn:
/* NOTE: ret is eax, so not transcoding must be done */ /* NOTE: ret is eax, so not transcoding must be done */
ret = do_sigreturn(cpu_env); ret = do_sigreturn(cpu_env);
break; break;
#endif
case TARGET_NR_rt_sigreturn: case TARGET_NR_rt_sigreturn:
/* NOTE: ret is eax, so not transcoding must be done */ /* NOTE: ret is eax, so not transcoding must be done */
ret = do_rt_sigreturn(cpu_env); ret = do_rt_sigreturn(cpu_env);
@ -2739,17 +2756,24 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
} }
break; break;
#ifdef TARGET_NR_uselib
case TARGET_NR_uselib: case TARGET_NR_uselib:
goto unimplemented; goto unimplemented;
#endif
#ifdef TARGET_NR_swapon
case TARGET_NR_swapon: case TARGET_NR_swapon:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(swapon(p, arg2)); ret = get_errno(swapon(p, arg2));
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
break; break;
#endif
case TARGET_NR_reboot: case TARGET_NR_reboot:
goto unimplemented; goto unimplemented;
#ifdef TARGET_NR_readdir
case TARGET_NR_readdir: case TARGET_NR_readdir:
goto unimplemented; goto unimplemented;
#endif
#ifdef TARGET_NR_mmap
case TARGET_NR_mmap: case TARGET_NR_mmap:
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K) #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K)
{ {
@ -2774,6 +2798,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
arg6)); arg6));
#endif #endif
break; break;
#endif
#ifdef TARGET_NR_mmap2 #ifdef TARGET_NR_mmap2
case TARGET_NR_mmap2: case TARGET_NR_mmap2:
#if defined(TARGET_SPARC) || defined(TARGET_MIPS) #if defined(TARGET_SPARC) || defined(TARGET_MIPS)
@ -2793,25 +2818,37 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_mprotect: case TARGET_NR_mprotect:
ret = get_errno(target_mprotect(arg1, arg2, arg3)); ret = get_errno(target_mprotect(arg1, arg2, arg3));
break; break;
#ifdef TARGET_NR_mremap
case TARGET_NR_mremap: case TARGET_NR_mremap:
ret = get_errno(target_mremap(arg1, arg2, arg3, arg4, arg5)); ret = get_errno(target_mremap(arg1, arg2, arg3, arg4, arg5));
break; break;
#endif
/* ??? msync/mlock/munlock are broken for softmmu. */ /* ??? msync/mlock/munlock are broken for softmmu. */
#ifdef TARGET_NR_msync
case TARGET_NR_msync: case TARGET_NR_msync:
ret = get_errno(msync(g2h(arg1), arg2, arg3)); ret = get_errno(msync(g2h(arg1), arg2, arg3));
break; break;
#endif
#ifdef TARGET_NR_mlock
case TARGET_NR_mlock: case TARGET_NR_mlock:
ret = get_errno(mlock(g2h(arg1), arg2)); ret = get_errno(mlock(g2h(arg1), arg2));
break; break;
#endif
#ifdef TARGET_NR_munlock
case TARGET_NR_munlock: case TARGET_NR_munlock:
ret = get_errno(munlock(g2h(arg1), arg2)); ret = get_errno(munlock(g2h(arg1), arg2));
break; break;
#endif
#ifdef TARGET_NR_mlockall
case TARGET_NR_mlockall: case TARGET_NR_mlockall:
ret = get_errno(mlockall(arg1)); ret = get_errno(mlockall(arg1));
break; break;
#endif
#ifdef TARGET_NR_munlockall
case TARGET_NR_munlockall: case TARGET_NR_munlockall:
ret = get_errno(munlockall()); ret = get_errno(munlockall());
break; break;
#endif
case TARGET_NR_truncate: case TARGET_NR_truncate:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(truncate(p, arg2)); ret = get_errno(truncate(p, arg2));
@ -2889,10 +2926,11 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_ioperm: case TARGET_NR_ioperm:
goto unimplemented; goto unimplemented;
#endif #endif
#ifdef TARGET_NR_socketcall
case TARGET_NR_socketcall: case TARGET_NR_socketcall:
ret = do_socketcall(arg1, arg2); ret = do_socketcall(arg1, arg2);
break; break;
#endif
#ifdef TARGET_NR_accept #ifdef TARGET_NR_accept
case TARGET_NR_accept: case TARGET_NR_accept:
ret = do_accept(arg1, arg2, arg3); ret = do_accept(arg1, arg2, arg3);
@ -3101,11 +3139,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#ifdef TARGET_NR_swapoff
case TARGET_NR_swapoff: case TARGET_NR_swapoff:
p = lock_user_string(arg1); p = lock_user_string(arg1);
ret = get_errno(swapoff(p)); ret = get_errno(swapoff(p));
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
break; break;
#endif
case TARGET_NR_sysinfo: case TARGET_NR_sysinfo:
{ {
struct target_sysinfo *target_value; struct target_sysinfo *target_value;
@ -3133,9 +3173,11 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#ifdef TARGET_NR_ipc
case TARGET_NR_ipc: case TARGET_NR_ipc:
ret = do_ipc(arg1, arg2, arg3, arg4, arg5, arg6); ret = do_ipc(arg1, arg2, arg3, arg4, arg5, arg6);
break; break;
#endif
case TARGET_NR_fsync: case TARGET_NR_fsync:
ret = get_errno(fsync(arg1)); ret = get_errno(fsync(arg1));
break; break;
@ -3184,10 +3226,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
#endif #endif
case TARGET_NR_adjtimex: case TARGET_NR_adjtimex:
goto unimplemented; goto unimplemented;
#ifdef TARGET_NR_create_module
case TARGET_NR_create_module: case TARGET_NR_create_module:
#endif
case TARGET_NR_init_module: case TARGET_NR_init_module:
case TARGET_NR_delete_module: case TARGET_NR_delete_module:
#ifdef TARGET_NR_get_kernel_syms
case TARGET_NR_get_kernel_syms: case TARGET_NR_get_kernel_syms:
#endif
goto unimplemented; goto unimplemented;
case TARGET_NR_quotactl: case TARGET_NR_quotactl:
goto unimplemented; goto unimplemented;
@ -3199,13 +3245,17 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
break; break;
case TARGET_NR_bdflush: case TARGET_NR_bdflush:
goto unimplemented; goto unimplemented;
#ifdef TARGET_NR_sysfs
case TARGET_NR_sysfs: case TARGET_NR_sysfs:
goto unimplemented; goto unimplemented;
#endif
case TARGET_NR_personality: case TARGET_NR_personality:
ret = get_errno(personality(arg1)); ret = get_errno(personality(arg1));
break; break;
#ifdef TARGET_NR_afs_syscall
case TARGET_NR_afs_syscall: case TARGET_NR_afs_syscall:
goto unimplemented; goto unimplemented;
#endif
case TARGET_NR__llseek: case TARGET_NR__llseek:
{ {
#if defined (__x86_64__) #if defined (__x86_64__)
@ -3319,9 +3369,12 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
break; break;
#endif /* TARGET_NR_getdents64 */ #endif /* TARGET_NR_getdents64 */
#ifdef TARGET_NR__newselect
case TARGET_NR__newselect: case TARGET_NR__newselect:
ret = do_select(arg1, arg2, arg3, arg4, arg5); ret = do_select(arg1, arg2, arg3, arg4, arg5);
break; break;
#endif
#ifdef TARGET_NR_poll
case TARGET_NR_poll: case TARGET_NR_poll:
{ {
struct target_pollfd *target_pfd; struct target_pollfd *target_pfd;
@ -3347,6 +3400,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
unlock_user(target_pfd, arg1, ret); unlock_user(target_pfd, arg1, ret);
} }
break; break;
#endif
case TARGET_NR_flock: case TARGET_NR_flock:
/* NOTE: the flock constant seems to be the same for every /* NOTE: the flock constant seems to be the same for every
Linux platform */ Linux platform */
@ -3448,10 +3502,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
} }
} }
break; break;
#ifdef TARGET_NR_query_module
case TARGET_NR_query_module: case TARGET_NR_query_module:
goto unimplemented; goto unimplemented;
#endif
#ifdef TARGET_NR_nfsservctl
case TARGET_NR_nfsservctl: case TARGET_NR_nfsservctl:
goto unimplemented; goto unimplemented;
#endif
case TARGET_NR_prctl: case TARGET_NR_prctl:
switch (arg1) switch (arg1)
{ {
@ -4004,8 +4062,10 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_gettid: case TARGET_NR_gettid:
ret = get_errno(gettid()); ret = get_errno(gettid());
break; break;
#ifdef TARGET_NR_readahead
case TARGET_NR_readahead: case TARGET_NR_readahead:
goto unimplemented; goto unimplemented;
#endif
#ifdef TARGET_NR_setxattr #ifdef TARGET_NR_setxattr
case TARGET_NR_setxattr: case TARGET_NR_setxattr:
case TARGET_NR_lsetxattr: case TARGET_NR_lsetxattr: