Skip to contentSkip to conversation

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

PATCH In review [email protected] 1 participant 1 message Apr 24, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 3/7 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.

---

 linux-2.6.12-paolo/arch/um/include/sysdep-x86_64/syscalls.h |   47 --
 linux-2.6.12-paolo/arch/um/sys-x86_64/Makefile              |    2 
 linux-2.6.12-paolo/arch/um/sys-x86_64/syscall_table.c       |   59 ++
 linux-2.6.12-paolo/arch/um/sys-x86_64/syscalls.c            |   12 
 linux-2.6.12/arch/um/sys-x86_64/sys_call_table.c            |  271 ------------
 5 files changed, 73 insertions(+), 318 deletions(-)
arch/um/include/sysdep-x86_64/syscalls.h renamed from arch/um/include/sysdep-x86_64/syscalls.h~uml-fix-syscall-table-rem-for-x86-64 +1 -46
diff -puN arch/um/include/sysdep-x86_64/syscalls.h~uml-fix-syscall-table-rem-for-x86-64 arch/um/include/sysdep-x86_64/syscalls.h
@@ -30,51 +30,6 @@ extern syscall_handler_t wrap_sys_shmat;
 extern syscall_handler_t sys_modify_ldt;
 extern syscall_handler_t sys_arch_prctl;
 
-#define ARCH_SYSCALLS \
-	[ __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
+#define NR_syscalls (__NR_syscall_max + 1)
 
 #endif
arch/um/sys-x86_64/Makefile renamed from arch/um/sys-x86_64/Makefile~uml-fix-syscall-table-rem-for-x86-64 +1 -1
diff -puN arch/um/sys-x86_64/Makefile~uml-fix-syscall-table-rem-for-x86-64 arch/um/sys-x86_64/Makefile
@@ -6,7 +6,7 @@
 
 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 \
-	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
 
arch/um/sys-x86_64/syscalls.c renamed from arch/um/sys-x86_64/syscalls.c~uml-fix-syscall-table-rem-for-x86-64 +12 -0
diff -puN arch/um/sys-x86_64/syscalls.c~uml-fix-syscall-table-rem-for-x86-64 arch/um/sys-x86_64/syscalls.c
@@ -14,6 +14,7 @@
 #include "asm/prctl.h" /* XXX This should get the constants from libc */
 #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)
 {
 	unsigned long raddr;
@@ -21,6 +22,17 @@ asmlinkage long wrap_sys_shmat(int shmid
 	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
 extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
 
arch/um/sys-x86_64/sys_call_table.c deleted +0 -271

271 lines not on this page · raw message

arch/um/sys-x86_64/syscall_table.c new file +59 -0

59 lines not on this page · raw message

_

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel