2 mes
2,_EM_WSIZE
,_EM_PSIZE
4 ; layout of a setjmp buffer
:
7 ; | flag |
(!0 when blocked signals
saved (POSIX
))
9 ; | signal mask
/set |
(for Berkeley
4.[2-] / POSIX
)
17 ; setjmp saves the signalmask
, PC
, SP
, and LB of caller
, and creates a
18 ; GTO descriptor
from this
.
19 ; The big problem here
is how to get the return address
, i
.e
. the PC of
20 ; the caller
; This problem
is solved by the front
-end, which must pass
21 ; it
as an extra parameter to setjmp
.
23 ; a GTO descriptor must be in the global data area
30 #
if defined(_POSIX_SOURCE
)
31 ; save mask of currently blocked signals
.
32 ; longjmp must restore this mask
33 lol _EM_PSIZE
; the flag
integer at offset _EM_PSIZE
36 stf
3*_EM_PSIZE
+_EM_LSIZE
37 lol _EM_PSIZE
; the flag
integer at offset _EM_PSIZE
45 #elif
defined(__BSD4_2
)
54 ; create GTO descriptor for longjmp
56 dch
; Local Base of caller
57 lxa
0 ; Stackpointer of caller
58 lal _EM_PSIZE
+_EM_WSIZE
59 loi _EM_PSIZE
; Return address of caller
61 loi _EM_PSIZE
; address of jmpbuf
62 sti
3*_EM_PSIZE
; LB
, SP
, and PC stored in jmpbuf
64 ret _EM_WSIZE
; setjmp must return
0
68 ; put argument in function
result area
75 #
if defined(_POSIX_SOURCE
)
76 ; restore blocked mask
79 lof
3*_EM_PSIZE
+_EM_LSIZE
87 #elif
defined(__BSD4_2
)
98 loi _EM_PSIZE
; address of jmpbuf
100 blm
3*_EM_PSIZE
; fill GTO descriptor
from jmpbuf
101 lol _EM_PSIZE
; second parameter of longjmp
: the return value
104 ; of course
, longjmp may
not return
0!
107 ; put return value in function
result area
110 gto gtobuf
; there we go
...
111 ; ASP
and GTO
do not damage function
result area