aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2003-02-18 22:41:16 +0000
committerJeff Johnston <jjohnstn@redhat.com>2003-02-18 22:41:16 +0000
commit1e810ba04dbc5867fa3137ce42b75d1c5c4f47be (patch)
tree773d2c9fdebaf8b02ac1cc89a9d580fdaf862cfe /newlib
parentb1ca765e841a6347450cea6738e5b40a692a2aba (diff)
downloadnewlib-1e810ba04dbc5867fa3137ce42b75d1c5c4f47be.zip
newlib-1e810ba04dbc5867fa3137ce42b75d1c5c4f47be.tar.gz
newlib-1e810ba04dbc5867fa3137ce42b75d1c5c4f47be.tar.bz2
2003-02-18 Christian Groessler <chris@groessler.org>
* libc/machine/z8k/setjmp.S (_setjmp / _longjmp): Fix to support z8001 segmented mode.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog5
-rw-r--r--newlib/libc/machine/z8k/setjmp.S45
2 files changed, 44 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 0d2a38c..e9018f7 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-18 Christian Groessler <chris@groessler.org>
+
+ * libc/machine/z8k/setjmp.S (_setjmp / _longjmp): Fix to
+ support z8001 segmented mode.
+
2003-02-18 Earnie Boyd <earnie@users.sf.net>
* libc/stdlib/mallocr.c (unlink): Don't assign a value to a pointer
diff --git a/newlib/libc/machine/z8k/setjmp.S b/newlib/libc/machine/z8k/setjmp.S
index 6a76641..e58d0d1 100644
--- a/newlib/libc/machine/z8k/setjmp.S
+++ b/newlib/libc/machine/z8k/setjmp.S
@@ -3,27 +3,62 @@
segm
.global _setjmp
+ .globl _longjmp
+
+#ifdef __STD_CALL__
+
+_setjmp:
+ ldl rr6,rr14(#4) ! get argument
+ ldl rr2,@rr14 ! fetch pc
+ ldl @rr6,rr2 ! save it
+ ldl rr6(#16),rr8
+ ldl rr6(#4),rr10
+ ldl rr6(#8),rr12 ! remember frame pointer
+ ldl rr6(#12),rr14 ! remember stack pointer
+ ldk r7,#0
+ ret t
+
+_longjmp:
+ ldl rr4,rr14(#4) ! get first argument
+ ld r7,rr14(#8) ! get return value
+ ldl rr8,rr4(#16)
+ ldl rr10,rr4(#4)
+ ldl rr12,rr4(#8) ! restore old frame pointer
+ ldl rr14,rr4(#12) ! restore old stack pointer
+ ldl rr4,@rr4 ! return address
+ inc r15,#4
+ jp @rr4
+
+#else /* above __STD_CALL_, below not */
+
_setjmp:
ldl rr2,@rr14 ! fetch pc
ldl @rr6,rr2 ! save it
+ ldl rr6(16),rr8
ldl rr6(4),rr10
ldl rr6(8),rr12 ! and the other special regs
ldl rr6(12),rr14
ldk r2,#0
ret t
-
- .globl _longjmp
_longjmp:
ld r2,r5 ! get return value
ldl rr4,rr6(0)
+ ldl rr8,rr6(16)
ldl rr10,rr6(4)
ldl rr12,rr6(8)
ldl rr14,rr6(12)
+ inc r15,#4
jp @rr4
-#else
+
+#endif /* not __STD_CALL__ */
+#else /* above Z8001, below Z8002 */
unseg
+#ifdef __STD_CALL__
+#warning Z8002 std call not implemented!
+#endif
+
.global _setjmp
_setjmp:
ld r2,@r15 ! fetch pc
@@ -44,6 +79,4 @@ _longjmp:
ldl rr14,rr7(12)
jp @rr4
-#endif
-
-
+#endif /* Z8002 version */