Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/SETJMP.S
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

32 lines
1.1 KiB
ArmAsm
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*
* 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
 move.l (a0)+,(a7) * Load TOS with return addr
mvem.l (a0),d2-d7/a2-a5 * Restore register variables
rts * and return
 move.l (a0)+,(a7) * Load TOS with return addr
mvem.l (a0),d2-d7/a2-a5 * Restore register variables
rts * and return
 move.l (a0)+,(a7) * Load TOS with return addr
m