UML - Clean up the syscall path
PATCH 9/16 UML - Clean up the syscall path
This patch removes some useless code from the system call path, and removes some debug code, which will reappear in a configurable form in the syscall-debug patch.
Signed-off-by Jeff Dike <[email protected]>
arch/um/kernel/Makefile +3 -3
@@ -10,9 +10,9 @@ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \ sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \ - syscall_kern.o syscall_user.o sysrq.o sys_call_table.o tempfile.o \ - time.o time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o \ - um_arch.o umid.o user_util.o + syscall_kern.o sysrq.o sys_call_table.o tempfile.o time.o time_kern.o \ + tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o umid.o \ + user_util.o obj-$(CONFIG_BLK_DEV_INITRD) += initrd_kern.o initrd_user.o obj-$(CONFIG_GPROF) += gprof_syms.o
arch/um/kernel/skas/include/skas.h +1 -0
@@ -30,6 +30,7 @@extern void user_signal (int sig,union uml_pt_regs *regs);extern int new_mm (int from);extern void start_userspace (int cpu); +extern long execute_syscall_skas (void *r);#endif
arch/um/kernel/skas/syscall_user.c +2 -6
@@ -9,22 +9,18 @@#include "syscall_user.h" #include "sysdep/ptrace.h" #include "sysdep/sigcontext.h" - +#include "skas.h" void handle_syscall (union uml_pt_regs *regs) {long result; -int index; - - index =record_syscall_start (UPT_SYSCALL_NR (regs));syscall_trace (regs,0 ); - result =execute_syscall (regs); + result =execute_syscall_skas (regs);REGS_SET_SYSCALL_RETURN (regs->skas.regs, result);syscall_trace (regs,1 ); -record_syscall_end (index, result); }/*
arch/um/kernel/syscall_kern.c +0 -21
@@ -154,27 +154,6 @@return error; } -long execute_syscall (void *r) -{ -return (CHOOSE_MODE_PROC (execute_syscall_tt, execute_syscall_skas, r)); -} - -DEFINE_SPINLOCK (syscall_lock); - -static int syscall_index =0 ; - -int next_syscall_index (int limit) -{ -int ret; - -spin_lock (&syscall_lock); - ret = syscall_index; -if (++syscall_index == limit) - syscall_index =0 ; -spin_unlock (&syscall_lock); -return (ret); -} -/* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically
arch/um/kernel/tt/include/tt.h +1 -0
@@ -30,6 +30,7 @@extern void do_sigtrap (void *task);extern int is_valid_pid (int pid);extern void remap_data (void *segment_start,void *segment_end,int w); +extern long execute_syscall_tt (void *r);#endif
arch/um/kernel/tt/syscall_user.c +2 -4
@@ -22,15 +22,14 @@ {void *sc;long result; -int index, syscall; +int syscall; syscall =UPT_SYSCALL_NR (regs); sc =UPT_SC (regs);SC_START_SYSCALL (sc); - index =record_syscall_start (syscall);syscall_trace (regs,0 ); - result =execute_syscall (regs); + result =execute_syscall_tt (regs);/* regs->sc may have changed while the system call ran (there may * have been an interrupt or segfault), so it needs to be refreshed.
@@ -40,7 +39,6 @@SC_SET_SYSCALL_RETURN (sc, result);syscall_trace (regs,1 ); -record_syscall_end (index, result); }void do_sigtrap (void *task)
arch/um/kernel/tt/tracer.c +1 -18
@@ -184,9 +184,8 @@int tracer (int (*init_proc)(void *),void *sp) {void *task =NULL ; -unsigned long eip =0 ;int status, pid =0 , sig =0 , cont_type, tracing =0 , op =0 ; -int last_index, proc_id =0 , n, err, old_tracing =0 , strace =0 ; +int proc_id =0 , n, err, old_tracing =0 , strace =0 ;int local_using_sysemu =0 ;signal (SIGPIPE ,SIG_IGN );
@@ -279,22 +278,6 @@else if (WIFSTOPPED (status)){ proc_id =pid_to_processor_id (pid); sig =WSTOPSIG (status); -if (signal_index[proc_id] ==1024 ){ - signal_index[proc_id] =0 ; - last_index =1023 ; - } -else last_index = signal_index[proc_id] -1 ; -if (((sig ==SIGPROF ) || (sig ==SIGVTALRM ) || - (sig ==SIGALRM )) && - (signal_record[proc_id][last_index].signal == sig)&& - (signal_record[proc_id][last_index].pid == pid)) - signal_index[proc_id] = last_index; - signal_record[proc_id][signal_index[proc_id]].pid = pid; -gettimeofday (&signal_record[proc_id][signal_index[proc_id]].time,NULL ); - eip =ptrace (PTRACE_PEEKUSER , pid,PT_IP_OFFSET ,0 ); - signal_record[proc_id][signal_index[proc_id]].addr = eip; - signal_record[proc_id][signal_index[proc_id]++].signal = sig; -if (proc_id ==-1 ){sleeping_process_signal (pid, sig);continue ;
-------------------------------------------------------
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