Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/clib/setjmp.s
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

25 lines
820 B
ArmAsm

*
* Setjmp / longjmp implementation. See file "setjmp.h" for details.
*
.globl _setjmp * Set up longjump
.globl _longjmp * do longjump
*
_setjmp: * Save environment
movea.l 4(a7),a0 * a0 -> Environment buffer
move.l a7,(a0)+ * Stack pointer to first long
move.l a6,(a0)+ * Frame pointer to second long
move.l (a7),(a0)+ * Return address to third long
movem.l d2-d7/a2-a5,(a0) * Save register variables
clr.l d0 * Return 0 value
rts * Return to caller
*
_longjmp: * Return to saved point
movea.l 4(a7),a0 * a0 -> Environment buffer
move.w 8(a7),d0 * Load return value
ext.l d0 * just in case ...
movea.l (a0)+,a7 * Reset stack
movea.l (a0)+,a6 * Reset frame
move.l (a0)+,(a7) * Load TOS with return addr
movem.l (a0),d2-d7/a2-a5 * Restore register variables
rts * and return