From 05354b492a1f941ce19a0e2d00d711f9d55b8b63 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 13 Nov 2016 00:07:15 +0000 Subject: [PATCH] 68000: add setjmp --- Library/libs/setjmp_68000.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Library/libs/setjmp_68000.S diff --git a/Library/libs/setjmp_68000.S b/Library/libs/setjmp_68000.S new file mode 100644 index 00000000..4c45a89a --- /dev/null +++ b/Library/libs/setjmp_68000.S @@ -0,0 +1,24 @@ +/* setjmp for 68000 and gcc. + + The called function is expected to save registers it damages so we need + to do a full save here expect for a0/a1 d0/d1 which are scratch */ + + .text + .globl setjmp + .globl longjmp +.mri 1 + +setjmp: + tst.l d0 + bne _setok + addq #1,d0 ; never return 0 on longjmp +_setok: move.l 4(sp),a0 + add #48,a0 + movem.l d2-d7/a2-a7,-(a0) ; 12 * 4 = 48 bytes + moveq #0,d0 ; return 0 from setjmp + rts + +longjmp: + move.l 4(sp),a0 + movem.l (a0)+,d2-d7/a2-a7 + rts -- 2.34.1