summaryrefslogtreecommitdiff
path: root/nuttx/arch/sh/src/common/up_doirq.c
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/sh/src/common/up_doirq.c
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/sh/src/common/up_doirq.c')
-rw-r--r--nuttx/arch/sh/src/common/up_doirq.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/nuttx/arch/sh/src/common/up_doirq.c b/nuttx/arch/sh/src/common/up_doirq.c
index 6e64a623c..0ec82b7d9 100644
--- a/nuttx/arch/sh/src/common/up_doirq.c
+++ b/nuttx/arch/sh/src/common/up_doirq.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/sh/src/common/up_doirq.c
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -77,11 +77,14 @@ uint32_t *up_doirq(int irq, uint32_t* regs)
#else
if ((unsigned)irq < NR_IRQS)
{
+ uint32_t *savestate;
+
/* Current regs non-zero indicates that we are processing
* an interrupt; current_regs is also used to manage
* interrupt level context switches.
*/
+ savestate = (uint32_t*)current_regs;
current_regs = regs;
/* Mask and acknowledge the interrupt (if supported by the chip) */
@@ -100,9 +103,12 @@ uint32_t *up_doirq(int irq, uint32_t* regs)
regs = current_regs;
- /* Indicate that we are no longer 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;
/* Unmask the last interrupt (global interrupts are still
* disabled.