Commit 80f95078 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] uml: fix syscall table by including $(SUBARCH)'s one, for x86-64

Reuse asm-x86-64/unistd.h to build our syscall table, like x86-64 already
does.

Like for i386, we must add some #defines for all the (right!) changes UML does
to x86-64 syscall table.

Note: I noted a bogus:
	[ __NR_sched_yield ] = (syscall_handler_t *) yield,

while doing this patch (which could only be a workaround for some strange bug,
but I would ignore this possibility).  I'm changing this without notice.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ddcd6b17
...@@ -30,51 +30,6 @@ extern syscall_handler_t wrap_sys_shmat; ...@@ -30,51 +30,6 @@ extern syscall_handler_t wrap_sys_shmat;
extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t sys_modify_ldt;
extern syscall_handler_t sys_arch_prctl; extern syscall_handler_t sys_arch_prctl;
#define ARCH_SYSCALLS \ #define NR_syscalls (__NR_syscall_max + 1)
[ __NR_mmap ] = (syscall_handler_t *) old_mmap, \
[ __NR_select ] = (syscall_handler_t *) sys_select, \
[ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \
[ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \
[ __NR_shmget ] = (syscall_handler_t *) sys_shmget, \
[ __NR_shmat ] = (syscall_handler_t *) wrap_sys_shmat, \
[ __NR_shmctl ] = (syscall_handler_t *) sys_shmctl, \
[ __NR_semop ] = (syscall_handler_t *) sys_semop, \
[ __NR_semget ] = (syscall_handler_t *) sys_semget, \
[ __NR_semctl ] = (syscall_handler_t *) sys_semctl, \
[ __NR_shmdt ] = (syscall_handler_t *) sys_shmdt, \
[ __NR_msgget ] = (syscall_handler_t *) sys_msgget, \
[ __NR_msgsnd ] = (syscall_handler_t *) sys_msgsnd, \
[ __NR_msgrcv ] = (syscall_handler_t *) sys_msgrcv, \
[ __NR_msgctl ] = (syscall_handler_t *) sys_msgctl, \
[ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \
[ __NR_tuxcall ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_security ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_epoll_ctl_old ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_epoll_wait_old ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \
[ __NR_arch_prctl ] = (syscall_handler_t *) sys_arch_prctl, \
[ __NR_socket ] = (syscall_handler_t *) sys_socket, \
[ __NR_connect ] = (syscall_handler_t *) sys_connect, \
[ __NR_accept ] = (syscall_handler_t *) sys_accept, \
[ __NR_recvfrom ] = (syscall_handler_t *) sys_recvfrom, \
[ __NR_recvmsg ] = (syscall_handler_t *) sys_recvmsg, \
[ __NR_sendmsg ] = (syscall_handler_t *) sys_sendmsg, \
[ __NR_bind ] = (syscall_handler_t *) sys_bind, \
[ __NR_listen ] = (syscall_handler_t *) sys_listen, \
[ __NR_getsockname ] = (syscall_handler_t *) sys_getsockname, \
[ __NR_getpeername ] = (syscall_handler_t *) sys_getpeername, \
[ __NR_socketpair ] = (syscall_handler_t *) sys_socketpair, \
[ __NR_sendto ] = (syscall_handler_t *) sys_sendto, \
[ __NR_shutdown ] = (syscall_handler_t *) sys_shutdown, \
[ __NR_setsockopt ] = (syscall_handler_t *) sys_setsockopt, \
[ __NR_getsockopt ] = (syscall_handler_t *) sys_getsockopt, \
[ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
[ __NR_semtimedop ] = (syscall_handler_t *) sys_semtimedop, \
[ 251 ] = (syscall_handler_t *) sys_ni_syscall,
#define LAST_ARCH_SYSCALL 251
#define NR_syscalls 1024
#endif #endif
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
syscalls.o sysrq.o thunk.o sys_call_table.o syscalls.o sysrq.o thunk.o syscall_table.o
USER_OBJS := ptrace_user.o sigcontext.o USER_OBJS := ptrace_user.o sigcontext.o
......
This diff is collapsed.
/* System call table for UML/x86-64, copied from arch/x86_64/kernel/syscall.c
* with some changes for UML. */
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <linux/config.h>
#define __NO_STUBS
/* Below you can see, in terms of #define's, the differences between the x86-64
* and the UML syscall table. */
/* Not going to be implemented by UML, since we have no hardware. */
#define stub_iopl sys_ni_syscall
#define sys_ioperm sys_ni_syscall
/* The UML TLS problem. Note that x86_64 does not implement this, so the below
* is needed only for the ia32 compatibility. */
/*#define sys_set_thread_area sys_ni_syscall
#define sys_get_thread_area sys_ni_syscall*/
/* For __NR_time. The x86-64 name hopefully will change from sys_time64 to
* sys_time (since the current situation is bogus). I've sent a patch to cleanup
* this. Remove below the obsoleted line. */
#define sys_time64 um_time
#define sys_time um_time
/* On UML we call it this way ("old" means it's not mmap2) */
#define sys_mmap old_mmap
/* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick.
* See arch/x86_64/kernel/sys_x86_64.c */
#define sys_uname sys_uname64
#define stub_clone sys_clone
#define stub_fork sys_fork
#define stub_vfork sys_vfork
#define stub_execve sys_execve
#define stub_rt_sigsuspend sys_rt_sigsuspend
#define stub_sigaltstack sys_sigaltstack
#define stub_rt_sigreturn sys_rt_sigreturn
#define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
#undef _ASM_X86_64_UNISTD_H_
#include <asm-x86_64/unistd.h>
#undef __SYSCALL
#define __SYSCALL(nr, sym) [ nr ] = sym,
#undef _ASM_X86_64_UNISTD_H_
typedef void (*sys_call_ptr_t)(void);
extern void sys_ni_syscall(void);
sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = {
/* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm-x86_64/unistd.h>
};
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "asm/prctl.h" /* XXX This should get the constants from libc */ #include "asm/prctl.h" /* XXX This should get the constants from libc */
#include "choose-mode.h" #include "choose-mode.h"
/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */
asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
{ {
unsigned long raddr; unsigned long raddr;
...@@ -21,6 +22,17 @@ asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) ...@@ -21,6 +22,17 @@ asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr; return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr;
} }
asmlinkage long sys_uname64(struct new_utsname __user * name)
{
int err;
down_read(&uts_sem);
err = copy_to_user(name, &system_utsname, sizeof (*name));
up_read(&uts_sem);
if (personality(current->personality) == PER_LINUX32)
err |= copy_to_user(&name->machine, "i686", 5);
return err ? -EFAULT : 0;
}
#ifdef CONFIG_MODE_TT #ifdef CONFIG_MODE_TT
extern int modify_ldt(int func, void *ptr, unsigned long bytecount); extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment