18,11 → 18,11 |
|
/** |
------------ |
CVS : $Id: ego.c,v 1.2 2002-10-28 08:11:29 pj Exp $ |
CVS : $Id: ego.c,v 1.3 2003-01-07 17:10:15 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-10-28 08:11:29 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:10:15 $ |
------------ |
**/ |
|
111,32 → 111,6 |
|
/****************************************************************/ |
|
/* This is the exception handler. It is called when an exception |
is raised. |
It exits from the graphical mode, then it prints a message and |
shutdown the kernel using sys_abort() |
*/ |
|
void demo_exc_handler(int signo, siginfo_t *info, void *extra) |
{ |
struct timespec t; |
|
grx_close(); |
|
/* Default action for an kern exception is */ |
kern_cli(); |
ll_gettime(TIME_EXACT, &t), |
cprintf("\nS.Ha.R.K. Exception raised!!!" |
"\nTime (s:ns) :%ld:%ld" |
"\nException number:%d (numbers in include/bits/errno.h)" |
"\nPID :%d\n", |
t.tv_sec, t.tv_nsec, info->si_value.sival_int, |
info->si_task); |
sys_abort(1); |
} |
|
/******************************************************************/ |
|
/* This function is called when Alt-X is pressed. |
It simply shutdown the system using sys_end. |
Note that the byebye() function is called only if we exit from |
176,21 → 150,9 |
PID pid1, pid2, pid3; |
KEY_EVT emerg; |
HARD_TASK_MODEL m1, m2, m3; |
struct sigaction action; |
|
/* Init the standard S.Ha.R.K. exception handler */ |
action.sa_flags = SA_SIGINFO; /* Set the signal action */ |
action.sa_sigaction = demo_exc_handler; |
action.sa_handler = 0; |
sigfillset(&action.sa_mask); /* we block all the other signals... */ |
|
if (sigaction(SIGHEXC, &action, NULL) == -1) { /* set the signal */ |
perror("Error initializing signals..."); |
sys_end(); |
} |
|
/* Set the closing function */ |
sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT|NO_AT_ABORT); |
sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT); |
|
/* Initializes the semaphore */ |
sem_init(&mutex,0,1); |