Skip to contentSkip to conversation

UML - split out arch-specific syscalls from generic ones

PATCH New Jeff Dike 1 participant 1 message Jan 10, 2005 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 3/28 UML - split out arch-specific syscalls from generic ones

This factors out a bunch of non-generic system calls into i386-specific code. It also adds the x86_64-specific system calls.
A couple of generic system calls handlers are declared in sysdep-i386 because x86 has no declarations for them, but x86_64 has incompatible ones.

Also splits out syscalls on behalf on UML/S390 from Bodo Stroesser

arch/um/include/sysdep-i386/syscalls.h +69 -2
Index: 2.6.10/arch/um/include/sysdep-i386/syscalls.h
===================================================================
@@ -8,11 +8,70 @@
 
 typedef long syscall_handler_t(struct pt_regs);
 
+/* Not declared on x86, incompatible declarations on x86_64, so these have
+ * to go here rather than in sys_call_table.c
+ */
+extern syscall_handler_t sys_ptrace;
+extern syscall_handler_t sys_rt_sigaction;
+
+extern syscall_handler_t old_mmap_i386;
+
 #define EXECUTE_SYSCALL(syscall, regs) \
 	((long (*)(struct syscall_args)) (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
 
+extern long sys_mmap2(unsigned long addr, unsigned long len,
+		      unsigned long prot, unsigned long flags,
+		      unsigned long fd, unsigned long pgoff);
+
 #define ARCH_SYSCALLS \
+	[ __NR_waitpid ] = (syscall_handler_t *) sys_waitpid, \
+	[ __NR_break ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_oldstat ] = (syscall_handler_t *) sys_stat, \
+	[ __NR_umount ] = (syscall_handler_t *) sys_oldumount, \
+	[ __NR_stime ] = um_stime, \
+	[ __NR_oldfstat ] = (syscall_handler_t *) sys_fstat, \
+	[ __NR_stty ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_gtty ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_nice ] = (syscall_handler_t *) sys_nice, \
+	[ __NR_ftime ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_prof ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_signal ] = (syscall_handler_t *) sys_signal, \
+	[ __NR_lock ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_mpx ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_ulimit ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_oldolduname ] = (syscall_handler_t *) sys_olduname, \
+	[ __NR_sigaction ] = (syscall_handler_t *) sys_sigaction, \
+	[ __NR_sgetmask ] = (syscall_handler_t *) sys_sgetmask, \
+	[ __NR_ssetmask ] = (syscall_handler_t *) sys_ssetmask, \
+	[ __NR_sigsuspend ] = (syscall_handler_t *) sys_sigsuspend, \
+	[ __NR_sigpending ] = (syscall_handler_t *) sys_sigpending, \
+	[ __NR_oldlstat ] = (syscall_handler_t *) sys_lstat, \
+	[ __NR_readdir ] = old_readdir, \
+	[ __NR_profil ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_socketcall ] = (syscall_handler_t *) sys_socketcall, \
+	[ __NR_olduname ] = (syscall_handler_t *) sys_uname, \
+	[ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_idle ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_ipc ] = (syscall_handler_t *) sys_ipc, \
+	[ __NR_sigreturn ] = (syscall_handler_t *) sys_sigreturn, \
+	[ __NR_sigprocmask ] = (syscall_handler_t *) sys_sigprocmask, \
+	[ __NR_bdflush ] = (syscall_handler_t *) sys_bdflush, \
+	[ __NR__llseek ] = (syscall_handler_t *) sys_llseek, \
+	[ __NR__newselect ] = (syscall_handler_t *) sys_select, \
+	[ __NR_vm86 ] = (syscall_handler_t *) sys_ni_syscall, \
 	[ __NR_mmap ] = (syscall_handler_t *) old_mmap_i386, \
+	[ __NR_ugetrlimit ] = (syscall_handler_t *) sys_getrlimit, \
+	[ __NR_mmap2 ] = (syscall_handler_t *) sys_mmap2, \
+	[ __NR_truncate64 ] = (syscall_handler_t *) sys_truncate64, \
+	[ __NR_ftruncate64 ] = (syscall_handler_t *) sys_ftruncate64, \
+	[ __NR_stat64 ] = (syscall_handler_t *) sys_stat64, \
+	[ __NR_lstat64 ] = (syscall_handler_t *) sys_lstat64, \
+	[ __NR_fstat64 ] = (syscall_handler_t *) sys_fstat64, \
+	[ __NR_fcntl64 ] = (syscall_handler_t *) sys_fcntl64, \
+	[ __NR_sendfile64 ] = (syscall_handler_t *) sys_sendfile64, \
+	[ __NR_statfs64 ] = (syscall_handler_t *) sys_statfs64, \
+	[ __NR_fstatfs64 ] = (syscall_handler_t *) sys_fstatfs64, \
+	[ __NR_fadvise64_64 ] = (syscall_handler_t *) sys_fadvise64_64, \
 	[ __NR_select ] = (syscall_handler_t *) old_select, \
 	[ __NR_vm86old ] = (syscall_handler_t *) sys_ni_syscall, \
         [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \
@@ -38,11 +97,19 @@
 	[ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \
 	[ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \
 	[ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \
-        [ 222 ] = (syscall_handler_t *) sys_ni_syscall,
+        [ 222 ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ 223 ] = (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_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, \
+	[ 251 ] = (syscall_handler_t *) sys_ni_syscall, \
+        [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, \
+	[ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
+	[ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall,
         
 /* 222 doesn't yet have a name in include/asm-i386/unistd.h */
 
-#define LAST_ARCH_SYSCALL 222
+#define LAST_ARCH_SYSCALL __NR_vserver
 
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
arch/um/include/sysdep-ppc/syscalls.h +5 -2
Index: 2.6.10/arch/um/include/sysdep-ppc/syscalls.h
===================================================================
@@ -34,9 +34,12 @@
 	[ __NR_multiplexer ] = sys_ni_syscall, \
 	[ __NR_mmap ] = old_mmap, \
 	[ __NR_madvise ] = sys_madvise, \
-	[ __NR_mincore ] = sys_mincore, 
+	[ __NR_mincore ] = sys_mincore, \
+	[ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
+	[ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
+	[ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64,
 
-#define LAST_ARCH_SYSCALL __NR_mincore
+#define LAST_ARCH_SYSCALL __NR_fadvise64
 
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
arch/um/include/sysdep-x86_64/syscalls.h +96 -0

96 lines not on this page · raw message

arch/um/kernel/signal_kern.c +0 -31
Index: 2.6.10/arch/um/kernel/signal_kern.c
===================================================================
@@ -194,37 +194,6 @@
 	}
 }
 
-int sys_sigaction(int sig, const struct old_sigaction __user *act,
-			 struct old_sigaction __user *oact)
-{
-	struct k_sigaction new_ka, old_ka;
-	int ret;
-
-	if (act) {
-		old_sigset_t mask;
-		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
-		    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
-		    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
-			return -EFAULT;
-		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
-		__get_user(mask, &act->sa_mask);
-		siginitset(&new_ka.sa.sa_mask, mask);
-	}
-
-	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-	if (!ret && oact) {
-		if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
-		    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
-		    __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
-			return -EFAULT;
-		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-	}
-
-	return ret;
-}
-
 long sys_sigaltstack(const stack_t *uss, stack_t *uoss)
 {
 	return(do_sigaltstack(uss, uoss, PT_REGS_SP(&current->thread.regs)));
arch/um/kernel/sys_call_table.c +2 -60

212 lines not on this page · raw message

arch/um/kernel/syscall_kern.c +7 -115

147 lines not on this page · raw message

arch/um/kernel/tt/syscall_kern.c +0 -93

107 lines not on this page · raw message

arch/um/sys-i386/syscalls.c +123 -5

160 lines not on this page · raw message

arch/um/sys-x86_64/syscalls.c +191 -0

191 lines not on this page · raw message