fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / machine / z8k / setjmp.S
blobe58d0d1f498553ae71893c77ca7c5de51ec04952
2 #ifdef __Z8001__
3         segm
5         .global _setjmp
6         .globl  _longjmp
8 #ifdef __STD_CALL__
10 _setjmp:
11         ldl     rr6,rr14(#4)    ! get argument
12         ldl     rr2,@rr14       ! fetch pc
13         ldl     @rr6,rr2        ! save it
14         ldl     rr6(#16),rr8
15         ldl     rr6(#4),rr10
16         ldl     rr6(#8),rr12    ! remember frame pointer
17         ldl     rr6(#12),rr14   ! remember stack pointer
18         ldk     r7,#0
19         ret     t
21 _longjmp:
22         ldl     rr4,rr14(#4)    ! get first argument
23         ld      r7,rr14(#8)     ! get return value
24         ldl     rr8,rr4(#16)
25         ldl     rr10,rr4(#4)
26         ldl     rr12,rr4(#8)    ! restore old frame pointer
27         ldl     rr14,rr4(#12)   ! restore old stack pointer
28         ldl     rr4,@rr4        ! return address
29         inc     r15,#4
30         jp      @rr4
32 #else /* above __STD_CALL_, below not */
34 _setjmp:
35         ldl     rr2,@rr14       ! fetch pc
36         ldl     @rr6,rr2        ! save it
37         ldl     rr6(16),rr8
38         ldl     rr6(4),rr10
39         ldl     rr6(8),rr12     ! and the other special regs
40         ldl     rr6(12),rr14
41         ldk     r2,#0
42         ret     t
44 _longjmp:
45         ld      r2,r5           ! get return value
46         ldl     rr4,rr6(0)
47         ldl     rr8,rr6(16)
48         ldl     rr10,rr6(4)
49         ldl     rr12,rr6(8)
50         ldl     rr14,rr6(12)
51         inc     r15,#4
52         jp      @rr4
54 #endif  /* not __STD_CALL__ */
55 #else /* above Z8001, below Z8002 */
56         unseg
58 #ifdef __STD_CALL__
59 #warning Z8002 std call not implemented!
60 #endif
62         .global _setjmp
63 _setjmp:
64         ld      r2,@r15 ! fetch pc
65         ld      @r7,r2  ! save it
66         ldl     r7(4),rr10
67         ldl     r7(8),rr12      ! and the other special regs
68         ldl     r7(12),rr14
69         ldk     r2,#0
70         ret     t
71         
72         .globl  _longjmp
74 _longjmp:
75         ld      r2,r6           ! get return value
76         ld      r4,@r7
77         ldl     rr10,rr7(4)
78         ldl     rr12,rr7(8)
79         ldl     rr14,rr7(12)
80         jp      @rr4
81         
82 #endif  /* Z8002 version */