summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/armv7-m
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-13 17:32:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-13 17:32:37 +0000
commit5be9588ed42d1a4ed297bdc76d9e05e582e78969 (patch)
treea975a5a0d60e1cd2255ba0bd3ed397c72dc4745d /nuttx/arch/arm/src/armv7-m
parent1125cbdc2d38da82d9631aa0ae1d9030f641126e (diff)
downloadpx4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.tar.gz
px4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.tar.bz2
px4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.zip
Fixe to kernel build and syscalls.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5738 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/armv7-m')
-rw-r--r--nuttx/arch/arm/src/armv7-m/up_svcall.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c
index 13cce36ef..8321cd3bb 100644
--- a/nuttx/arch/arm/src/armv7-m/up_svcall.c
+++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c
@@ -112,9 +112,13 @@ static void dispatch_syscall(void)
{
__asm__ __volatile__
(
+ " push {r4}\n" /* Save R4 */
+ " mov r4, lr\n" /* Save lr in R4 */
" ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */
" ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */
- " blx ip\n" /* Call the stub (modifies R14)*/
+ " blx ip\n" /* Call the stub (modifies lr)*/
+ " mov lr, r4\n" /* Restore lr */
+ " pop {r4}\n" /* Restore r4 */
" mov r2, r0\n" /* R2=Saved return value in R0 */
" mov r0, #3\n" /* R0=SYS_syscall_return */
" svc 0" /* Return from the syscall */
@@ -152,7 +156,7 @@ int up_svcall(int irq, FAR void *context)
regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
#ifdef REG_EXC_RETURN
- svcdbg(" PSR: %08x LR: %08x\n", regs[REG_XPSR], current_regs[REG_EXC_RETURN]);
+ svcdbg(" PSR: %08x LR: %08x\n", regs[REG_XPSR], regs[REG_EXC_RETURN]);
#else
svcdbg(" PSR: %08x\n", regs[REG_XPSR]);
#endif
@@ -265,7 +269,7 @@ int up_svcall(int irq, FAR void *context)
rtcb->xcp.sysreturn = 0;
/* The return value must be in R0-R1. dispatch_syscall() temporarily
- * moved the value for R0 to R2.
+ * moved the value for R0 into R2.
*/
current_regs[REG_R0] = current_regs[REG_R2];
@@ -322,7 +326,12 @@ int up_svcall(int irq, FAR void *context)
svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
current_regs[REG_R8], current_regs[REG_R9], current_regs[REG_R10], current_regs[REG_R11],
current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]);
- svcdbg(" PSR=%08x\n", current_regs[REG_XPSR]);
+#ifdef REG_EXC_RETURN
+ svcdbg(" PSR: %08x LR: %08x\n",
+ current_regs[REG_XPSR], current_regs[REG_EXC_RETURN]);
+#else
+ svcdbg(" PSR: %08x\n", current_regs[REG_XPSR]);
+#endif
}
else
{