MIPS: Add support for microMIPS exception handling.
PATCH v3 6/9 MIPS: Add support for microMIPS exception handling.
From: "Steven J. Hill" <[email protected]>
All exceptions must be taken in microMIPS mode, never in MIPS32R2 mode or the kernel falls apart. A few 'nop' instructions are used to maintain the correct alignment of microMIPS versions of the exception vectors.
Signed-off-by Steven J. Hill <[email protected]>
--- arch/mips/include/asm/stackframe.h | 12 +- arch/mips/kernel/genex.S | 82 +++++--- arch/mips/kernel/scall32-o32.S | 18 +- arch/mips/kernel/smtc-asm.S | 3 + arch/mips/kernel/traps.c | 375 +++++++++++++++++++++++++----------- arch/mips/mm/tlbex.c | 21 ++ arch/mips/mti-sead3/sead3-init.c | 48 +++++ 7 files changed, 413 insertions(+), 146 deletions(-)
arch/mips/include/asm/stackframe.h +6 -6
@@ -139,7 +139,7 @@ 1: move ra, k0 li k0, 3 mtc0 k0, $22 -#endif /* CONFIG_CPU_LOONGSON2F */ +#endif /* CONFIG_CPU_JUMP_WORKAROUNDS */ #if defined(CONFIG_32BIT ) || defined(KBUILD_64BIT_SYM32 ) lui k1, %hi(kernelsp) #else
@@ -189,6 +189,7 @@ LONG_S $0, PT_R0(sp) mfc0 v1, CP0_STATUS LONG_S $2, PT_R2(sp) + LONG_S v1, PT_STATUS(sp)#ifdef CONFIG_MIPS_MT_SMTC /* * Ideally, these instructions would be shuffled in
@@ -200,21 +201,20 @@ LONG_S k0, PT_TCSTATUS(sp)#endif /* CONFIG_MIPS_MT_SMTC */ LONG_S $4, PT_R4(sp) - LONG_S $5, PT_R5(sp) - LONG_S v1, PT_STATUS(sp) mfc0 v1, CP0_CAUSE - LONG_S $6, PT_R6(sp) - LONG_S $7, PT_R7(sp) + LONG_S $5, PT_R5(sp) LONG_S v1, PT_CAUSE(sp) + LONG_S $6, PT_R6(sp) MFC0 v1, CP0_EPC + LONG_S $7, PT_R7(sp)#ifdef CONFIG_64BIT LONG_S $8, PT_R8(sp) LONG_S $9, PT_R9(sp)#endif + LONG_S v1, PT_EPC(sp) LONG_S $25, PT_R25(sp) LONG_S $28, PT_R28(sp) LONG_S $31, PT_R31(sp) - LONG_S v1, PT_EPC(sp) ori $28, sp, _THREAD_MASK xori $28, _THREAD_MASK #ifdef CONFIG_CPU_CAVIUM_OCTEON
arch/mips/kernel/genex.S +60 -22
171 lines not on this page · raw message
arch/mips/kernel/scall32-o32.S +14 -4
@@ -143,15 +143,25 @@ stackargs: jr t1 addiu t1, 6f - 5f -2: lw t8, 28(t0) # argument #8 from usp -3: lw t7, 24(t0) # argument #7 from usp -4: lw t6, 20(t0) # argument #6 from usp -5: jr t1 + lw t8, 28(t0) # argument #8 from usp + lw t7, 24(t0) # argument #7 from usp + lw t6, 20(t0) # argument #6 from usp + jr t1 sw t5, 16(sp) # argument #5 to ksp +#ifdef CONFIG_CPU_MICROMIPS + ## FIXME: + sw t8, 28(sp) # argument #8 to ksp + nop + sw t7, 24(sp) # argument #7 to ksp + nop + sw t6, 20(sp) # argument #6 to ksp + nop +#else sw t8, 28(sp) # argument #8 to ksp sw t7, 24(sp) # argument #7 to ksp sw t6, 20(sp) # argument #6 to ksp +#endif 6: j stack_done # go back nop .set pop
arch/mips/kernel/smtc-asm.S +3 -0
@@ -49,6 +49,9 @@ CAN WE PROVE THAT WE WON'T DO THIS IF INTS DISABLED?? .text .align 5 FEXPORT(__smtc_ipi_vector) +#ifdef CONFIG_CPU_MICROMIPS + nop +#endif .set noat /* Disable thread scheduling to make Status update atomic */ DMT 27 # dmt k1
arch/mips/kernel/traps.c +261 -114
618 lines not on this page · raw message
arch/mips/mm/tlbex.c +21 -0
@@ -2019,6 +2019,13 @@ static void __cpuinit build_r4000_tlb_load_handler(void)uasm_l_nopage_tlbl (&l, p);build_restore_work_registers (&p); +#ifdef CONFIG_CPU_MICROMIPS +if ((unsigned long )tlb_do_page_fault_0 &1 ) { +uasm_i_lui (&p,K0 ,uasm_rel_hi ((long )tlb_do_page_fault_0)); +uasm_i_addiu (&p,K0 ,K0 ,uasm_rel_lo ((long )tlb_do_page_fault_0)); +uasm_i_jr (&p,K0 ); + } else +#endif uasm_i_j (&p, (unsigned long )tlb_do_page_fault_0 &0x0fffffff );uasm_i_nop (&p);
@@ -2066,6 +2073,13 @@ static void __cpuinit build_r4000_tlb_store_handler(void)uasm_l_nopage_tlbs (&l, p);build_restore_work_registers (&p); +#ifdef CONFIG_CPU_MICROMIPS +if ((unsigned long )tlb_do_page_fault_1 &1 ) { +uasm_i_lui (&p,K0 ,uasm_rel_hi ((long )tlb_do_page_fault_1)); +uasm_i_addiu (&p,K0 ,K0 ,uasm_rel_lo ((long )tlb_do_page_fault_1)); +uasm_i_jr (&p,K0 ); + } else +#endif uasm_i_j (&p, (unsigned long )tlb_do_page_fault_1 &0x0fffffff );uasm_i_nop (&p);
@@ -2114,6 +2128,13 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)uasm_l_nopage_tlbm (&l, p);build_restore_work_registers (&p); +#ifdef CONFIG_CPU_MICROMIPS +if ((unsigned long )tlb_do_page_fault_1 &1 ) { +uasm_i_lui (&p,K0 ,uasm_rel_hi ((long )tlb_do_page_fault_1)); +uasm_i_addiu (&p,K0 ,K0 ,uasm_rel_lo ((long )tlb_do_page_fault_1)); +uasm_i_jr (&p,K0 ); + } else +#endif uasm_i_j (&p, (unsigned long )tlb_do_page_fault_1 &0x0fffffff );uasm_i_nop (&p);
arch/mips/mti-sead3/sead3-init.c +48 -0
62 lines not on this page · raw message
Signature · 1 line
1.7.10