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
This commit is contained in:
Ben Gras 2012-08-29 17:31:38 +02:00
parent 860224a4d4
commit 053fa581b5
16 changed files with 12 additions and 116 deletions

View file

@ -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;
}
}

View file

@ -59,7 +59,6 @@ service pm
FORK # 01
BRK # 02
EXEC_NEWMEM # 03
PUSH_SIG # 04
WILLEXIT # 05
NOTIFY_SIG # 39
;

View file

@ -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

View file

@ -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);

View file

@ -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)
{

View file

@ -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);

View file

@ -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. */

View file

@ -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 \

View file

@ -1,20 +0,0 @@
#include "syslib.h"
#include <minix/vm.h>
/*===========================================================================*
* 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;
}

View file

@ -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

View file

@ -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}

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -1,58 +0,0 @@
#define _SYSTEM 1
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/config.h>
#include <minix/const.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
#include <minix/keymap.h>
#include <minix/minlib.h>
#include <minix/type.h>
#include <minix/ipc.h>
#include <minix/sysutil.h>
#include <minix/syslib.h>
#include <minix/bitmap.h>
#include <sys/signal.h>
#include <errno.h>
#include <env.h>
#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;
}

View file

@ -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 *
*===========================================================================*/