| 1 | # C library -- reset, setexit |
| 2 | |
| 3 | # reset(x) |
| 4 | # will generate a "return" from |
| 5 | # the last call to |
| 6 | # setexit() |
| 7 | # by restoring r6 - r12, ap, fp |
| 8 | # and doing a return. |
| 9 | # The returned value is x; on the original |
| 10 | # call the returned value is 0. |
| 11 | # |
| 12 | # useful for going back to the main loop |
| 13 | # after a horrible error in a lowlevel |
| 14 | # routine. |
| 15 | |
| 16 | .globl _setexit |
| 17 | .globl _getexit |
| 18 | .globl _reset |
| 19 | .globl _resexit |
| 20 | .globl _setsav |
| 21 | .globl _svkludg |
| 22 | |
| 23 | _setexit: |
| 24 | .word 0x0000 |
| 25 | movab _setsav,r0 |
| 26 | movq r6,(r0)+ |
| 27 | movq r8,(r0)+ |
| 28 | movq r10,(r0)+ |
| 29 | movq 8(fp),(r0)+ # ap, fp |
| 30 | movab 4(ap),(r0)+ # sp |
| 31 | movl 16(fp),(r0) # pc |
| 32 | clrl r0 |
| 33 | ret |
| 34 | |
| 35 | _reset: |
| 36 | .word 0x0000 |
| 37 | movl 4(ap),r0 # returned value |
| 38 | movab _setsav,r1 |
| 39 | movq (r1)+,r6 |
| 40 | movq (r1)+,r8 |
| 41 | movq (r1)+,r10 |
| 42 | movq (r1)+,r12 |
| 43 | movl (r1)+,sp |
| 44 | jmp *(r1) |
| 45 | |
| 46 | _resexit: |
| 47 | .word 0x0000 |
| 48 | movc3 $40,*4(ap),_setsav |
| 49 | ret |
| 50 | _svkludg: |
| 51 | movl (sp)+,out |
| 52 | movq r0,myregs |
| 53 | movq r2,myregs+8 |
| 54 | movq r4,myregs+16 |
| 55 | subl2 $40,sp |
| 56 | movc3 $40,_setsav,(sp) |
| 57 | movq myregs,r0 |
| 58 | movq myregs+8,r2 |
| 59 | movq myregs+16,r4 |
| 60 | jmp *out |
| 61 | |
| 62 | _getexit: |
| 63 | .word 0x0000 |
| 64 | movc3 $40,_setsav,*4(ap) |
| 65 | ret |
| 66 | |
| 67 | |
| 68 | .data |
| 69 | _setsav:.space 10*4 |
| 70 | out: .space 4 |
| 71 | myregs: .space 6*4 |
| 72 | |