minix/servers/vm/signal.c
Ben Gras 35a108b911 panic() cleanup.
this change
   - makes panic() variadic, doing full printf() formatting -
     no more NO_NUM, and no more separate printf() statements
     needed to print extra info (or something in hex) before panicing
   - unifies panic() - same panic() name and usage for everyone -
     vm, kernel and rest have different names/syntax currently
     in order to implement their own luxuries, but no longer
   - throws out the 1st argument, to make source less noisy.
     the panic() in syslib retrieves the server name from the kernel
     so it should be clear enough who is panicing; e.g.
         panic("sigaction failed: %d", errno);
     looks like:
         at_wini(73130): panic: sigaction failed: 0
         syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
   - throws out report() - printf() is more convenient and powerful
   - harmonizes/fixes the use of panic() - there were a few places
     that used printf-style formatting (didn't work) and newlines
     (messes up the formatting) in panic()
   - throws out a few per-server panic() functions
   - cleans up a tie-in of tty with panic()

merging printf() and panic() statements to be done incrementally.
2010-03-05 15:05:11 +00:00

66 lines
1.6 KiB
C

#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/sigcontext.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 *
*===========================================================================*/
PUBLIC int do_push_sig(message *msg)
{
int r, n;
endpoint_t ep;
vir_bytes sp;
struct vmproc *vmp;
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;
}
vmp = &vmproc[n];
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);
if ((r=adjust(vmp, vmp->vm_arch.vm_seg[D].mem_len, sp)) != OK) {
printf("VM: do_push_sig: adjust() failed: %d\n", r);
return r;
}
return OK;
}