diff -Naur -X exclude-files ac_cur/arch/um/include/kern_util.h ac/arch/um/include/kern_util.h --- ac_cur/arch/um/include/kern_util.h Fri Jun 1 20:50:47 2001 +++ ac/arch/um/include/kern_util.h Fri Jun 1 21:52:13 2001 @@ -19,9 +19,6 @@ extern char *linux_prog; extern char *gdb_init; -typedef long syscall_handler_t(struct sys_pt_regs regs); -extern syscall_handler_t *sys_call_table[]; - #define ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK)) #define ROUND_UP(addr) ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1) diff -Naur -X exclude-files ac_cur/arch/um/include/sysdep-i386/sigcontext.h ac/arch/um/include/sysdep-i386/sigcontext.h --- ac_cur/arch/um/include/sysdep-i386/sigcontext.h Fri Jun 1 20:50:47 2001 +++ ac/arch/um/include/sysdep-i386/sigcontext.h Fri Jun 1 21:53:07 2001 @@ -6,6 +6,7 @@ #ifndef __SYS_SIGCONTEXT_I386_H #define __SYS_SIGCONTEXT_I386_H +#define UM_ALLOCATE_SC(name) struct sigcontext name #define SC_FAULT_ADDR(sc) ((sc)->cr2) #define SC_FAULT_WRITE(sc) (((sc)->err) & 2) #define SC_IP(sc) ((sc)->eip) diff -Naur -X exclude-files ac_cur/arch/um/include/sysdep-i386/syscalls.h ac/arch/um/include/sysdep-i386/syscalls.h --- ac_cur/arch/um/include/sysdep-i386/syscalls.h Fri Jun 1 20:50:47 2001 +++ ac/arch/um/include/sysdep-i386/syscalls.h Fri Jun 1 21:54:18 2001 @@ -4,11 +4,18 @@ */ #include "asm/unistd.h" -#include "kern_util.h" + +typedef long syscall_handler_t(struct sys_pt_regs regs); + +#define EXECUTE_SYSCALL(syscall, regs) (*sys_call_table[syscall])(regs) extern syscall_handler_t sys_modify_ldt; +extern syscall_handler_t old_mmap_i386; +extern syscall_handler_t old_select; #define ARCH_SYSCALLS \ + [ __NR_mmap ] = old_mmap_i386, \ + [ __NR_select ] = old_select, \ [ __NR_vm86old ] = sys_ni_syscall, \ [ __NR_modify_ldt ] = sys_modify_ldt, \ [ __NR_lchown32 ] = sys_lchown, \ diff -Naur -X exclude-files ac_cur/arch/um/include/user_util.h ac/arch/um/include/user_util.h --- ac_cur/arch/um/include/user_util.h Fri Jun 1 21:35:45 2001 +++ ac/arch/um/include/user_util.h Fri Jun 1 21:52:35 2001 @@ -111,7 +111,6 @@ extern int get_pty(void); extern void save_signal_state(int *sig_ptr); extern void change_sig(int signal, int on); -extern void fill_in_regs(struct sys_pt_regs *regs, void *sc); extern void fill_in_sigcontext(void *sc, struct sys_pt_regs *regs, unsigned long cr2, int err); extern int activate_fd(int irq, int fd, void *dev_id); diff -Naur -X exclude-files ac_cur/arch/um/kernel/process.c ac/arch/um/kernel/process.c --- ac_cur/arch/um/kernel/process.c Fri Jun 1 20:50:47 2001 +++ ac/arch/um/kernel/process.c Fri Jun 1 21:55:16 2001 @@ -24,6 +24,7 @@ #include "user.h" #include "process.h" #include "sysdep/ptrace.h" +#include "sysdep/sigcontext.h" void stop_pid(int pid) { @@ -163,10 +164,10 @@ void signal_handler(void *task, unsigned long h, int sig) { void (*handler)(int, struct sigcontext); - struct sigcontext sc; void *regs; unsigned long cr2; int err; + UM_ALLOCATE_SC(sc); regs = process_state(task, &cr2, &err); fill_in_sigcontext(&sc, regs, cr2, err); diff -Naur -X exclude-files ac_cur/arch/um/kernel/sys_call_table.c ac/arch/um/kernel/sys_call_table.c --- ac_cur/arch/um/kernel/sys_call_table.c Fri Jun 1 21:47:26 2001 +++ ac/arch/um/kernel/sys_call_table.c Fri Jun 1 21:55:56 2001 @@ -82,7 +82,6 @@ extern syscall_handler_t sys_settimeofday; extern syscall_handler_t sys_getgroups16; extern syscall_handler_t sys_setgroups16; -extern syscall_handler_t old_select; extern syscall_handler_t sys_symlink; extern syscall_handler_t sys_lstat; extern syscall_handler_t sys_readlink; @@ -90,7 +89,6 @@ extern syscall_handler_t sys_swapon; extern syscall_handler_t sys_reboot; extern syscall_handler_t old_readdir; -extern syscall_handler_t old_mmap; extern syscall_handler_t sys_munmap; extern syscall_handler_t sys_truncate; extern syscall_handler_t sys_ftruncate; @@ -311,7 +309,6 @@ [ __NR_settimeofday ] = sys_settimeofday, [ __NR_getgroups ] = sys_getgroups16, [ __NR_setgroups ] = sys_setgroups16, - [ __NR_select ] = old_select, [ __NR_symlink ] = sys_symlink, [ __NR_oldlstat ] = sys_lstat, [ __NR_readlink ] = sys_readlink, @@ -319,7 +316,6 @@ [ __NR_swapon ] = sys_swapon, [ __NR_reboot ] = sys_reboot, [ __NR_readdir ] = old_readdir, - [ __NR_mmap ] = old_mmap, [ __NR_munmap ] = sys_munmap, [ __NR_truncate ] = sys_truncate, [ __NR_ftruncate ] = sys_ftruncate, diff -Naur -X exclude-files ac_cur/arch/um/kernel/syscall_kern.c ac/arch/um/kernel/syscall_kern.c --- ac_cur/arch/um/kernel/syscall_kern.c Fri Jun 1 20:50:47 2001 +++ ac/arch/um/kernel/syscall_kern.c Fri Jun 1 21:56:46 2001 @@ -17,6 +17,7 @@ #include "asm/ipc.h" #include "kern_util.h" #include "user_util.h" +#include "sysdep/syscalls.h" long um_mount(char * dev_name, char * dir_name, char * type, unsigned long new_flags, void * data) @@ -104,19 +105,15 @@ unsigned long offset; }; -int old_mmap(struct mmap_arg_struct *arg) +int old_mmap(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long offset) { - struct mmap_arg_struct a; - int err = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - - err = -EINVAL; - if (a.offset & ~PAGE_MASK) + int err = -EINVAL; + if (offset & ~PAGE_MASK) goto out; - err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); + err = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); out: return err; } @@ -175,22 +172,6 @@ return ret; } -struct sel_arg_struct { - unsigned long n; - fd_set *inp, *outp, *exp; - struct timeval *tvp; -}; - -int old_select(struct sel_arg_struct *arg) -{ - struct sel_arg_struct a; - - if (copy_from_user(&a, arg, sizeof(a))) - return -EFAULT; - /* sys_select() does the appropriate kernel locking */ - return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); -} - /* * sys_ipc() is the de-multiplexer for the SysV IPC calls.. * @@ -333,6 +314,8 @@ int nsyscalls = 0; +extern syscall_handler_t *sys_call_table[]; + long execute_syscall(struct sys_pt_regs regs) { long res; @@ -345,7 +328,7 @@ panic("syscall thread activated without a system call"); if((syscall >= NR_syscalls) || (syscall < 0)) return(-ENOSYS); - res = (*sys_call_table[syscall])(regs); + res = EXECUTE_SYSCALL(syscall, regs); return(res); } diff -Naur -X exclude-files ac_cur/arch/um/sys-i386/Makefile ac/arch/um/sys-i386/Makefile --- ac_cur/arch/um/sys-i386/Makefile Fri Jun 1 20:50:47 2001 +++ ac/arch/um/sys-i386/Makefile Fri Jun 1 21:57:25 2001 @@ -1,7 +1,7 @@ OBJ = sys.o OBJS = checksum.o ldt.o old-checksum.o ptrace.o ptrace_user.o semaphore.o \ - sigcontext.o + sigcontext.o syscalls.o OX_OBJS = ksyms.o EXTRA_CFLAGS = -I../include diff -Naur -X exclude-files ac_cur/arch/um/sys-i386/sigcontext.c ac/arch/um/sys-i386/sigcontext.c --- ac_cur/arch/um/sys-i386/sigcontext.c Fri Jun 1 20:50:47 2001 +++ ac/arch/um/sys-i386/sigcontext.c Fri Jun 1 21:58:41 2001 @@ -34,29 +34,6 @@ sc->cr2 = cr2; } -void fill_in_regs(struct sys_pt_regs *regs, void *sc_ptr) -{ - struct sigcontext *sc; - - sc = sc_ptr; - regs->regs[EBX] = sc->ebx; - regs->regs[ECX] = sc->ecx; - regs->regs[EDX] = sc->edx; - regs->regs[ESI] = sc->esi; - regs->regs[EDI] = sc->edi; - regs->regs[EBP] = sc->ebp; - regs->regs[EAX] = sc->eax; - regs->regs[DS] = sc->ds; - regs->regs[ES] = sc->es; - regs->regs[FS] = sc->fs; - regs->regs[GS] = sc->gs; - regs->regs[EIP] = sc->eip; - regs->regs[CS] = sc->cs; - regs->regs[EFL] = sc->eflags; - regs->regs[UESP] = sc->esp_at_signal; - regs->regs[SS] = sc->ss; -} - /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically diff -Naur -X exclude-files ac_cur/arch/um/sys-i386/syscalls.c ac/arch/um/sys-i386/syscalls.c --- ac_cur/arch/um/sys-i386/syscalls.c Wed Dec 31 19:00:00 1969 +++ ac/arch/um/sys-i386/syscalls.c Fri Jun 1 21:58:23 2001 @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#include "asm/mman.h" +#include "asm/uaccess.h" +#include "asm/unistd.h" + +/* + * Perform the select(nd, in, out, ex, tv) and mmap() system + * calls. Linux/i386 didn't use to be able to handle more than + * 4 system call parameters, so these system calls used a memory + * block for parameter passing.. + */ + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +extern int old_mmap(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long offset); + +int old_mmap_i386(struct mmap_arg_struct *arg) +{ + struct mmap_arg_struct a; + int err = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); + out: + return err; +} + +struct sel_arg_struct { + unsigned long n; + fd_set *inp, *outp, *exp; + struct timeval *tvp; +}; + +int old_select(struct sel_arg_struct *arg) +{ + struct sel_arg_struct a; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + /* sys_select() does the appropriate kernel locking */ + return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */