68000: add setjmp
authorAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:07:15 +0000 (00:07 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:07:15 +0000 (00:07 +0000)
Library/libs/setjmp_68000.S [new file with mode: 0644]

diff --git a/Library/libs/setjmp_68000.S b/Library/libs/setjmp_68000.S
new file mode 100644 (file)
index 0000000..4c45a89
--- /dev/null
@@ -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