ARC: entry.S: common'ize scrtach reg freeup in intr + exceptions
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
This commit is contained in:
Родитель
11e14896ea
Коммит
fbfa26ae3b
|
@ -360,26 +360,26 @@
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/*--------------------------------------------------------------
|
/*--------------------------------------------------------------
|
||||||
* For early Exception Prologue, a core reg is temporarily needed to
|
* For early Exception/ISR Prologue, a core reg is temporarily needed to
|
||||||
* code the rest of prolog (stack switching). This is done by stashing
|
* code the rest of prolog (stack switching). This is done by stashing
|
||||||
* it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP).
|
* it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP).
|
||||||
*
|
*
|
||||||
* Before saving the full regfile - this reg is restored back, only
|
* Before saving the full regfile - this reg is restored back, only
|
||||||
* to be saved again on kernel mode stack, as part of pt_regs.
|
* to be saved again on kernel mode stack, as part of pt_regs.
|
||||||
*-------------------------------------------------------------*/
|
*-------------------------------------------------------------*/
|
||||||
.macro EXCPN_PROLOG_FREEUP_REG reg
|
.macro PROLOG_FREEUP_REG reg, mem
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
sr \reg, [ARC_REG_SCRATCH_DATA0]
|
sr \reg, [ARC_REG_SCRATCH_DATA0]
|
||||||
#else
|
#else
|
||||||
st \reg, [@ex_saved_reg1]
|
st \reg, [\mem]
|
||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro EXCPN_PROLOG_RESTORE_REG reg
|
.macro PROLOG_RESTORE_REG reg, mem
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
lr \reg, [ARC_REG_SCRATCH_DATA0]
|
lr \reg, [ARC_REG_SCRATCH_DATA0]
|
||||||
#else
|
#else
|
||||||
ld \reg, [@ex_saved_reg1]
|
ld \reg, [\mem]
|
||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@
|
||||||
.macro EXCEPTION_PROLOGUE
|
.macro EXCEPTION_PROLOGUE
|
||||||
|
|
||||||
/* Need at least 1 reg to code the early exception prologue */
|
/* Need at least 1 reg to code the early exception prologue */
|
||||||
EXCPN_PROLOG_FREEUP_REG r9
|
PROLOG_FREEUP_REG r9, @ex_saved_reg1
|
||||||
|
|
||||||
/* U/K mode at time of exception (stack not switched if already K) */
|
/* U/K mode at time of exception (stack not switched if already K) */
|
||||||
lr r9, [erstatus]
|
lr r9, [erstatus]
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
st r0, [sp, 4] /* orig_r0, needed only for sys calls */
|
st r0, [sp, 4] /* orig_r0, needed only for sys calls */
|
||||||
|
|
||||||
/* Restore r9 used to code the early prologue */
|
/* Restore r9 used to code the early prologue */
|
||||||
EXCPN_PROLOG_RESTORE_REG r9
|
PROLOG_RESTORE_REG r9, @ex_saved_reg1
|
||||||
|
|
||||||
SAVE_R0_TO_R12
|
SAVE_R0_TO_R12
|
||||||
PUSH gp
|
PUSH gp
|
||||||
|
@ -471,12 +471,8 @@
|
||||||
*-------------------------------------------------------------*/
|
*-------------------------------------------------------------*/
|
||||||
.macro SAVE_ALL_INT1
|
.macro SAVE_ALL_INT1
|
||||||
|
|
||||||
/* restore original r9 to be saved as part of reg-file */
|
/* restore original r9 */
|
||||||
#ifdef CONFIG_SMP
|
PROLOG_RESTORE_REG r9, @int1_saved_reg
|
||||||
lr r9, [ARC_REG_SCRATCH_DATA0]
|
|
||||||
#else
|
|
||||||
ld r9, [@int1_saved_reg]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* now we are ready to save the remaining context :) */
|
/* now we are ready to save the remaining context :) */
|
||||||
st event_IRQ1, [sp, 8] /* Dummy ECR */
|
st event_IRQ1, [sp, 8] /* Dummy ECR */
|
||||||
|
@ -496,12 +492,13 @@
|
||||||
|
|
||||||
.macro SAVE_ALL_INT2
|
.macro SAVE_ALL_INT2
|
||||||
|
|
||||||
/* TODO-vineetg: SMP we can't use global nor can we use
|
/*
|
||||||
* SCRATCH0 as we do for int1 because while int1 is using
|
* In SMP we can't use mem nor can we use SCRARCH_DATA0
|
||||||
* it, int2 can come
|
* as we do for int1 because int2 can clobber it
|
||||||
*/
|
* Hence 2 levels of intr are NOT allowed in SMP (by Kconfig)
|
||||||
/* retsore original r9 , saved in sys_saved_r9 */
|
*/
|
||||||
ld r9, [@int2_saved_reg]
|
/* restore original r9 */
|
||||||
|
PROLOG_RESTORE_REG r9, @int2_saved_reg
|
||||||
|
|
||||||
/* now we are ready to save the remaining context :) */
|
/* now we are ready to save the remaining context :) */
|
||||||
st event_IRQ2, [sp, 8] /* Dummy ECR */
|
st event_IRQ2, [sp, 8] /* Dummy ECR */
|
||||||
|
|
|
@ -186,9 +186,8 @@ reserved: ; processor restart
|
||||||
; ---------------------------------------------
|
; ---------------------------------------------
|
||||||
ENTRY(handle_interrupt_level2)
|
ENTRY(handle_interrupt_level2)
|
||||||
|
|
||||||
; TODO-vineetg for SMP this wont work
|
|
||||||
; free up r9 as scratchpad
|
; free up r9 as scratchpad
|
||||||
st r9, [@int2_saved_reg]
|
PROLOG_FREEUP_REG r9, @int2_saved_reg
|
||||||
|
|
||||||
;Which mode (user/kernel) was the system in when intr occured
|
;Which mode (user/kernel) was the system in when intr occured
|
||||||
lr r9, [status32_l2]
|
lr r9, [status32_l2]
|
||||||
|
@ -234,12 +233,7 @@ END(handle_interrupt_level2)
|
||||||
; ---------------------------------------------
|
; ---------------------------------------------
|
||||||
ENTRY(handle_interrupt_level1)
|
ENTRY(handle_interrupt_level1)
|
||||||
|
|
||||||
/* free up r9 as scratchpad */
|
PROLOG_FREEUP_REG r9, @int1_saved_reg
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
sr r9, [ARC_REG_SCRATCH_DATA0]
|
|
||||||
#else
|
|
||||||
st r9, [@int1_saved_reg]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
;Which mode (user/kernel) was the system in when intr occured
|
;Which mode (user/kernel) was the system in when intr occured
|
||||||
lr r9, [status32_l1]
|
lr r9, [status32_l1]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче