summaryrefslogtreecommitdiff
path: root/nuttx/arch/mips/src/mips32/up_swint0.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 16:13:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 16:13:28 +0000
commit2b2bbf6433f7271abce9c3e4cbdf2f456fcbeca3 (patch)
treedf9b3967acb62fff1190b1625cf373b8ed95f48a /nuttx/arch/mips/src/mips32/up_swint0.c
parentdb8769c0dbd3a9c33b60863a62f33cc5158bf7bd (diff)
downloadnuttx-2b2bbf6433f7271abce9c3e4cbdf2f456fcbeca3.tar.gz
nuttx-2b2bbf6433f7271abce9c3e4cbdf2f456fcbeca3.tar.bz2
nuttx-2b2bbf6433f7271abce9c3e4cbdf2f456fcbeca3.zip
Add support for nested system calls
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5752 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/mips/src/mips32/up_swint0.c')
-rw-r--r--nuttx/arch/mips/src/mips32/up_swint0.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/nuttx/arch/mips/src/mips32/up_swint0.c b/nuttx/arch/mips/src/mips32/up_swint0.c
index 7be82a9e7..34a8a1dde 100644
--- a/nuttx/arch/mips/src/mips32/up_swint0.c
+++ b/nuttx/arch/mips/src/mips32/up_swint0.c
@@ -238,18 +238,19 @@ int up_swint0(int irq, FAR void *context)
case SYS_syscall_return:
{
struct tcb_s *rtcb = sched_self();
+ int index = (int)rtcb->xcp.nsyscalls - 1;
/* Make sure that there is a saved syscall return address. */
- DEBUGASSERT(rtcb->xcp.sysreturn != 0);
+ DEBUGASSERT(index >= 0);
/* Setup to return to the saved syscall return address in
* the original mode.
*/
- current_regs[REG_EPC] = rtcb->xcp.sysreturn;
+ current_regs[REG_EPC] = rtcb->xcp.syscall[index].sysreturn;
#error "Missing logic -- need to restore the original mode"
- rtcb->sysreturn = 0;
+ rtcb->xcp.nsyscalls = index;
}
break;
#endif
@@ -263,6 +264,7 @@ int up_swint0(int irq, FAR void *context)
{
#ifdef CONFIG_NUTTX_KERNEL
FAR struct tcb_s *rtcb = sched_self();
+ int index = rtcb->xcp.nsyscalls;
/* Verify that the SYS call number is within range */
@@ -272,17 +274,20 @@ int up_swint0(int irq, FAR void *context)
* return address. We cannot yet handle nested system calls.
*/
- DEBUGASSERT(rtcb->xcp.sysreturn == 0);
+ DEBUGASSERT(index < CONFIG_SYS_NNEST);
/* Setup to return to dispatch_syscall in privileged mode. */
- rtcb->sysreturn = regs[REG_EPC];
- regs[REG_EPC] = (uint32_t)dispatch_syscall;
+ rtcb->xcpsyscall[index].sysreturn = regs[REG_EPC];
+#error "Missing logic -- Need to save mode"
+ rtcb->xcp.nsyscalls = index + 1;
+
+ regs[REG_EPC] = (uint32_t)dispatch_syscall;
#error "Missing logic -- Need to set privileged mode"
/* Offset R0 to account for the reserved values */
- current_regs[REG_R0] -= CONFIG_SYS_RESERVED;
+ current_regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else
slldbg("ERROR: Bad SYS call: %d\n", regs[REG_A0]);
#endif