summaryrefslogtreecommitdiff
path: root/nuttx/arch/hc/src/common
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-06 23:01:06 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-06 23:01:06 +0000
commit8285ffad2245a53de14c65913b00dab5568f0afc (patch)
treea4707d8f1e51d31b1fc2866c63260bfbf99b1f34 /nuttx/arch/hc/src/common
parentdcea5f0360725d2c25b61eefe9db7b2474b26dd6 (diff)
downloadpx4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.tar.gz
px4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.tar.bz2
px4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.zip
current_regs should be volatile; add support for nested interrupts; enable interrupts during syscall processing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3475 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/hc/src/common')
-rw-r--r--nuttx/arch/hc/src/common/up_doirq.c11
-rwxr-xr-xnuttx/arch/hc/src/common/up_internal.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/nuttx/arch/hc/src/common/up_doirq.c b/nuttx/arch/hc/src/common/up_doirq.c
index 05dbaa2cf..adb3f81ce 100644
--- a/nuttx/arch/hc/src/common/up_doirq.c
+++ b/nuttx/arch/hc/src/common/up_doirq.c
@@ -76,6 +76,8 @@ uint8_t *up_doirq(int irq, uint8_t *regs)
#ifdef CONFIG_SUPPRESS_INTERRUPTS
PANIC(OSERR_ERREXCEPTION);
#else
+ uint8_t *savestate;
+
/* Nested interrupts are not supported in this implementation. If you want
* implemented nested interrupts, you would have to (1) change the way that
* current regs is handled and (2) the design associated with
@@ -86,7 +88,7 @@ uint8_t *up_doirq(int irq, uint8_t *regs)
* current_regs is also used to manage interrupt level context switches.
*/
- DEBUGASSERT(current_regs == NULL);
+ savestate = (uint8_t*)current_regs;
current_regs = regs;
/* Deliver the IRQ */
@@ -101,9 +103,12 @@ uint8_t *up_doirq(int irq, uint8_t *regs)
regs = current_regs;
- /* Indicate that we are no long in an interrupt handler */
+ /* Restore the previous value of current_regs. NULL would indicate that
+ * we are no longer in an interrupt handler. It will be non-NULL if we
+ * are returning from a nested interrupt.
+ */
- current_regs = NULL;
+ current_regs = savestate;
#endif
up_ledoff(LED_INIRQ);
return regs;
diff --git a/nuttx/arch/hc/src/common/up_internal.h b/nuttx/arch/hc/src/common/up_internal.h
index 8879eee57..1a30f28e5 100755
--- a/nuttx/arch/hc/src/common/up_internal.h
+++ b/nuttx/arch/hc/src/common/up_internal.h
@@ -81,7 +81,7 @@
* a referenced is passed to get the state from the TCB.
*/
-#define up_savestate(regs) up_copystate(regs, current_regs)
+#define up_savestate(regs) up_copystate(regs, (uint8_t*)current_regs)
#define up_restorestate(regs) (current_regs = regs)
/****************************************************************************