From: Ben Gras Date: Wed, 29 Aug 2012 15:31:38 +0000 (+0200) Subject: vm: remove stack handling for signals X-Git-Tag: v3.2.1~353 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-dsfromkey.html?a=commitdiff_plain;h=053fa581b5a065ff1fc8db9e1bf6528148147edd;p=minix.git vm: remove stack handling for signals . moved to the kernel as the handling was only reading it; the kernel may as well write it too --- diff --git a/commands/service/parse.c b/commands/service/parse.c index 7874f1c39..847379976 100644 --- a/commands/service/parse.c +++ b/commands/service/parse.c @@ -714,7 +714,7 @@ struct { "FORK", VM_FORK }, { "BRK", VM_BRK }, { "EXEC_NEWMEM", VM_EXEC_NEWMEM }, - { "PUSH_SIG", VM_PUSH_SIG }, + { "PUSH_SIG", 0 }, { "WILLEXIT", VM_WILLEXIT }, { "ADDDMA", VM_ADDDMA }, { "DELDMA", VM_DELDMA }, @@ -790,7 +790,12 @@ static void do_vm(config_t *cpe, struct rs_start *rs_start) if (vm_table[i].label == NULL) fatal("do_vm: unknown call '%s' at %s:%d", cpe->word, cpe->file, cpe->line); - SET_BIT(rs_start->rss_vm, vm_table[i].call_nr - VM_RQ_BASE); + + if(vm_table[i].call_nr) { + SET_BIT(rs_start->rss_vm, + vm_table[i].call_nr - VM_RQ_BASE); + } + first = FALSE; } } diff --git a/etc/system.conf b/etc/system.conf index 22b389197..cbe543db3 100644 --- a/etc/system.conf +++ b/etc/system.conf @@ -59,7 +59,6 @@ service pm FORK # 01 BRK # 02 EXEC_NEWMEM # 03 - PUSH_SIG # 04 WILLEXIT # 05 NOTIFY_SIG # 39 ; diff --git a/include/minix/com.h b/include/minix/com.h index 9bf3a411d..1383d0eb8 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -927,9 +927,6 @@ # define VMEN_ARGSSIZE m1_i2 # define VMEN_FLAGS m1_i3 /* result */ # define VMEN_STACK_TOP m1_p2 /* result */ -#define VM_PUSH_SIG (VM_RQ_BASE+4) -# define VMPS_ENDPOINT m1_i1 -# define VMPS_OLD_SP m1_p1 /* result */ #define VM_WILLEXIT (VM_RQ_BASE+5) # define VMWE_ENDPOINT m1_i1 diff --git a/include/minix/vm.h b/include/minix/vm.h index b12e6f2ec..f4faba996 100644 --- a/include/minix/vm.h +++ b/include/minix/vm.h @@ -9,7 +9,6 @@ int vm_exit(endpoint_t ep); int vm_fork(endpoint_t ep, int slotno, endpoint_t *child_ep); int vm_brk(endpoint_t ep, char *newaddr); -int vm_push_sig(endpoint_t ep, vir_bytes *old_sp); int vm_willexit(endpoint_t ep); int vm_adddma(endpoint_t proc_e, phys_bytes start, phys_bytes size); int vm_deldma(endpoint_t proc_e, phys_bytes start, phys_bytes size); diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 08204541b..2296bf835 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -545,6 +545,8 @@ void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc) } } +reg_t arch_get_sp(struct proc *p) { return p->p_reg.sp; } + #if !CONFIG_OXPCIE static void ser_init(void) { diff --git a/kernel/proto.h b/kernel/proto.h index 68f2000eb..28dbba4a6 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -206,6 +206,7 @@ void arch_do_syscall(struct proc *proc); int arch_phys_map(int index, phys_bytes *addr, phys_bytes *len, int *flags); int arch_phys_map_reply(int index, vir_bytes addr); +reg_t arch_get_sp(struct proc *p); int arch_enable_paging(struct proc * caller); int vm_check_range(struct proc *caller, struct proc *target, vir_bytes vir_addr, size_t bytes); diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 873c0ab4c..a8107a4df 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -38,6 +38,7 @@ int do_sigsend(struct proc * caller, message * m_ptr) return r; /* Compute the user stack pointer where sigcontext will be stored. */ + smsg.sm_stkptr = arch_get_sp(rp); scp = (struct sigcontext *) smsg.sm_stkptr - 1; /* Copy the registers to the sigcontext structure. */ diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 5fd5f5444..881596a5e 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -82,7 +82,6 @@ SRCS= \ vm_info.c \ vm_map_phys.c \ vm_notify_sig.c \ - vm_push_sig.c \ vm_umap.c \ vm_yield_get_block.c \ vm_procctl.c \ diff --git a/lib/libsys/vm_push_sig.c b/lib/libsys/vm_push_sig.c deleted file mode 100644 index d9185990c..000000000 --- a/lib/libsys/vm_push_sig.c +++ /dev/null @@ -1,20 +0,0 @@ - -#include "syslib.h" - -#include - -/*===========================================================================* - * vm_push_sig * - *===========================================================================*/ -int vm_push_sig(endpoint_t ep, vir_bytes *old_sp) -{ - message m; - int result; - - m.VMPS_ENDPOINT = ep; - result = _taskcall(VM_PROC_NR, VM_PUSH_SIG, &m); - *old_sp = (vir_bytes) m.VMPS_OLD_SP; - - return result; -} - diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 30eb4cab8..bb5ccd5a9 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -701,7 +701,6 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ * Return TRUE if this succeeded, FALSE otherwise. */ struct sigmsg sigmsg; - vir_bytes cur_sp; int r, sigflags, slot; if (!(rmp->mp_flags & UNPAUSED)) @@ -732,11 +731,6 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ sigdelset(&rmp->mp_sigpending, signo); sigdelset(&rmp->mp_ksigpending, signo); - if(vm_push_sig(rmp->mp_endpoint, &cur_sp) != OK) - return(FALSE); - - sigmsg.sm_stkptr = cur_sp; - /* Ask the kernel to deliver the signal */ r = sys_sigsend(rmp->mp_endpoint, &sigmsg); /* sys_sigsend can fail legitimately with EFAULT if diff --git a/servers/vm/Makefile b/servers/vm/Makefile index cfe24c038..c3b139569 100644 --- a/servers/vm/Makefile +++ b/servers/vm/Makefile @@ -3,7 +3,7 @@ PROG= vm SRCS= main.c alloc.c utility.c exit.c fork.c break.c \ - signal.c mmap.c slaballoc.c region.c pagefaults.c addravl.c \ + mmap.c slaballoc.c region.c pagefaults.c addravl.c \ physravl.c rs.c queryexit.c yieldedavl.c regionavl.c DPADD+= ${LIBSYS} diff --git a/servers/vm/break.c b/servers/vm/break.c index b8ea5f0be..0c38eab73 100644 --- a/servers/vm/break.c +++ b/servers/vm/break.c @@ -11,7 +11,6 @@ * * The entry points into this file are: * do_brk: BRK/SBRK system calls to grow or shrink the data segment - * adjust: see if a proposed segment adjustment is allowed */ #define _SYSTEM 1 diff --git a/servers/vm/main.c b/servers/vm/main.c index 46308f43e..6f5b2781f 100644 --- a/servers/vm/main.c +++ b/servers/vm/main.c @@ -392,7 +392,6 @@ void init_vm(void) CALLMAP(VM_EXIT, do_exit); CALLMAP(VM_FORK, do_fork); CALLMAP(VM_BRK, do_brk); - CALLMAP(VM_PUSH_SIG, do_push_sig); CALLMAP(VM_WILLEXIT, do_willexit); CALLMAP(VM_ADDDMA, do_adddma); CALLMAP(VM_DELDMA, do_deldma); diff --git a/servers/vm/proto.h b/servers/vm/proto.h index 01d9a7c1e..7bec490aa 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -59,12 +59,8 @@ int do_fork(message *msg); /* break.c */ int do_brk(message *msg); -int adjust(struct vmproc *rmp, vir_clicks data_clicks, vir_bytes sp); int real_brk(struct vmproc *vmp, vir_bytes v); -/* signal.c */ -int do_push_sig(message *msg); - /* map_mem.c */ int map_memory(endpoint_t sour, endpoint_t dest, vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag); diff --git a/servers/vm/signal.c b/servers/vm/signal.c deleted file mode 100644 index b92267c5a..000000000 --- a/servers/vm/signal.c +++ /dev/null @@ -1,58 +0,0 @@ - -#define _SYSTEM 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "glo.h" -#include "vm.h" -#include "proto.h" -#include "util.h" - -#define DATA_CHANGED 1 /* flag value when data segment size changed */ -#define STACK_CHANGED 2 /* flag value when stack size changed */ - -/*===========================================================================* - * do_push_sig * - *===========================================================================*/ -int do_push_sig(message *msg) -{ - int r, n; - endpoint_t ep; - vir_bytes sp; - - ep = msg->VMPS_ENDPOINT; - - if((r=vm_isokendpt(ep, &n)) != OK) { - printf("VM: bogus endpoint %d from %d\n", ep, msg->m_source); - return r; - } - - if ((r=get_stack_ptr(ep, &sp)) != OK) - panic("couldn't get new stack pointer (for sig): %d", r); - - /* Save old SP for caller */ - msg->VMPS_OLD_SP = (char *) sp; - - /* Make room for the sigcontext and sigframe struct. */ - sp -= sizeof(struct sigcontext) - + 3 * sizeof(char *) + 2 * sizeof(int); - - return OK; -} - diff --git a/servers/vm/utility.c b/servers/vm/utility.c index a02a38ee5..8b6e64f9f 100644 --- a/servers/vm/utility.c +++ b/servers/vm/utility.c @@ -137,23 +137,6 @@ int vm_isokendpt(endpoint_t endpoint, int *proc) } -struct proc mytmpproc; - -/*===========================================================================* - * get_stack_ptr * - *===========================================================================*/ -int get_stack_ptr(proc_nr_e, sp) -int proc_nr_e; /* process to get sp of */ -vir_bytes *sp; /* put stack pointer here */ -{ - int s; - - if ((s=sys_getproc(&mytmpproc, proc_nr_e)) != OK) - return(s); - *sp = mytmpproc.p_reg.sp; - return(OK); -} - /*===========================================================================* * do_info * *===========================================================================*/