mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
arm: Make ARMv5 boards work again
Fix some bugs found while trying run modern NuttX on an old board.
This commit is contained in:
@@ -174,19 +174,15 @@ arm_vectorirq:
|
|||||||
|
|
||||||
mov fp, #0 /* Init frame pointer */
|
mov fp, #0 /* Init frame pointer */
|
||||||
mov r0, sp /* Get r0=xcp */
|
mov r0, sp /* Get r0=xcp */
|
||||||
|
mov r4, sp /* Save the SP in a preserved register */
|
||||||
|
|
||||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
/* Call arm_decodeirq() on the interrupt stack */
|
/* Call arm_decodeirq() on the interrupt stack */
|
||||||
|
|
||||||
ldr sp, .Lirqstacktop /* SP = interrupt stack top */
|
ldr sp, .Lirqstacktop /* SP = interrupt stack top */
|
||||||
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
|
|
||||||
bl arm_decodeirq /* Call the handler */
|
|
||||||
ldr sp, [sp] /* Restore the user stack pointer */
|
|
||||||
#else
|
#else
|
||||||
/* Call arm_decodeirq() on the user stack */
|
/* Call arm_decodeirq() on the user stack */
|
||||||
|
|
||||||
mov r4, sp /* Save the SP in a preserved register */
|
|
||||||
|
|
||||||
/* If the interrupt stack is disabled, reserve xcpcontext to ensure
|
/* If the interrupt stack is disabled, reserve xcpcontext to ensure
|
||||||
* that signal processing can have a separate xcpcontext to handle
|
* that signal processing can have a separate xcpcontext to handle
|
||||||
* signal context (reference: arm_schedulesigaction.c):
|
* signal context (reference: arm_schedulesigaction.c):
|
||||||
@@ -199,11 +195,10 @@ arm_vectorirq:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sub sp, sp, #XCPTCONTEXT_SIZE /* Reserve signal context */
|
sub sp, sp, #XCPTCONTEXT_SIZE /* Reserve signal context */
|
||||||
|
#endif
|
||||||
bic sp, sp, #7 /* Force 8-byte alignment */
|
bic sp, sp, #7 /* Force 8-byte alignment */
|
||||||
bl arm_decodeirq /* Call the handler */
|
bl arm_decodeirq /* Call the handler */
|
||||||
mov sp, r4 /* Restore the possibly unaligned stack pointer */
|
mov sp, r4 /* Restore the possibly unaligned stack pointer */
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore the state of the floating point registers. */
|
/* Restore the state of the floating point registers. */
|
||||||
@@ -217,6 +212,8 @@ arm_vectorirq:
|
|||||||
mov r4, #(PSR_MODE_IRQ | PSR_I_BIT)
|
mov r4, #(PSR_MODE_IRQ | PSR_I_BIT)
|
||||||
msr cpsr_c, r4 /* Switch back IRQ mode */
|
msr cpsr_c, r4 /* Switch back IRQ mode */
|
||||||
|
|
||||||
|
mov sp, r0 /* regs returned by arm_decodeirq */
|
||||||
|
|
||||||
/* Restore the CPSR, SYS mode registers and return */
|
/* Restore the CPSR, SYS mode registers and return */
|
||||||
|
|
||||||
ldr r0, [sp, #(4*REG_CPSR)] /* Fetch the return SPSR */
|
ldr r0, [sp, #(4*REG_CPSR)] /* Fetch the return SPSR */
|
||||||
@@ -314,6 +311,7 @@ arm_vectorsvc:
|
|||||||
|
|
||||||
mov r4, #(PSR_MODE_SVC | PSR_I_BIT)
|
mov r4, #(PSR_MODE_SVC | PSR_I_BIT)
|
||||||
msr cpsr_c, r4 /* Switch back SVC mode */
|
msr cpsr_c, r4 /* Switch back SVC mode */
|
||||||
|
mov sp, r0 /* regs returned by arm_syscall */
|
||||||
|
|
||||||
/* Restore the CPSR, SYS mode registers and return */
|
/* Restore the CPSR, SYS mode registers and return */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user