mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 08:31:52 +00:00
nds32: start_irq_handler() use system stack
[symptom] The 'vboot_hash_start()' always return busy error and variable 'in_progress' got a strange value(should be 0 or 1). 'start_irq_handler()' causes scratchpad overflow in first context switch. It must be called after SP switch to system stack in ISR. NOTE: The scratchpad is still also need more size even if 'start_irq_handler()' is using system stack. following is detail: 1. uint32_t scratchpad[19] 0x81d34 ~ 0x81d7f [__task_start:] 2. /* put the dummy stack pointer at the top of the stack in scratchpad */ addi $sp, $r3, 4 * 18 -> SP 0x81d7c 3. syscall push return address (-4) -> SP 0x81d78 [ISR:] 4. push r15, fp, lp, and sp (-0x10) -> SP 0x81d68 5. push r0 ~ r5 (-0x18) -> SP 0x81d50 [__switch_task:] 6. /* save ipsw, ipc, r6, r7, r8, r9, r10 on the current process stack */ (-0x1C) -> SP 0x81d34 Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=1. hash done. 2. console command 'taskinfo'. 3. the scratchpad does not overflow after first context switch. Change-Id: If5d89ff5c945a777010492fcfb54bf41f434ed69 Reviewed-on: https://chromium-review.googlesource.com/317468 Commit-Ready: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -20,13 +20,13 @@ __entry_\()\name:
|
||||
smw.adm $r15, [$sp], $r15, 0xb
|
||||
/* r0-r5 are caller saved */
|
||||
smw.adm $r0, [$sp], $r5, 0
|
||||
/* isr entry */
|
||||
jal start_irq_handler
|
||||
/* switch to system stack if we are called from process stack */
|
||||
la $r3, stack_end
|
||||
mov55 $fp, $sp
|
||||
slt45 $r3, $sp /* if sp > end of system stack, then r15 = 1 and */
|
||||
cmovn $sp, $r3, $r15 /* point sp to the top of the system stack */
|
||||
/* isr entry */
|
||||
jal start_irq_handler
|
||||
/* C routine handler */
|
||||
jal \name\()_handler
|
||||
/* check whether we need to change the scheduled task */
|
||||
|
||||
@@ -89,7 +89,7 @@ __task_start:
|
||||
movi55 $r0, 0 /* syscall 1st parameter : de-schedule nothing */
|
||||
|
||||
/* put the dummy stack pointer at the top of the stack in scratchpad */
|
||||
addi $sp, $r3, 4 * 16
|
||||
addi $sp, $r3, 4 * 18
|
||||
/* we are ready to re-schedule */
|
||||
swi.gp $r4, [ + need_resched]
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ uint8_t task_stacks[0
|
||||
|
||||
/* Reserve space to discard context on first context switch. */
|
||||
#ifdef CONFIG_FPU
|
||||
uint32_t scratchpad[17+18];
|
||||
uint32_t scratchpad[19+18];
|
||||
#else
|
||||
uint32_t scratchpad[17];
|
||||
uint32_t scratchpad[19];
|
||||
#endif
|
||||
|
||||
task_ *current_task = (task_ *)scratchpad;
|
||||
|
||||
Reference in New Issue
Block a user