qemu/qemu-0.7.1-syscalls.patch

101 lines
3.1 KiB
Diff

--- linux-user/arm/syscall_nr.h
+++ linux-user/arm/syscall_nr.h
@@ -259,4 +259,5 @@
/* 254 for set_thread_area */
/* 255 for get_thread_area */
/* 256 for set_tid_address */
+#define TARGET_NR_clock_gettime (263)
#define TARGET_NR_utimes (269)
--- linux-user/syscall.c
+++ linux-user/syscall.c
@@ -138,6 +138,7 @@
#define __NR_sys_getdents __NR_getdents
#define __NR_sys_getdents64 __NR_getdents64
#define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#define __NR_sys_syslog __NR_syslog
#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
#define __NR__llseek __NR_lseek
@@ -157,6 +158,7 @@
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
loff_t *, res, uint, wh);
_syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
+_syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
@@ -170,6 +172,7 @@
extern int setresgid(gid_t, gid_t, gid_t);
extern int getresgid(gid_t *, gid_t *, gid_t *);
extern int setgroups(int, gid_t *);
+extern int uselib(const char*);
static inline long get_errno(long ret)
{
@@ -2593,7 +2596,9 @@
}
break;
case TARGET_NR_uselib:
- goto unimplemented;
+ ret = get_errno(uselib(path((const char*)arg1)));
+ break;
+
case TARGET_NR_swapon:
p = lock_user_string(arg1);
ret = get_errno(swapon(p, arg2));
@@ -2833,7 +2838,9 @@
#endif
case TARGET_NR_syslog:
- goto unimplemented;
+ ret = get_errno(sys_syslog((int)arg1, (char*)arg2, (int)arg3));
+ break;
+
case TARGET_NR_setitimer:
{
struct itimerval value, ovalue, *pvalue;
@@ -3708,7 +3715,9 @@
goto unimplemented;
#ifdef TARGET_NR_mincore
case TARGET_NR_mincore:
- goto unimplemented;
+ page_unprotect_range((void*)arg3, ((size_t)arg2 + TARGET_PAGE_SIZE - 1) / TARGET_PAGE_SIZE);
+ ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3));
+ break;
#endif
#ifdef TARGET_NR_madvise
case TARGET_NR_madvise:
@@ -3799,7 +3808,8 @@
ret = get_errno(gettid());
break;
case TARGET_NR_readahead:
- goto unimplemented;
+ ret = get_errno(readahead((int)arg1, (off64_t)arg2, (size_t)arg3));
+ break;
#ifdef TARGET_NR_setxattr
case TARGET_NR_setxattr:
case TARGET_NR_lsetxattr:
@@ -3824,6 +3834,22 @@
case TARGET_NR_getdomainname:
goto unimplemented_nowarn;
#endif
+#ifdef TARGET_NR_clock_gettime
+ case TARGET_NR_clock_gettime:
+ {
+ struct target_timespec* ttp = (struct target_timespec*)arg2;
+ struct timespec htp;
+ if(ttp) {
+ htp.tv_sec = tswapl(ttp->tv_sec);
+ htp.tv_nsec = tswapl(ttp->tv_nsec);
+ ret = get_errno(clock_gettime((clockid_t)arg1, &htp));
+ ttp->tv_sec = tswapl(htp.tv_sec);
+ ttp->tv_nsec = tswapl(htp.tv_nsec);
+ } else
+ ret = get_errno(clock_gettime((clockid_t)arg1, NULL));
+ break;
+ }
+#endif
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);