[a5d1331] | 1 | #
|
---|
[df4ed85] | 2 | # Copyright (c) 2003-2004 Jakub Jermar
|
---|
[f761f1eb] | 3 | # All rights reserved.
|
---|
| 4 | #
|
---|
| 5 | # Redistribution and use in source and binary forms, with or without
|
---|
| 6 | # modification, are permitted provided that the following conditions
|
---|
| 7 | # are met:
|
---|
| 8 | #
|
---|
| 9 | # - Redistributions of source code must retain the above copyright
|
---|
| 10 | # notice, this list of conditions and the following disclaimer.
|
---|
| 11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | # documentation and/or other materials provided with the distribution.
|
---|
| 14 | # - The name of the author may not be used to endorse or promote products
|
---|
| 15 | # derived from this software without specific prior written permission.
|
---|
| 16 | #
|
---|
| 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | #
|
---|
| 28 |
|
---|
[e84439a] | 29 | #include <arch/asm/regname.h>
|
---|
| 30 | #include <arch/mm/page.h>
|
---|
| 31 | #include <arch/asm/boot.h>
|
---|
[909c6e3] | 32 | #include <arch/context_offset.h>
|
---|
[9c2fb97] | 33 | #include <arch/stack.h>
|
---|
[96e0748d] | 34 |
|
---|
[f761f1eb] | 35 | .text
|
---|
| 36 |
|
---|
| 37 | .set noat
|
---|
| 38 | .set noreorder
|
---|
| 39 | .set nomacro
|
---|
| 40 |
|
---|
| 41 | .global kernel_image_start
|
---|
| 42 | .global tlb_refill_entry
|
---|
| 43 | .global cache_error_entry
|
---|
| 44 | .global exception_entry
|
---|
[2bd4fdf] | 45 | .global userspace_asm
|
---|
[f761f1eb] | 46 |
|
---|
[0cb47cf] | 47 | /*
|
---|
[ce890ec9] | 48 | * Which status bits are thread-local:
|
---|
[0cb47cf] | 49 | * KSU(UM), EXL, ERL, IE
|
---|
| 50 | */
|
---|
| 51 | #define REG_SAVE_MASK 0x1f
|
---|
[d92bf462] | 52 |
|
---|
[7b213f2] | 53 | #define ISTATE_OFFSET_A0 0
|
---|
| 54 | #define ISTATE_OFFSET_A1 4
|
---|
| 55 | #define ISTATE_OFFSET_A2 8
|
---|
| 56 | #define ISTATE_OFFSET_A3 12
|
---|
| 57 | #define ISTATE_OFFSET_T0 16
|
---|
| 58 | #define ISTATE_OFFSET_T1 20
|
---|
| 59 | #define ISTATE_OFFSET_V0 24
|
---|
| 60 | #define ISTATE_OFFSET_V1 28
|
---|
| 61 | #define ISTATE_OFFSET_AT 32
|
---|
| 62 | #define ISTATE_OFFSET_T2 36
|
---|
| 63 | #define ISTATE_OFFSET_T3 40
|
---|
| 64 | #define ISTATE_OFFSET_T4 44
|
---|
| 65 | #define ISTATE_OFFSET_T5 48
|
---|
| 66 | #define ISTATE_OFFSET_T6 52
|
---|
| 67 | #define ISTATE_OFFSET_T7 56
|
---|
| 68 | #define ISTATE_OFFSET_S0 60
|
---|
| 69 | #define ISTATE_OFFSET_S1 64
|
---|
| 70 | #define ISTATE_OFFSET_S2 68
|
---|
| 71 | #define ISTATE_OFFSET_S3 72
|
---|
| 72 | #define ISTATE_OFFSET_S4 76
|
---|
| 73 | #define ISTATE_OFFSET_S5 80
|
---|
| 74 | #define ISTATE_OFFSET_S6 84
|
---|
| 75 | #define ISTATE_OFFSET_S7 88
|
---|
| 76 | #define ISTATE_OFFSET_T8 92
|
---|
| 77 | #define ISTATE_OFFSET_T9 96
|
---|
| 78 | #define ISTATE_OFFSET_KT0 100
|
---|
| 79 | #define ISTATE_OFFSET_KT1 104
|
---|
| 80 | #define ISTATE_OFFSET_GP 108
|
---|
| 81 | #define ISTATE_OFFSET_SP 112
|
---|
| 82 | #define ISTATE_OFFSET_S8 116
|
---|
| 83 | #define ISTATE_OFFSET_RA 120
|
---|
| 84 | #define ISTATE_OFFSET_LO 124
|
---|
| 85 | #define ISTATE_OFFSET_HI 128
|
---|
| 86 | #define ISTATE_OFFSET_STATUS 132
|
---|
| 87 | #define ISTATE_OFFSET_EPC 136
|
---|
| 88 | #define ISTATE_OFFSET_ALIGNMENT 140
|
---|
| 89 |
|
---|
| 90 | #define ISTATE_SOFT_SIZE 144
|
---|
| 91 |
|
---|
[0c39b96] | 92 | /*
|
---|
| 93 | * The fake ABI prologue is never executed and may not be part of the
|
---|
| 94 | * procedure's body. Instead, it should be immediately preceding the procedure's
|
---|
| 95 | * body. Its only purpose is to trick the stack trace walker into thinking that
|
---|
| 96 | * the exception is more or less just a normal function call.
|
---|
| 97 | */
|
---|
| 98 | .macro FAKE_ABI_PROLOGUE
|
---|
| 99 | sub $sp, ISTATE_SOFT_SIZE
|
---|
| 100 | sw $ra, ISTATE_OFFSET_EPC($sp)
|
---|
| 101 | .endm
|
---|
| 102 |
|
---|
[0cb47cf] | 103 | /*
|
---|
| 104 | * Save registers to space defined by \r
|
---|
| 105 | * We will change status: Disable ERL, EXL, UM, IE
|
---|
| 106 | * These changes will be automatically reversed in REGISTER_LOAD
|
---|
| 107 | * %sp is NOT saved as part of these registers
|
---|
| 108 | */
|
---|
[1b109cb] | 109 | .macro REGISTERS_STORE_AND_EXC_RESET r
|
---|
[ce890ec9] | 110 | sw $at, ISTATE_OFFSET_AT(\r)
|
---|
| 111 | sw $v0, ISTATE_OFFSET_V0(\r)
|
---|
| 112 | sw $v1, ISTATE_OFFSET_V1(\r)
|
---|
| 113 | sw $a0, ISTATE_OFFSET_A0(\r)
|
---|
| 114 | sw $a1, ISTATE_OFFSET_A1(\r)
|
---|
| 115 | sw $a2, ISTATE_OFFSET_A2(\r)
|
---|
| 116 | sw $a3, ISTATE_OFFSET_A3(\r)
|
---|
| 117 | sw $t0, ISTATE_OFFSET_T0(\r)
|
---|
| 118 | sw $t1, ISTATE_OFFSET_T1(\r)
|
---|
| 119 | sw $t2, ISTATE_OFFSET_T2(\r)
|
---|
| 120 | sw $t3, ISTATE_OFFSET_T3(\r)
|
---|
| 121 | sw $t4, ISTATE_OFFSET_T4(\r)
|
---|
| 122 | sw $t5, ISTATE_OFFSET_T5(\r)
|
---|
| 123 | sw $t6, ISTATE_OFFSET_T6(\r)
|
---|
| 124 | sw $t7, ISTATE_OFFSET_T7(\r)
|
---|
| 125 | sw $t8, ISTATE_OFFSET_T8(\r)
|
---|
| 126 | sw $t9, ISTATE_OFFSET_T9(\r)
|
---|
[3fb3c1fc] | 127 | sw $s0, ISTATE_OFFSET_S0(\r)
|
---|
| 128 | sw $s1, ISTATE_OFFSET_S1(\r)
|
---|
| 129 | sw $s2, ISTATE_OFFSET_S2(\r)
|
---|
| 130 | sw $s3, ISTATE_OFFSET_S3(\r)
|
---|
| 131 | sw $s4, ISTATE_OFFSET_S4(\r)
|
---|
| 132 | sw $s5, ISTATE_OFFSET_S5(\r)
|
---|
| 133 | sw $s6, ISTATE_OFFSET_S6(\r)
|
---|
| 134 | sw $s7, ISTATE_OFFSET_S7(\r)
|
---|
| 135 | sw $s8, ISTATE_OFFSET_S8(\r)
|
---|
[d92bf462] | 136 |
|
---|
[2bd4fdf] | 137 | mflo $at
|
---|
[ce890ec9] | 138 | sw $at, ISTATE_OFFSET_LO(\r)
|
---|
[2bd4fdf] | 139 | mfhi $at
|
---|
[ce890ec9] | 140 | sw $at, ISTATE_OFFSET_HI(\r)
|
---|
[2bd4fdf] | 141 |
|
---|
[ce890ec9] | 142 | sw $gp, ISTATE_OFFSET_GP(\r)
|
---|
| 143 | sw $ra, ISTATE_OFFSET_RA(\r)
|
---|
[3fb3c1fc] | 144 | sw $k0, ISTATE_OFFSET_KT0(\r)
|
---|
[ce890ec9] | 145 | sw $k1, ISTATE_OFFSET_KT1(\r)
|
---|
[d92bf462] | 146 |
|
---|
[1b109cb] | 147 | mfc0 $t0, $status
|
---|
| 148 | mfc0 $t1, $epc
|
---|
| 149 |
|
---|
[0cb47cf] | 150 | /* save only KSU, EXL, ERL, IE */
|
---|
[d92bf462] | 151 | and $t2, $t0, REG_SAVE_MASK
|
---|
| 152 |
|
---|
[0cb47cf] | 153 | /* clear KSU, EXL, ERL, IE */
|
---|
[d92bf462] | 154 | li $t3, ~(REG_SAVE_MASK)
|
---|
| 155 | and $t0, $t0, $t3
|
---|
[1b109cb] | 156 |
|
---|
[ce890ec9] | 157 | sw $t2, ISTATE_OFFSET_STATUS(\r)
|
---|
| 158 | sw $t1, ISTATE_OFFSET_EPC(\r)
|
---|
[1b109cb] | 159 | mtc0 $t0, $status
|
---|
[e84439a] | 160 | .endm
|
---|
| 161 |
|
---|
| 162 | .macro REGISTERS_LOAD r
|
---|
[0cb47cf] | 163 | /*
|
---|
| 164 | * Update only UM, EXR, IE from status, the rest
|
---|
| 165 | * is controlled by OS and not bound to task.
|
---|
| 166 | */
|
---|
[1b109cb] | 167 | mfc0 $t0, $status
|
---|
[ce890ec9] | 168 | lw $t1, ISTATE_OFFSET_STATUS(\r)
|
---|
[d92bf462] | 169 |
|
---|
[0cb47cf] | 170 | /* mask UM, EXL, ERL, IE */
|
---|
[d92bf462] | 171 | li $t2, ~REG_SAVE_MASK
|
---|
[1b109cb] | 172 | and $t0, $t0, $t2
|
---|
| 173 |
|
---|
[0cb47cf] | 174 | /* copy UM, EXL, ERL, IE from saved status */
|
---|
[d92bf462] | 175 | or $t0, $t0, $t1
|
---|
[1b109cb] | 176 | mtc0 $t0, $status
|
---|
| 177 |
|
---|
[ce890ec9] | 178 | lw $v0, ISTATE_OFFSET_V0(\r)
|
---|
| 179 | lw $v1, ISTATE_OFFSET_V1(\r)
|
---|
| 180 | lw $a0, ISTATE_OFFSET_A0(\r)
|
---|
| 181 | lw $a1, ISTATE_OFFSET_A1(\r)
|
---|
| 182 | lw $a2, ISTATE_OFFSET_A2(\r)
|
---|
| 183 | lw $a3, ISTATE_OFFSET_A3(\r)
|
---|
| 184 | lw $t0, ISTATE_OFFSET_T0(\r)
|
---|
| 185 | lw $t1, ISTATE_OFFSET_T1(\r)
|
---|
| 186 | lw $t2, ISTATE_OFFSET_T2(\r)
|
---|
| 187 | lw $t3, ISTATE_OFFSET_T3(\r)
|
---|
| 188 | lw $t4, ISTATE_OFFSET_T4(\r)
|
---|
| 189 | lw $t5, ISTATE_OFFSET_T5(\r)
|
---|
| 190 | lw $t6, ISTATE_OFFSET_T6(\r)
|
---|
| 191 | lw $t7, ISTATE_OFFSET_T7(\r)
|
---|
| 192 | lw $t8, ISTATE_OFFSET_T8(\r)
|
---|
| 193 | lw $t9, ISTATE_OFFSET_T9(\r)
|
---|
| 194 |
|
---|
| 195 | lw $gp, ISTATE_OFFSET_GP(\r)
|
---|
| 196 | lw $ra, ISTATE_OFFSET_RA(\r)
|
---|
| 197 | lw $k1, ISTATE_OFFSET_KT1(\r)
|
---|
| 198 |
|
---|
| 199 | lw $at, ISTATE_OFFSET_LO(\r)
|
---|
[2bd4fdf] | 200 | mtlo $at
|
---|
[ce890ec9] | 201 | lw $at, ISTATE_OFFSET_HI(\r)
|
---|
[2bd4fdf] | 202 | mthi $at
|
---|
[d92bf462] | 203 |
|
---|
[ce890ec9] | 204 | lw $at, ISTATE_OFFSET_EPC(\r)
|
---|
[909c6e3] | 205 | mtc0 $at, $epc
|
---|
[2bd4fdf] | 206 |
|
---|
[ce890ec9] | 207 | lw $at, ISTATE_OFFSET_AT(\r)
|
---|
| 208 | lw $sp, ISTATE_OFFSET_SP(\r)
|
---|
[e84439a] | 209 | .endm
|
---|
| 210 |
|
---|
[0cb47cf] | 211 | /*
|
---|
| 212 | * Move kernel stack pointer address to register $k0.
|
---|
| 213 | * If we are in user mode, load the appropriate stack address.
|
---|
| 214 | */
|
---|
[2bd4fdf] | 215 | .macro KERNEL_STACK_TO_K0
|
---|
[0cb47cf] | 216 | /* if we are in user mode */
|
---|
[2bd4fdf] | 217 | mfc0 $k0, $status
|
---|
| 218 | andi $k0, 0x10
|
---|
| 219 |
|
---|
| 220 | beq $k0, $0, 1f
|
---|
[ce890ec9] | 221 | move $k0, $sp
|
---|
[e84439a] | 222 |
|
---|
[0cb47cf] | 223 | /* move $k0 pointer to kernel stack */
|
---|
[2bd4fdf] | 224 | lui $k0, %hi(supervisor_sp)
|
---|
[85ddc05] | 225 | ori $k0, $k0, %lo(supervisor_sp)
|
---|
[d92bf462] | 226 |
|
---|
[0cb47cf] | 227 | /* move $k0 (supervisor_sp) */
|
---|
[ce890ec9] | 228 | lw $k0, ($k0)
|
---|
[d92bf462] | 229 |
|
---|
| 230 | 1:
|
---|
[2bd4fdf] | 231 | .endm
|
---|
[96e0748d] | 232 |
|
---|
[f761f1eb] | 233 | .org 0x0
|
---|
[e84439a] | 234 | kernel_image_start:
|
---|
[0cb47cf] | 235 | /* load temporary stack */
|
---|
[2bd4fdf] | 236 | lui $sp, %hi(end_stack)
|
---|
[85ddc05] | 237 | ori $sp, $sp, %lo(end_stack)
|
---|
[971cf31f] | 238 |
|
---|
[0cb47cf] | 239 | /* not sure about this, but might be needed for PIC code */
|
---|
[e84439a] | 240 | lui $gp, 0x8000
|
---|
| 241 |
|
---|
[0cb47cf] | 242 | /* $a1 contains physical address of bootinfo_t */
|
---|
[12c7f27] | 243 | jal arch_pre_main
|
---|
| 244 | nop
|
---|
| 245 |
|
---|
| 246 | j main_bsp
|
---|
[e84439a] | 247 | nop
|
---|
[2bd4fdf] | 248 |
|
---|
[d92bf462] | 249 | .space TEMP_STACK_SIZE
|
---|
[ffc277e] | 250 | end_stack:
|
---|
| 251 |
|
---|
| 252 | tlb_refill_entry:
|
---|
| 253 | j tlb_refill_handler
|
---|
| 254 | nop
|
---|
| 255 |
|
---|
| 256 | cache_error_entry:
|
---|
| 257 | j cache_error_handler
|
---|
| 258 | nop
|
---|
| 259 |
|
---|
| 260 | exception_entry:
|
---|
| 261 | j exception_handler
|
---|
[96e0748d] | 262 | nop
|
---|
| 263 |
|
---|
[0c39b96] | 264 | FAKE_ABI_PROLOGUE
|
---|
[2bd4fdf] | 265 | exception_handler:
|
---|
| 266 | KERNEL_STACK_TO_K0
|
---|
[d92bf462] | 267 |
|
---|
[7b213f2] | 268 | sub $k0, ISTATE_SOFT_SIZE
|
---|
| 269 | sw $sp, ISTATE_OFFSET_SP($k0)
|
---|
[741ade3f] | 270 | move $sp, $k0
|
---|
[1b109cb] | 271 |
|
---|
[741ade3f] | 272 | mfc0 $k0, $cause
|
---|
[1b109cb] | 273 |
|
---|
[0cb47cf] | 274 | sra $k0, $k0, 0x2 /* cp0_exc_cause() part 1 */
|
---|
| 275 | andi $k0, $k0, 0x1f /* cp0_exc_cause() part 2 */
|
---|
| 276 | sub $k0, 8 /* 8 = SYSCALL */
|
---|
[1b109cb] | 277 |
|
---|
[741ade3f] | 278 | beqz $k0, syscall_shortcut
|
---|
[0cb47cf] | 279 | add $k0, 8 /* revert $k0 back to correct exc number */
|
---|
[741ade3f] | 280 |
|
---|
| 281 | REGISTERS_STORE_AND_EXC_RESET $sp
|
---|
[1b109cb] | 282 |
|
---|
| 283 | move $a1, $sp
|
---|
[0cb47cf] | 284 | jal exc_dispatch /* exc_dispatch(excno, register_space) */
|
---|
[741ade3f] | 285 | move $a0, $k0
|
---|
[d92bf462] | 286 |
|
---|
[2bd4fdf] | 287 | REGISTERS_LOAD $sp
|
---|
[0cb47cf] | 288 | /* the $sp is automatically restored to former value */
|
---|
[2bd4fdf] | 289 | eret
|
---|
[1b109cb] | 290 |
|
---|
[0cb47cf] | 291 | /** Syscall entry
|
---|
| 292 | *
|
---|
| 293 | * Registers:
|
---|
| 294 | *
|
---|
| 295 | * @param $v0 Syscall number.
|
---|
| 296 | * @param $a0 1st argument.
|
---|
| 297 | * @param $a1 2nd argument.
|
---|
| 298 | * @param $a2 3rd argument.
|
---|
| 299 | * @param $a3 4th argument.
|
---|
| 300 | * @param $t0 5th argument.
|
---|
| 301 | * @param $t1 6th argument.
|
---|
| 302 | *
|
---|
| 303 | * @return The return value will be stored in $v0.
|
---|
| 304 | *
|
---|
| 305 | */
|
---|
[53f9821] | 306 | syscall_shortcut:
|
---|
[9c2fb97] | 307 | mfc0 $t3, $epc
|
---|
| 308 | mfc0 $t2, $status
|
---|
[ce890ec9] | 309 | sw $t3, ISTATE_OFFSET_EPC($sp) /* save EPC */
|
---|
| 310 | sw $k1, ISTATE_OFFSET_KT1($sp) /* save $k1 not saved on context switch */
|
---|
[1b109cb] | 311 |
|
---|
[0cb47cf] | 312 | and $t4, $t2, REG_SAVE_MASK /* save only KSU, EXL, ERL, IE */
|
---|
[9c2fb97] | 313 | li $t5, ~(0x1f)
|
---|
[0cb47cf] | 314 | and $t2, $t2, $t5 /* clear KSU, EXL, ERL */
|
---|
| 315 | ori $t2, $t2, 0x1 /* set IE */
|
---|
| 316 |
|
---|
[ce890ec9] | 317 | sw $t4, ISTATE_OFFSET_STATUS($sp)
|
---|
[9c2fb97] | 318 | mtc0 $t2, $status
|
---|
[0cb47cf] | 319 |
|
---|
| 320 | /*
|
---|
| 321 | * Call the higher level system call handler.
|
---|
| 322 | *
|
---|
| 323 | */
|
---|
[ce890ec9] | 324 | sw $t0, ISTATE_OFFSET_T0($sp) /* save the 5th argument on the stack */
|
---|
| 325 | sw $t1, ISTATE_OFFSET_T1($sp) /* save the 6th argument on the stack */
|
---|
[1b109cb] | 326 | jal syscall_handler
|
---|
[ce890ec9] | 327 | sw $v0, ISTATE_OFFSET_V0($sp) /* save the syscall number on the stack */
|
---|
[0cb47cf] | 328 |
|
---|
| 329 | /* restore status */
|
---|
[9c2fb97] | 330 | mfc0 $t2, $status
|
---|
[ce890ec9] | 331 | lw $t3, ISTATE_OFFSET_STATUS($sp)
|
---|
[0cb47cf] | 332 |
|
---|
| 333 | /*
|
---|
| 334 | * Change back to EXL = 1 (from last exception), otherwise
|
---|
| 335 | * an interrupt could rewrite the CP0 - EPC.
|
---|
| 336 | *
|
---|
| 337 | */
|
---|
| 338 | li $t4, ~REG_SAVE_MASK /* mask UM, EXL, ERL, IE */
|
---|
[9c2fb97] | 339 | and $t2, $t2, $t4
|
---|
[0cb47cf] | 340 | or $t2, $t2, $t3 /* copy saved UM, EXL, ERL, IE */
|
---|
[9c2fb97] | 341 | mtc0 $t2, $status
|
---|
[0cb47cf] | 342 |
|
---|
| 343 | /* restore epc + 4 */
|
---|
[ce890ec9] | 344 | lw $t2, ISTATE_OFFSET_EPC($sp)
|
---|
| 345 | lw $k1, ISTATE_OFFSET_KT1($sp)
|
---|
[9c2fb97] | 346 | addi $t2, $t2, 4
|
---|
| 347 | mtc0 $t2, $epc
|
---|
[5201199] | 348 |
|
---|
[ce890ec9] | 349 | lw $sp, ISTATE_OFFSET_SP($sp) /* restore $sp */
|
---|
[1b109cb] | 350 | eret
|
---|
[d92bf462] | 351 |
|
---|
[0c39b96] | 352 | FAKE_ABI_PROLOGUE
|
---|
[f761f1eb] | 353 | tlb_refill_handler:
|
---|
[2bd4fdf] | 354 | KERNEL_STACK_TO_K0
|
---|
[ce890ec9] | 355 | sub $k0, ISTATE_SOFT_SIZE
|
---|
[1b109cb] | 356 | REGISTERS_STORE_AND_EXC_RESET $k0
|
---|
[ce890ec9] | 357 | sw $sp, ISTATE_OFFSET_SP($k0)
|
---|
| 358 | move $sp, $k0
|
---|
[0cb47cf] | 359 |
|
---|
[2f40fe4] | 360 | jal tlb_refill
|
---|
[ce890ec9] | 361 | move $a0, $sp
|
---|
[0cb47cf] | 362 |
|
---|
[e84439a] | 363 | REGISTERS_LOAD $sp
|
---|
[4e1d008] | 364 | eret
|
---|
[f761f1eb] | 365 |
|
---|
[0c39b96] | 366 | FAKE_ABI_PROLOGUE
|
---|
[f761f1eb] | 367 | cache_error_handler:
|
---|
[2bd4fdf] | 368 | KERNEL_STACK_TO_K0
|
---|
[ce890ec9] | 369 | sub $k0, ISTATE_SOFT_SIZE
|
---|
[741ade3f] | 370 | REGISTERS_STORE_AND_EXC_RESET $k0
|
---|
[ce890ec9] | 371 | sw $sp, ISTATE_OFFSET_SP($k0)
|
---|
| 372 | move $sp, $k0
|
---|
[0cb47cf] | 373 |
|
---|
[4e1d008] | 374 | jal cache_error
|
---|
[ce890ec9] | 375 | move $a0, $sp
|
---|
[0cb47cf] | 376 |
|
---|
[e84439a] | 377 | REGISTERS_LOAD $sp
|
---|
[4e1d008] | 378 | eret
|
---|
[2bd4fdf] | 379 |
|
---|
| 380 | userspace_asm:
|
---|
[23c8be7f] | 381 | move $sp, $a0
|
---|
| 382 | move $v0, $a1
|
---|
| 383 | move $t9, $a2 /* set up correct entry into PIC code */
|
---|
[0cb47cf] | 384 | xor $a0, $a0, $a0 /* $a0 is defined to hold pcb_ptr */
|
---|
| 385 | /* set it to 0 */
|
---|
[2bd4fdf] | 386 | eret
|
---|