34,7 → 34,7 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
* |
* CVS : $Id: cabs.c,v 1.2 2002-10-28 08:11:29 pj Exp $ |
* CVS : $Id: cabs.c,v 1.3 2003-01-07 17:10:15 pj Exp $ |
*/ |
|
/*--------------------------------------------------------------*/ |
88,32 → 88,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 |
160,23 → 134,10 |
|
int main(int argc, char **argv) |
{ |
struct sigaction action; |
|
char c = 0; /* character from keyboard */ |
|
/* 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); |
|
/* graphic card Initialization */ |
if (grx_init() < 1) { |