ack/lang/m2/libm2/init.c
ceriel 18b719de80 killbss routine smarter now; does not overwrite all BSS; did not work
as it should, because systemcall interface also uses the fact that BSS = 0
1988-12-02 15:39:59 +00:00

61 lines
1.3 KiB
C

/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
Module: initialization and some global vars
Author: Ceriel J.H. Jacobs
Version: $Header$
*/
#include <signal.h>
#include <em_abs.h>
#include <m2_traps.h>
/* map unix signals onto EM traps */
init()
{
sigtrp(M2_UNIXSIG, SIGHUP);
sigtrp(M2_UNIXSIG, SIGINT);
sigtrp(M2_UNIXSIG, SIGQUIT);
sigtrp(EILLINS, SIGILL);
sigtrp(M2_UNIXSIG, SIGTRAP);
sigtrp(M2_UNIXSIG, SIGIOT);
sigtrp(M2_UNIXSIG, SIGEMT);
/* sigtrp(M2_UNIXSIG, SIGFPE); leave this one for EM runtime startoff*/
sigtrp(M2_UNIXSIG, SIGBUS);
sigtrp(M2_UNIXSIG, SIGSEGV);
sigtrp(EBADMON, SIGSYS);
sigtrp(M2_UNIXSIG, SIGPIPE);
sigtrp(M2_UNIXSIG, SIGALRM);
sigtrp(M2_UNIXSIG, SIGTERM);
}
#if em22 || em24 || em44
killbss()
{
}
#else
static int blablabla; /* We cannot use end, because then also
bss allocated for the systemcall lib
would be overwritten. Lets hope that
this helps ...
*/
killbss()
{
extern char *edata;
register char *p = (char *) &edata;
while (p < (char *) &blablabla) *p++ = 0x66;
}
#endif
extern int catch();
int (*handler)() = catch;
char **argv = 0, **environ = 0;
int argc = 0, StackSize = 0;
char *CurrentProcess = 0, MainProcess = 0, StackBase = 0, MainLB = 0;