1 | ;
|
---|
2 | ; SIGNAL.INC -- Signal processing
|
---|
3 | ;
|
---|
4 | ; Copyright (c) 1991-1998 by Eberhard Mattes
|
---|
5 | ;
|
---|
6 | ; This file is part of emx.
|
---|
7 | ;
|
---|
8 | ; emx is free software; you can redistribute it and/or modify it
|
---|
9 | ; under the terms of the GNU General Public License as published by
|
---|
10 | ; the Free Software Foundation; either version 2, or (at your option)
|
---|
11 | ; any later version.
|
---|
12 | ;
|
---|
13 | ; emx is distributed in the hope that it will be useful,
|
---|
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | ; GNU General Public License for more details.
|
---|
17 | ;
|
---|
18 | ; You should have received a copy of the GNU General Public License
|
---|
19 | ; along with emx; see the file COPYING. If not, write to
|
---|
20 | ; the Free Software Foundation, 59 Temple Place - Suite 330,
|
---|
21 | ; Boston, MA 02111-1307, USA.
|
---|
22 | ;
|
---|
23 | ; See emx.asm for a special exception.
|
---|
24 | ;
|
---|
25 |
|
---|
26 | ;
|
---|
27 | ; Cf. /emx/include/signal.h
|
---|
28 | ;
|
---|
29 | SIGHUP = 1 ; Hangup
|
---|
30 | SIGINT = 2 ; Interrupt (Ctrl-C)
|
---|
31 | SIGQUIT = 3 ; Quit
|
---|
32 | SIGILL = 4 ; Illegal instruction
|
---|
33 | SIGTRAP = 5 ; Single step (debugging)
|
---|
34 | SIGABRT = 6 ; abort ()
|
---|
35 | SIGEMT = 7 ; ???
|
---|
36 | SIGFPE = 8 ; Floating point
|
---|
37 | SIGKILL = 9 ; Kill process
|
---|
38 | SIGBUS = 10 ; ???
|
---|
39 | SIGSEGV = 11 ; Segmentation fault
|
---|
40 | SIGSYS = 12 ; Invalid argument to system call
|
---|
41 | SIGPIPE = 13 ; Broken pipe
|
---|
42 | SIGALRM = 14 ; Alarm
|
---|
43 | SIGTERM = 15 ; Termination, process killed
|
---|
44 | SIGUSR1 = 16 ; User-defined signal #1
|
---|
45 | SIGUSR2 = 17 ; User-defined signal #2
|
---|
46 | SIGCLD = 18 ; Death of a child process
|
---|
47 | SIGBREAK = 21 ; Break (Ctrl-Break)
|
---|
48 | SIGWINCH = 28 ; Window size change
|
---|
49 |
|
---|
50 | SIGNALS = 29 ; Signals 0..28
|
---|
51 |
|
---|
52 | ;
|
---|
53 | ; Cf. /emx/include/signal.h
|
---|
54 | ;
|
---|
55 | SIG_DFL = 0 ; Default handler
|
---|
56 | SIG_IGN = 1 ; Ignore signal
|
---|
57 | SIG_ACK = 4 ; Acknowledges receipt of a signal
|
---|
58 |
|
---|
59 | SIG_ERR = -1 ; Return value of signal()
|
---|
60 |
|
---|
61 | SA_NOCLDSTOP = 0001H ; See POSIX.1
|
---|
62 | SA_SYSV = 0002H ; Reset to SIG_DFL
|
---|
63 | SA_ACK = 0004H ; Don't unblock automatically
|
---|
64 | SA_TRAP = 8000H ; Signal generated by an exception
|
---|
65 |
|
---|
66 | SIG_BLOCK = 1
|
---|
67 | SIG_UNBLOCK = 2
|
---|
68 | SIG_SETMASK = 3
|
---|
69 |
|
---|
70 | ;
|
---|
71 | ; struct sigaction
|
---|
72 | ;
|
---|
73 | SIGACTION STRUC
|
---|
74 | SA_HANDLER DD ?
|
---|
75 | SA_MASK DD ?
|
---|
76 | SA_FLAGS DD ?
|
---|
77 | SIGACTION ENDS
|
---|
78 |
|
---|
79 | ;
|
---|
80 | ; Stack frame for signal handlers
|
---|
81 | ;
|
---|
82 | SIGFRAME STRUC
|
---|
83 | SF_EIP DD ?
|
---|
84 | SF_ARG DD ?
|
---|
85 | SF_SIGNATURE DD ?
|
---|
86 | SF_SIGNO DD ?
|
---|
87 | SF_FLAGS DD ?
|
---|
88 | SF_MASK DD ?
|
---|
89 | SIGFRAME ENDS
|
---|
90 |
|
---|
91 | SIG_BLOCK_MASK = NOT (1 SHL SIGKILL)
|
---|
92 |
|
---|
93 | SIG_SIGNATURE = 9A003CFFH ; See PMINT.ASM & EXCEPT.ASM for details
|
---|
94 | SIG_EIP = -42 ; Beyond CS limit
|
---|
95 |
|
---|
96 | IFNDEF __SIGNAL
|
---|
97 |
|
---|
98 | SV_DATA SEGMENT
|
---|
99 |
|
---|
100 | EXTRN CRIT_ERR_FLAG:BYTE
|
---|
101 | EXTRN SIG_CORE:BYTE ; Signals which dump core
|
---|
102 | EXTRN SIG_VALID:BYTE ; Valid signal numbers
|
---|
103 | EXTRN EMERGENCY_TIMER:BYTE ; Timer for emergency exit
|
---|
104 | EXTRN EMERGENCY_FLAG:BYTE ; Flag for emergency exit
|
---|
105 |
|
---|
106 | SV_DATA ENDS
|
---|
107 |
|
---|
108 |
|
---|
109 | SV_CODE SEGMENT
|
---|
110 |
|
---|
111 | EXTRN SIG_DELIVER_PENDING:NEAR ; Deliver pending signals
|
---|
112 | EXTRN SIG_USER_CALL:NEAR ; Invoke user signal handler
|
---|
113 | EXTRN SIG_RETURN:NEAR ; Return from signal handler
|
---|
114 | EXTRN SIG_MSG:NEAR ; Display "Stopped by ..."
|
---|
115 | EXTRN DO_SIGNAL:NEAR ; Implement __signal()
|
---|
116 | EXTRN DO_SIGACTION:NEAR ; Implement __sigaction()
|
---|
117 | SV_CODE ENDS
|
---|
118 |
|
---|
119 |
|
---|
120 | INIT_CODE SEGMENT
|
---|
121 |
|
---|
122 | EXTRN HOOK_INT:NEAR ; Hook interrupts
|
---|
123 | EXTRN CLEANUP_SIGNAL:NEAR ; Remove interrupt hooks
|
---|
124 |
|
---|
125 | INIT_CODE ENDS
|
---|
126 |
|
---|
127 | ENDIF
|
---|