Thomas Martitz | 46454ac | 2010-08-24 12:38:42 +0000 | [diff] [blame] | 1 | #include "config.h" |
| 2 | #ifdef ROCKBOX_LITTLE_ENDIAN |
| 3 | #define __LITTLE_ENDIAN__ |
| 4 | #endif |
| 5 | |
| 6 | /* SH7034, the only supported sh target supported by Rockbox is sh1 */ |
| 7 | #define __SH5__ 0 |
| 8 | #define __SHMEDIA__ 0 |
| 9 | |
| 10 | /* below is unmodified setjmp.S revision 1.3 from newlib cvs */ |
| 11 | #if __SHMEDIA__ |
| 12 | .mode SHmedia |
| 13 | #endif |
| 14 | |
| 15 | #include "asm.h" |
| 16 | |
| 17 | ENTRY(setjmp) |
| 18 | #if __SH5__ |
| 19 | ptabs r18, tr0 |
| 20 | gettr tr5, r5 |
| 21 | gettr tr6, r6 |
| 22 | gettr tr7, r7 |
| 23 | st.q r2, 0*8, r18 |
| 24 | st.q r2, 1*8, r10 |
| 25 | st.q r2, 2*8, r11 |
| 26 | st.q r2, 3*8, r12 |
| 27 | st.q r2, 4*8, r13 |
| 28 | st.q r2, 5*8, r14 |
| 29 | st.q r2, 6*8, r15 |
| 30 | st.q r2, 7*8, r28 |
| 31 | st.q r2, 8*8, r29 |
| 32 | st.q r2, 9*8, r30 |
| 33 | st.q r2, 10*8, r31 |
| 34 | st.q r2, 11*8, r32 |
| 35 | st.q r2, 12*8, r33 |
| 36 | st.q r2, 13*8, r34 |
| 37 | st.q r2, 14*8, r35 |
| 38 | st.q r2, 15*8, r44 |
| 39 | st.q r2, 16*8, r45 |
| 40 | st.q r2, 17*8, r46 |
| 41 | st.q r2, 18*8, r47 |
| 42 | st.q r2, 19*8, r48 |
| 43 | st.q r2, 20*8, r49 |
| 44 | st.q r2, 21*8, r50 |
| 45 | st.q r2, 22*8, r51 |
| 46 | st.q r2, 23*8, r52 |
| 47 | st.q r2, 24*8, r53 |
| 48 | st.q r2, 25*8, r54 |
| 49 | st.q r2, 26*8, r55 |
| 50 | st.q r2, 27*8, r56 |
| 51 | st.q r2, 28*8, r57 |
| 52 | st.q r2, 29*8, r58 |
| 53 | st.q r2, 30*8, r59 |
| 54 | st.q r2, 31*8, r5 |
| 55 | st.q r2, 32*8, r6 |
| 56 | st.q r2, 33*8, r7 |
| 57 | #if ! __SH4_NOFPU__ |
| 58 | fst.d r2, 34*8, dr12 |
| 59 | fst.d r2, 35*8, dr14 |
| 60 | fst.d r2, 36*8, dr36 |
| 61 | fst.d r2, 37*8, dr38 |
| 62 | fst.d r2, 38*8, dr40 |
| 63 | fst.d r2, 39*8, dr42 |
| 64 | fst.d r2, 40*8, dr44 |
| 65 | fst.d r2, 41*8, dr46 |
| 66 | fst.d r2, 42*8, dr48 |
| 67 | fst.d r2, 43*8, dr50 |
| 68 | fst.d r2, 44*8, dr52 |
| 69 | fst.d r2, 45*8, dr54 |
| 70 | fst.d r2, 46*8, dr56 |
| 71 | fst.d r2, 47*8, dr58 |
| 72 | fst.d r2, 48*8, dr60 |
| 73 | fst.d r2, 49*8, dr62 |
| 74 | #endif |
| 75 | movi 0, r2 |
| 76 | blink tr0, r63 |
| 77 | #else |
| 78 | #if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) |
| 79 | add #(13*4),r4 |
| 80 | #else |
| 81 | add #(9*4),r4 |
| 82 | #endif |
| 83 | |
| 84 | sts.l pr,@-r4 |
| 85 | |
| 86 | #if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) |
| 87 | fmov.s fr15,@-r4 ! call saved floating point registers |
| 88 | fmov.s fr14,@-r4 |
| 89 | fmov.s fr13,@-r4 |
| 90 | fmov.s fr12,@-r4 |
| 91 | #endif |
| 92 | |
| 93 | mov.l r15,@-r4 ! call saved integer registers |
| 94 | mov.l r14,@-r4 |
| 95 | mov.l r13,@-r4 |
| 96 | mov.l r12,@-r4 |
| 97 | |
| 98 | mov.l r11,@-r4 |
| 99 | mov.l r10,@-r4 |
| 100 | mov.l r9,@-r4 |
| 101 | mov.l r8,@-r4 |
| 102 | |
| 103 | rts |
| 104 | mov #0,r0 |
| 105 | #endif /* __SH5__ */ |
| 106 | |
| 107 | ENTRY(longjmp) |
| 108 | #if __SH5__ |
| 109 | ld.q r2, 0*8, r18 |
| 110 | ptabs r18, tr0 |
| 111 | ld.q r2, 1*8, r10 |
| 112 | ld.q r2, 2*8, r11 |
| 113 | ld.q r2, 3*8, r12 |
| 114 | ld.q r2, 4*8, r13 |
| 115 | ld.q r2, 5*8, r14 |
| 116 | ld.q r2, 6*8, r15 |
| 117 | ld.q r2, 7*8, r28 |
| 118 | ld.q r2, 8*8, r29 |
| 119 | ld.q r2, 9*8, r30 |
| 120 | ld.q r2, 10*8, r31 |
| 121 | ld.q r2, 11*8, r32 |
| 122 | ld.q r2, 12*8, r33 |
| 123 | ld.q r2, 13*8, r34 |
| 124 | ld.q r2, 14*8, r35 |
| 125 | ld.q r2, 15*8, r44 |
| 126 | ld.q r2, 16*8, r45 |
| 127 | ld.q r2, 17*8, r46 |
| 128 | ld.q r2, 18*8, r47 |
| 129 | ld.q r2, 19*8, r48 |
| 130 | ld.q r2, 20*8, r49 |
| 131 | ld.q r2, 21*8, r50 |
| 132 | ld.q r2, 22*8, r51 |
| 133 | ld.q r2, 23*8, r52 |
| 134 | ld.q r2, 24*8, r53 |
| 135 | ld.q r2, 25*8, r54 |
| 136 | ld.q r2, 26*8, r55 |
| 137 | ld.q r2, 27*8, r56 |
| 138 | ld.q r2, 28*8, r57 |
| 139 | ld.q r2, 29*8, r58 |
| 140 | ld.q r2, 30*8, r59 |
| 141 | ld.q r2, 31*8, r5 |
| 142 | ld.q r2, 32*8, r6 |
| 143 | ld.q r2, 33*8, r7 |
| 144 | ptabs r5, tr5 |
| 145 | ptabs r6, tr6 |
| 146 | ptabs r7, tr7 |
| 147 | #if ! __SH4_NOFPU__ |
| 148 | fld.d r2, 34*8, dr12 |
| 149 | fld.d r2, 35*8, dr14 |
| 150 | fld.d r2, 36*8, dr36 |
| 151 | fld.d r2, 37*8, dr38 |
| 152 | fld.d r2, 38*8, dr40 |
| 153 | fld.d r2, 39*8, dr42 |
| 154 | fld.d r2, 40*8, dr44 |
| 155 | fld.d r2, 41*8, dr46 |
| 156 | fld.d r2, 42*8, dr48 |
| 157 | fld.d r2, 43*8, dr50 |
| 158 | fld.d r2, 44*8, dr52 |
| 159 | fld.d r2, 45*8, dr54 |
| 160 | fld.d r2, 46*8, dr56 |
| 161 | fld.d r2, 47*8, dr58 |
| 162 | fld.d r2, 48*8, dr60 |
| 163 | fld.d r2, 49*8, dr62 |
| 164 | #endif |
| 165 | movi 1, r2 |
| 166 | cmvne r3, r3, r2 |
| 167 | blink tr0, r63 |
| 168 | #else |
| 169 | mov.l @r4+,r8 |
| 170 | mov.l @r4+,r9 |
| 171 | mov.l @r4+,r10 |
| 172 | mov.l @r4+,r11 |
| 173 | |
| 174 | mov.l @r4+,r12 |
| 175 | mov.l @r4+,r13 |
| 176 | mov.l @r4+,r14 |
| 177 | mov.l @r4+,r15 |
| 178 | |
| 179 | #if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) |
| 180 | fmov.s @r4+,fr12 ! call saved floating point registers |
| 181 | fmov.s @r4+,fr13 |
| 182 | fmov.s @r4+,fr14 |
| 183 | fmov.s @r4+,fr15 |
| 184 | #endif |
| 185 | |
| 186 | lds.l @r4+,pr |
| 187 | |
| 188 | mov r5,r0 |
| 189 | tst r0,r0 |
| 190 | bf retr4 |
| 191 | movt r0 |
| 192 | retr4: rts |
| 193 | nop |
| 194 | #endif /* __SH5__ */ |