1/* 2Copyright (c) 1990 The Regents of the University of California. 3All rights reserved. 4 5Redistribution and use in source and binary forms are permitted 6provided that the above copyright notice and this paragraph are 7duplicated in all such forms and that any documentation, 8and/or other materials related to such 9distribution and use acknowledge that the software was developed 10by the University of California, Berkeley. The name of the 11University may not be used to endorse or promote products derived 12from this software without specific prior written permission. 13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17 .global _setjmp 18 .global _longjmp 19 20#ifdef __Z8001__ 21 segm 22 23#ifdef __STD_CALL__ 24 25_setjmp: 26 ldl rr6,rr14(#4) ! get argument 27 ldl rr2,@rr14 ! fetch pc 28 ldl @rr6,rr2 ! save it 29 ldl rr6(#16),rr8 30 ldl rr6(#4),rr10 31 ldl rr6(#8),rr12 ! remember frame pointer 32 ldl rr6(#12),rr14 ! remember stack pointer 33 ldk r7,#0 34 ret t 35 36_longjmp: 37 ldl rr4,rr14(#4) ! get first argument 38 ld r7,rr14(#8) ! get return value 39 ldl rr8,rr4(#16) 40 ldl rr10,rr4(#4) 41 ldl rr12,rr4(#8) ! restore old frame pointer 42 ldl rr14,rr4(#12) ! restore old stack pointer 43 ldl rr4,@rr4 ! return address 44 inc r15,#4 45 jp @rr4 46 47#else /* above __STD_CALL_, below not */ 48 49_setjmp: 50 ldl rr2,@rr14 ! fetch pc 51 ldl @rr6,rr2 ! save it 52 ldl rr6(16),rr8 53 ldl rr6(4),rr10 54 ldl rr6(8),rr12 ! and the other special regs 55 ldl rr6(12),rr14 56 ldk r2,#0 57 ret t 58 59_longjmp: 60 ld r2,r5 ! get return value 61 ldl rr4,rr6(0) 62 ldl rr8,rr6(16) 63 ldl rr10,rr6(4) 64 ldl rr12,rr6(8) 65 ldl rr14,rr6(12) 66 inc r15,#4 67 jp @rr4 68 69#endif /* not __STD_CALL__ */ 70#else /* above Z8001, below Z8002 */ 71 unseg 72 73#ifdef __STD_CALL__ 74 75_setjmp: 76 ld r7,r15(#2) ! get argument 77 ld r2,@r15 ! fetch pc 78 ld @r7,r2 ! save it 79 ldl r7(#14),rr8 80 ldl r7(#2),rr10 81 ldl r7(#6),rr12 ! remember frame pointer 82 ldl r7(#10),rr14 ! remember stack pointer 83 ldk r7,#0 84 ret t 85 86_longjmp: 87 ld r4,r15(#2) ! get first argument (jmp_buf) 88 ld r7,r15(#4) ! get return value 89 ldl rr8,r4(#14) 90 ldl rr10,r4(#2) 91 ldl rr12,r4(#6) ! restore old frame pointer 92 ldl rr14,r4(#10) ! restore old stack pointer 93 ld r4,@r4 ! return address 94 inc r15,#2 95 jp @r4 96 97#else /* above __STD_CALL_, below not */ 98 99_setjmp: 100 ld r2,@r15 ! fetch pc 101 ld @r7,r2 ! save it 102 ldl r7(4),rr10 103 ldl r7(8),rr12 ! and the other special regs 104 ldl r7(12),rr14 105 ldk r2,#0 106 ret t 107 108_longjmp: 109 ld r2,r6 ! get return value 110 ld r4,@r7 111 ldl rr10,r7(4) 112 ldl rr12,r7(8) 113 ldl rr14,r7(12) 114 inc r15,#2 115 jp @r4 116 117#endif /* not __STD_CALL__ */ 118#endif /* Z8002 version */ 119