Commit 810f52c6 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] 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: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 223ffc34
......@@ -10,9 +10,9 @@ obj-y = checksum.o config.o exec_kern.o exitcode.o \
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
......
......@@ -30,6 +30,7 @@ extern int protect(int fd, unsigned long addr, unsigned long len,
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
......
......@@ -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);
}
/*
......
......@@ -154,27 +154,6 @@ long sys_olduname(struct oldold_utsname * name)
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
......
......@@ -30,6 +30,7 @@ extern void do_syscall(void *task, int pid, int local_using_sysemu);
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
......
......@@ -22,15 +22,14 @@ void syscall_handler_tt(int sig, union uml_pt_regs *regs)
{
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 @@ void syscall_handler_tt(int sig, union uml_pt_regs *regs)
SC_SET_SYSCALL_RETURN(sc, result);
syscall_trace(regs, 1);
record_syscall_end(index, result);
}
void do_sigtrap(void *task)
......
......@@ -184,9 +184,8 @@ int tracing_pid = -1;
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 @@ int tracer(int (*init_proc)(void *), void *sp)
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;
......
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