improved signal handling

This commit is contained in:
ceriel 1988-04-20 17:10:21 +00:00
parent 79e3ac1a26
commit 211f5d2ad8
3 changed files with 80 additions and 45 deletions

View file

@ -11,55 +11,38 @@ all: $(INTS) em
em: em.c em: em.c
$(CC) -o em -I../../../h em.c $(CC) -o em -I../../../h em.c
em2_t---: $(FILES) compile tmp.s: $(FILES)
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 >tmp.s cat $(FILES) > tmp.s
./compile -o em2_t--- tmp.s
rm -f tmp.s
em2_----: $(FILES) compile em2_t---: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 >tmp.s ./compile -o em2_t--- -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s
./compile -o em2_---- tmp.s
rm -f tmp.s
em2_t-cp: $(FILES) compile em2_----: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 >tmp.s ./compile -o em2_---- -P $(FLTRAP) -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 tmp.s
./compile -o em2_t-cp tmp.s
rm -f tmp.s
em2_t-c-: $(FILES) compile em2_t-cp: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 >tmp.s ./compile -o em2_t-cp -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s
./compile -o em2_t-c- tmp.s
rm -f tmp.s
em2_t--p: $(FILES) compile em2_t-c-: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 >tmp.s ./compile -o em2_t-c- -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s
./compile -o em2_t--p tmp.s
rm -f tmp.s
em4_t---: $(FILES) compile em2_t--p: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 >tmp.s ./compile -o em2_t--p -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s
./compile -o em4_t--- tmp.s
rm -f tmp.s
em4_----: $(FILES) compile em4_t---: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 >tmp.s ./compile -o em4_t--- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s
./compile -o em4_---- tmp.s
rm -f tmp.s
em4_t-cp: $(FILES) compile em4_----: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 >tmp.s ./compile -o em4_---- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 tmp.s
./compile -o em4_t-cp tmp.s
rm -f tmp.s
em4_t-c-: $(FILES) compile em4_t-cp: tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 >tmp.s ./compile -o em4_t-cp -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s
./compile -o em4_t-c- tmp.s
rm -f tmp.s
em4_t--p: $(FILES) compile em4_t-c-:tmp.s compile
cat $(FILES) | $(CPP) -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 >tmp.s ./compile -o em4_t-c- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s
./compile -o em4_t--p tmp.s
rm -f tmp.s em4_t--p: tmp.s compile
./compile -o em4_t--p -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s
compile: Makefile compile: Makefile
case `ack_sys` in sun*) MACH=sun2;; pmds*) MACH=pmds4;; \ case `ack_sys` in sun*) MACH=sun2;; pmds*) MACH=pmds4;; \

View file

@ -23,6 +23,9 @@
!--------------------------------------------------------------------------- !---------------------------------------------------------------------------
_m_a_i_n: _m_a_i_n:
#ifdef __BSD4_2
jsr getmask
#endif
move.l sp,d0 move.l sp,d0
add.l #0x10000,d0 ! rough guess. What is the add.l #0x10000,d0 ! rough guess. What is the
! real top ??? ! real top ???

View file

@ -20,11 +20,11 @@ _sigtrp: move.l (sp)+,d2 !save return address
move.l (a1),d2 !previous trap number in d2 move.l (a1),d2 !previous trap number in d2
comp #256,d1 !-2 and -1 special comp #256,d1 !-2 and -1 special
bcc 1f bcc 1f
move.l #sig_adr-4,d3 add.l #sig_adr-4,a0
add.l a0,d3 !Get the pointer to the trap- move.l (a0),d3 !Get the pointer to the trap-
bne 2f !procedure to give as argument to bne 2f !procedure to give as argument to
sig_bad: mov 22,-(sp) !_Xsignal. If pointer 0 trapping is sig_bad: mov #22,-(sp) !_Xsignal. If pointer 0 trapping is
mov 22,-(sp) !not legal mov #22,-(sp) !not legal
jmp (a4) jmp (a4)
1: comp #-3,d1 !-2:reset default , -3: ignore 1: comp #-3,d1 !-2:reset default , -3: ignore
bmi sig_bad bmi sig_bad
@ -48,34 +48,58 @@ sig_trp: .data4 -2 ; .data4 -2 ; .data4 -2 ; .data4 -2
!the next procedures map the catched signal to em errors. The em error !the next procedures map the catched signal to em errors. The em error
!procedure will handle this. !procedure will handle this.
sig1: pea retutrap sig1: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp,d0 move.l sig_trp,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig2: pea retutrap sig2: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+4,d0 move.l sig_trp+4,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig3: pea retutrap sig3: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+8,d0 move.l sig_trp+8,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig8: pea retutrap sig8: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+28,d0 move.l sig_trp+28,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig13: pea retutrap sig13: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+48,d0 move.l sig_trp+48,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig14: pea retutrap sig14: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+52,d0 move.l sig_trp+52,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig15: pea retutrap sig15: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+56,d0 move.l sig_trp+56,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
sig16: pea retutrap sig16: pea retutrap
#ifdef __BSD4_2
jsr setmask
#endif
move.l sig_trp+60,d0 move.l sig_trp+60,d0
mov d0,-(sp) mov d0,-(sp)
bra error bra error
@ -83,13 +107,38 @@ retutrap: add.l #4,sp !remove signumber
rtr rtr
sig12: pea sig12 sig12: pea sig12
#ifdef __BSD4_2
jsr setmask
#endif
mov #12,-(sp) mov #12,-(sp)
bsr _Xsignal bsr _Xsignal
bsr e_badmon bsr e_badmon
rtr rtr
sig11: move.l 4(a5),d0 sig11:
#ifdef __BSD4_2
jsr setmask
#endif
move.l 4(a5),d0
sub.l sp,d0 sub.l sp,d0
bcs e_memflt !in this case error handling possible bcs e_memflt !in this case error handling possible
move.l ml,sp !refresh stack and stop . move.l ml,sp !refresh stack and stop .
bra notrap1 bra notrap1
#ifdef __BSD4_2
setmask:
move.l mask,-(sp)
jsr _sigsetmask
add.l #4,sp
rts
getmask:
clr.l -(sp)
jsr _sigblock
add.l #4,sp
move.l d0,mask
rts
.sect .data
mask:
.data4 0
#endif