home *** CD-ROM | disk | FTP | other *** search
- |
- | setjmp.cpp
- |
- .text
- .even
- .globl _setjmp
- _setjmp:
- movel sp@(4),a0 | address of jmp_buf[]
- movel sp@,a0@ | save return address
- moveml d2-d7/a2-a7,a0@(4) | save registers d2-d7/a2-a7
- clrl d0 | return value is 0
- rts
-
- .globl _longjmp
- .globl ___mint
-
- _longjmp:
- #ifdef __MSHORT__
- tstw ___mint | see if MiNT is active
- #else
- tstl ___mint
- #endif
- beq NOMINT | no -- do not call sigreturn
- movew #0x11a, sp@- | Psigreturn() system call
- trap #1 | (ignored if not in a sig handler)
- addqw #2, sp
- NOMINT:
- movel sp@(4),a0 | address of jmp_buf[]
- #ifdef __MSHORT__
- movew sp@(8),d0 | value to return
- #else
- movel sp@(8),d0 | value to return
- #endif
- bne L1 | may not be 0
- movl #1, d0
- L1:
- moveml a0@(4),d2-d7/a2-a7 | restore saved reggies
- movl a0@,sp@ | and the saved return address
- rts
-