Changeset 408 for trunk/hal/tsar_mips32/core/hal_switch.S
- Timestamp:
- Dec 5, 2017, 4:20:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_switch.S
r407 r408 37 37 hal_do_cpu_switch: 38 38 39 /* save old thread context */ 40 39 41 move $26, $4 /* $26 <= ctx_old */ 40 42 … … 49 51 sw $6, 6*4($26) 50 52 sw $7, 7*4($26) 51 52 53 sw $8, 8*4($26) 53 54 sw $9, 9*4($26) … … 58 59 sw $14, 14*4($26) 59 60 sw $15, 15*4($26) 60 61 61 sw $16, 16*4($26) 62 62 sw $17, 17*4($26) … … 67 67 sw $22, 22*4($26) 68 68 sw $23, 23*4($26) 69 70 69 sw $24, 24*4($26) 71 70 sw $25, 25*4($26) … … 91 90 sw $27, 33*4($26) /* save c2_mode to slot 33 */ 92 91 93 sync94 92 /* restore new thread context */ 93 95 94 move $26, $5 /* $26 <= ctx_new */ 96 95 … … 105 104 lw $6, 6*4($26) 106 105 lw $7, 7*4($26) 107 108 106 lw $8, 8*4($26) 109 107 lw $9, 9*4($26) … … 114 112 lw $14, 14*4($26) 115 113 lw $15, 15*4($26) 116 117 114 lw $16, 16*4($26) 118 115 lw $17, 17*4($26) … … 123 120 lw $22, 22*4($26) 124 121 lw $23, 23*4($26) 125 126 122 lw $24, 24*4($26) 127 123 lw $25, 25*4($26) … … 149 145 mtc0 $26, $12 /* restore c0_sr from slot 34 */ 150 146 147 sync 148 151 149 jr $31 /* return to caller */ 152 150 nop 153 151 154 152 #--------------------------------------------------------------------------------- 155 # The hal_do_cpu_save()function makes the following assumption s:153 # The hal_do_cpu_save()function makes the following assumption: 156 154 # - register $4 contains a pointer on the target thread context. 157 # - register $5 contains the target thread descriptor pointer.158 # - register $6 contains the offset to add to stack pointer.159 155 #--------------------------------------------------------------------------------- 160 156 hal_do_cpu_save: 161 157 162 move $26, $4 /* $26 <= context */ 163 164 move $27, $5 165 sw $27, 35*4($26) /* save child thread to slot 35 */ 166 167 add $27, $6, $29 168 sw $27, 29*4($26) /* save (sp_29 + offset) to slot 29 */ 169 170 mfc0 $27, $12 171 sw $27, 34*4($26) /* save c0_sr to slot 34 */ 172 173 mfc2 $27, $0 174 sw $27, 32*4($26) /* save c2_ptpr to slot 32 */ 175 176 mfc2 $27, $1 177 sw $27, 33*4($26) /* save c2_mode to slot 33 */ 178 179 mfc0 $27, $14 158 move $26, $4 /* $26 <= &context */ 159 160 mfc0 $27, $14 180 161 sw $27, 0*4($26) /* save c0_epc to slot 0 */ 181 162 182 163 sw $1, 1*4($26) 183 164 sw $2, 2*4($26) … … 187 168 sw $6, 6*4($26) 188 169 sw $7, 7*4($26) 189 190 170 sw $8, 8*4($26) 191 171 sw $9, 9*4($26) … … 196 176 sw $14, 14*4($26) 197 177 sw $15, 15*4($26) 198 199 178 sw $16, 16*4($26) 200 179 sw $17, 17*4($26) … … 205 184 sw $22, 22*4($26) 206 185 sw $23, 23*4($26) 207 208 186 sw $24, 24*4($26) 209 sw $25, 25*4($26) 210 187 sw $25, 25*4($26) 188 211 189 mfhi $27 212 sw $27, 26*4($26) /* save hi to slot 26 */ 213 190 sw $27, 26*4($26) /* save hi to slot 26 */ 214 191 mflo $27 215 sw $27, 27*4($26) /* save lo to slot 27 */ 216 217 sw $28, 28*4($26) /* save gp to slot 28 */ 218 219 sw $30, 30*4($26) /* save s8 to slot 30 */ 220 sw $31, 31*4($26) /* save ra to slot 31 */ 192 sw $27, 27*4($26) /* save lo to slot 27 */ 193 194 sw $28, 28*4($26) /* save gp to slot 28 */ 195 sw $29, 29*4($26) /* save sp to slot 29 */ 196 sw $30, 30*4($26) /* save s8 to slot 30 */ 197 sw $31, 31*4($26) /* save ra to slot 31 */ 198 199 mfc2 $27, $0 200 sw $27, 32*4($26) /* save c2_ptpr to slot 32 */ 201 mfc2 $27, $1 202 sw $27, 33*4($26) /* save c2_mode to slot 33 */ 203 mfc0 $27, $12 204 sw $27, 34*4($26) /* save c0_sr to slot 34 */ 205 mfc0 $27, $4, 2 206 sw $27, 35*4($26) /* save c0_th to slot 35 */ 221 207 222 208 sync
Note: See TracChangeset
for help on using the changeset viewer.