diff --git a/arch/arm/src/armv7-a/arm_vectors.S b/arch/arm/src/armv7-a/arm_vectors.S index 237bf43284..f3a23199c0 100644 --- a/arch/arm/src/armv7-a/arm_vectors.S +++ b/arch/arm/src/armv7-a/arm_vectors.S @@ -343,10 +343,24 @@ arm_vectorsvc: mov fp, #0 /* Init frame pointer */ mov r0, sp /* Get r0=xcp */ + +#if CONFIG_ARCH_INTERRUPTSTACK > 7 + /* Call arm_syscall() on the interrupt stack */ + + setirqstack r1, r3 /* SP = interrupt stack top */ + str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */ + mov r4, sp /* Save the SP in a preserved register */ + bic sp, sp, #7 /* Force 8-byte alignment */ + bl arm_syscall /* Call the handler */ + ldr sp, [r4] /* Restore the user stack pointer */ +#else + /* Call arm_syscall() on the user stack */ + mov r4, sp /* Save the SP in a preserved register */ bic sp, sp, #7 /* Force 8-byte alignment */ bl arm_syscall /* Call the handler */ mov sp, r4 /* Restore the possibly unaligned stack pointer */ +#endif /* Upon return from arm_syscall, r0 holds the pointer to the register * state save area to use to restore the registers. This may or may not diff --git a/arch/arm/src/armv7-r/arm_vectors.S b/arch/arm/src/armv7-r/arm_vectors.S index d4865b03be..64d1190396 100644 --- a/arch/arm/src/armv7-r/arm_vectors.S +++ b/arch/arm/src/armv7-r/arm_vectors.S @@ -297,10 +297,24 @@ arm_vectorsvc: mov fp, #0 /* Init frame pointer */ mov r0, sp /* Get r0=xcp */ + +#if CONFIG_ARCH_INTERRUPTSTACK > 7 + /* Call arm_syscall() on the interrupt stack */ + + ldr sp, .Lirqstacktop /* SP = interrupt stack top */ + str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */ + mov r4, sp /* Save the SP in a preserved register */ + bic sp, sp, #7 /* Force 8-byte alignment */ + bl arm_syscall /* Call the handler */ + ldr sp, [r4] /* Restore the user stack pointer */ +#else + /* Call arm_syscall() on the user stack */ + mov r4, sp /* Save the SP in a preserved register */ bic sp, sp, #7 /* Force 8-byte alignment */ bl arm_syscall /* Call the handler */ mov sp, r4 /* Restore the possibly unaligned stack pointer */ +#endif /* Upon return from arm_syscall, r0 holds the pointer to the register * state save area to use to restore the registers. This may or may not