diff options
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscall_table.c | 59 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 12 |
3 files changed, 68 insertions, 5 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 2129e3143559..d7ed2f7908df 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ | 7 | lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ |
8 | ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ | 8 | ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ |
9 | syscalls.o sysrq.o thunk.o | 9 | syscalls.o sysrq.o thunk.o syscall_table.o |
10 | 10 | ||
11 | USER_OBJS := ptrace_user.o sigcontext.o | 11 | USER_OBJS := ptrace_user.o sigcontext.o |
12 | 12 | ||
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c new file mode 100644 index 000000000000..34b2e842864f --- /dev/null +++ b/arch/um/sys-x86_64/syscall_table.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* System call table for UML/x86-64, copied from arch/x86_64/kernel/syscall.c | ||
2 | * with some changes for UML. */ | ||
3 | |||
4 | #include <linux/linkage.h> | ||
5 | #include <linux/sys.h> | ||
6 | #include <linux/cache.h> | ||
7 | #include <linux/config.h> | ||
8 | |||
9 | #define __NO_STUBS | ||
10 | |||
11 | /* Below you can see, in terms of #define's, the differences between the x86-64 | ||
12 | * and the UML syscall table. */ | ||
13 | |||
14 | /* Not going to be implemented by UML, since we have no hardware. */ | ||
15 | #define stub_iopl sys_ni_syscall | ||
16 | #define sys_ioperm sys_ni_syscall | ||
17 | |||
18 | /* The UML TLS problem. Note that x86_64 does not implement this, so the below | ||
19 | * is needed only for the ia32 compatibility. */ | ||
20 | /*#define sys_set_thread_area sys_ni_syscall | ||
21 | #define sys_get_thread_area sys_ni_syscall*/ | ||
22 | |||
23 | /* For __NR_time. The x86-64 name hopefully will change from sys_time64 to | ||
24 | * sys_time (since the current situation is bogus). I've sent a patch to cleanup | ||
25 | * this. Remove below the obsoleted line. */ | ||
26 | #define sys_time64 um_time | ||
27 | #define sys_time um_time | ||
28 | |||
29 | /* On UML we call it this way ("old" means it's not mmap2) */ | ||
30 | #define sys_mmap old_mmap | ||
31 | /* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick. | ||
32 | * See arch/x86_64/kernel/sys_x86_64.c */ | ||
33 | #define sys_uname sys_uname64 | ||
34 | |||
35 | #define stub_clone sys_clone | ||
36 | #define stub_fork sys_fork | ||
37 | #define stub_vfork sys_vfork | ||
38 | #define stub_execve sys_execve | ||
39 | #define stub_rt_sigsuspend sys_rt_sigsuspend | ||
40 | #define stub_sigaltstack sys_sigaltstack | ||
41 | #define stub_rt_sigreturn sys_rt_sigreturn | ||
42 | |||
43 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; | ||
44 | #undef _ASM_X86_64_UNISTD_H_ | ||
45 | #include <asm-x86_64/unistd.h> | ||
46 | |||
47 | #undef __SYSCALL | ||
48 | #define __SYSCALL(nr, sym) [ nr ] = sym, | ||
49 | #undef _ASM_X86_64_UNISTD_H_ | ||
50 | |||
51 | typedef void (*sys_call_ptr_t)(void); | ||
52 | |||
53 | extern void sys_ni_syscall(void); | ||
54 | |||
55 | sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = { | ||
56 | /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */ | ||
57 | [0 ... __NR_syscall_max] = &sys_ni_syscall, | ||
58 | #include <asm-x86_64/unistd.h> | ||
59 | }; | ||
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 68205a03364c..ab4b0abf8af3 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -14,11 +14,15 @@ | |||
14 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ | 14 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ |
15 | #include "choose-mode.h" | 15 | #include "choose-mode.h" |
16 | 16 | ||
17 | asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) | 17 | asmlinkage long sys_uname64(struct new_utsname __user * name) |
18 | { | 18 | { |
19 | unsigned long raddr; | 19 | int err; |
20 | 20 | down_read(&uts_sem); | |
21 | return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr; | 21 | err = copy_to_user(name, &system_utsname, sizeof (*name)); |
22 | up_read(&uts_sem); | ||
23 | if (personality(current->personality) == PER_LINUX32) | ||
24 | err |= copy_to_user(&name->machine, "i686", 5); | ||
25 | return err ? -EFAULT : 0; | ||
22 | } | 26 | } |
23 | 27 | ||
24 | #ifdef CONFIG_MODE_TT | 28 | #ifdef CONFIG_MODE_TT |