Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/**
20
 ------------
21
 CVS :        $Id: exchtxt.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1.1.1 $
25
 Last update: $Date: 2002-03-29 14:12:52 $
26
 ------------
27
**/
28
 
29
/*
30
 * Copyright (C) 2000 Paolo Gai
31
 *
32
 * This program is free software; you can redistribute it and/or modify
33
 * it under the terms of the GNU General Public License as published by
34
 * the Free Software Foundation; either version 2 of the License, or
35
 * (at your option) any later version.
36
 *
37
 * This program is distributed in the hope that it will be useful,
38
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40
 * GNU General Public License for more details.
41
 *
42
 * You should have received a copy of the GNU General Public License
43
 * along with this program; if not, write to the Free Software
44
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
45
 *
46
 */
47
 
48
#include <kernel/kern.h>
49
 
50
static void thehandler(int signo, siginfo_t *info, void *extra);
51
 
52
/*
53
   This exception handler should be good for text applications that do NOT
54
   use graphics
55
*/
56
int set_exchandler_text(void)
57
{
58
  struct sigaction action;
59
 
60
  /* Init the standard S.Ha.R.K. exception handler */
61
  action.sa_flags = SA_SIGINFO;            /* Set the signal action */
62
  action.sa_sigaction = thehandler;
63
  action.sa_handler = 0;
64
  sigfillset(&action.sa_mask); /* we block all the other signals... */
65
 
66
  return sigaction(SIGHEXC, &action, NULL); /* set the signal */
67
}
68
 
69
 
70
void thehandler(int signo, siginfo_t *info, void *extra)
71
{
72
  struct timespec t;
73
 
74
  /* Default action for an kern exception is  */
75
  kern_cli();
76
  ll_gettime(TIME_EXACT, &t),
77
  kern_printf("\nHartik Exception raised!!!"
78
            "\nTime (s:ns)     :%d:%d"
79
            "\nException number:%d"
80
            "\nPID             :%d\n",
81
            t.tv_sec, t.tv_nsec, info->si_value.sival_int,
82
            info->si_task);
83
  sys_abort(AHEXC);
84
}
85
 
86
 
87
 
88