Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
2.1 KB
|
Rev | Line | |
---|
[444] | 1 | /* setjmp/longjmp routines for M68HC11 & M68HC12. |
---|
| 2 | * Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr) |
---|
| 3 | * |
---|
| 4 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 5 | * and license this software and its documentation for any purpose, provided |
---|
| 6 | * that existing copyright notices are retained in all copies and that this |
---|
| 7 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 8 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 9 | * Modifications to this software may be copyrighted by their authors |
---|
| 10 | * and need not follow the licensing terms described here, provided that |
---|
| 11 | * the new terms are clearly indicated on the first page of each file where |
---|
| 12 | * they apply. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #if __INT__ == 32 |
---|
| 16 | # define val 4 |
---|
| 17 | # define INT32(X) X |
---|
| 18 | #else |
---|
| 19 | # define val 2 |
---|
| 20 | # define INT32(X) |
---|
| 21 | #endif |
---|
| 22 | |
---|
| 23 | #ifdef mc6811 |
---|
| 24 | # define REG(X) *X |
---|
| 25 | #else |
---|
| 26 | # define REG(X) X |
---|
| 27 | #endif |
---|
| 28 | |
---|
| 29 | .sect .text |
---|
| 30 | .global setjmp |
---|
| 31 | .global longjmp |
---|
| 32 | |
---|
| 33 | #ifdef mc6811 |
---|
| 34 | setjmp: |
---|
| 35 | xgdx |
---|
| 36 | tsy |
---|
| 37 | ldd 0,y |
---|
| 38 | std 0,x |
---|
| 39 | sty 2,x |
---|
| 40 | ldd REG(_.frame) |
---|
| 41 | std 4,x |
---|
| 42 | ldd REG(_.d1) |
---|
| 43 | std 6,x |
---|
| 44 | ldd REG(_.d2) |
---|
| 45 | std 8,x |
---|
| 46 | ldd REG(_.d3) |
---|
| 47 | std 10,x |
---|
| 48 | ldd REG(_.d4) |
---|
| 49 | std 12,x |
---|
| 50 | ldd REG(_.d5) |
---|
| 51 | std 14,x |
---|
| 52 | ldd REG(_.d6) |
---|
| 53 | std 16,x |
---|
| 54 | ldd REG(_.d7) |
---|
| 55 | std 18,x |
---|
| 56 | ldd REG(_.d8) |
---|
| 57 | std 20,x |
---|
| 58 | INT32( ldx #0) |
---|
| 59 | clra |
---|
| 60 | clrb |
---|
| 61 | rts |
---|
| 62 | #else |
---|
| 63 | setjmp: |
---|
| 64 | xgdx |
---|
| 65 | movw 0,sp,2,x+ |
---|
| 66 | sts 2,x+ |
---|
| 67 | movw _.frame,2,x+ |
---|
| 68 | movw _.d1,2,x+ |
---|
| 69 | movw _.d2,2,x+ |
---|
| 70 | movw _.d3,2,x+ |
---|
| 71 | movw _.d4,2,x+ |
---|
| 72 | movw _.d5,2,x+ |
---|
| 73 | movw _.d6,2,x+ |
---|
| 74 | movw _.d7,2,x+ |
---|
| 75 | movw _.d8,2,x+ |
---|
| 76 | INT32( ldx #0) |
---|
| 77 | clra |
---|
| 78 | clrb |
---|
| 79 | rts |
---|
| 80 | #endif |
---|
| 81 | |
---|
| 82 | #ifdef mc6811 |
---|
| 83 | longjmp: |
---|
| 84 | xgdx |
---|
| 85 | tsy |
---|
| 86 | ldd val,y |
---|
| 87 | bne do_jump |
---|
| 88 | ldd #1 |
---|
| 89 | do_jump: |
---|
| 90 | xgdy |
---|
| 91 | ldd 4,x |
---|
| 92 | std REG(_.frame) |
---|
| 93 | ldd 6,x |
---|
| 94 | std REG(_.d1) |
---|
| 95 | ldd 8,x |
---|
| 96 | std REG(_.d2) |
---|
| 97 | ldd 10,x |
---|
| 98 | std REG(_.d3) |
---|
| 99 | ldd 12,x |
---|
| 100 | std REG(_.d4) |
---|
| 101 | ldd 14,x |
---|
| 102 | std REG(_.d5) |
---|
| 103 | ldd 16,x |
---|
| 104 | std REG(_.d6) |
---|
| 105 | ldd 18,x |
---|
| 106 | std REG(_.d7) |
---|
| 107 | ldd 20,x |
---|
| 108 | std REG(_.d8) |
---|
| 109 | ldd 0,x |
---|
| 110 | ldx 2,x |
---|
| 111 | txs |
---|
| 112 | std 0,x |
---|
| 113 | INT32( ldx #0) |
---|
| 114 | xgdy |
---|
| 115 | rts |
---|
| 116 | #else |
---|
| 117 | |
---|
| 118 | longjmp: |
---|
| 119 | xgdx |
---|
| 120 | ldy val,sp |
---|
| 121 | bne do_jump |
---|
| 122 | ldy #1 |
---|
| 123 | do_jump: |
---|
| 124 | ldd 4,x+ |
---|
| 125 | movw 2,x+,_.frame |
---|
| 126 | movw 0,x,_.d1 |
---|
| 127 | movw 2,x,_.d2 |
---|
| 128 | movw 4,x,_.d3 |
---|
| 129 | movw 6,x,_.d4 |
---|
| 130 | movw 8,x,_.d5 |
---|
| 131 | movw 10,x,_.d6 |
---|
| 132 | movw 12,x,_.d7 |
---|
| 133 | movw 14,x,_.d8 |
---|
| 134 | ldx -4,x |
---|
| 135 | txs |
---|
| 136 | std 0,x |
---|
| 137 | INT32( ldx #0) |
---|
| 138 | xgdy |
---|
| 139 | rts |
---|
| 140 | #endif |
---|
| 141 | |
---|
Note: See
TracBrowser
for help on using the repository browser.