summaryrefslogtreecommitdiff
path: root/nuttx/arch/x86/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-09 02:04:45 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-09 02:04:45 +0000
commit08f35466fe32b14d64946f45da6777e8d66fc698 (patch)
treef62946d607143348b3d7c3019703043ad3e1685c /nuttx/arch/x86/src
parent4b9a6ca4adddb337cb93b88245ea01d1b800d40e (diff)
downloadpx4-nuttx-08f35466fe32b14d64946f45da6777e8d66fc698.tar.gz
px4-nuttx-08f35466fe32b14d64946f45da6777e8d66fc698.tar.bz2
px4-nuttx-08f35466fe32b14d64946f45da6777e8d66fc698.zip
Fix fullcontextrestore bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3353 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/x86/src')
-rw-r--r--nuttx/arch/x86/src/common/up_assert.c (renamed from nuttx/arch/x86/src/i486/up_assert.c)37
-rw-r--r--nuttx/arch/x86/src/common/up_internal.h22
-rw-r--r--nuttx/arch/x86/src/i486/up_regdump.c82
-rwxr-xr-xnuttx/arch/x86/src/qemu/Make.defs4
-rw-r--r--nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S16
5 files changed, 98 insertions, 63 deletions
diff --git a/nuttx/arch/x86/src/i486/up_assert.c b/nuttx/arch/x86/src/common/up_assert.c
index 69a6fe923..55ba376b4 100644
--- a/nuttx/arch/x86/src/i486/up_assert.c
+++ b/nuttx/arch/x86/src/common/up_assert.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/x86/src/i486/up_assert.c
+ * arch/x86/src/common/up_assert.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -109,36 +109,6 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
#endif
/****************************************************************************
- * Name: up_registerdump
- ****************************************************************************/
-
-#ifdef CONFIG_ARCH_STACKDUMP
-static inline void up_registerdump(void)
-{
- /* Are user registers available from interrupt processing? */
-
- if (current_regs)
- {
- lldbg(" ds:%08x irq:%08x err:%08x\n",
- current_regs[REG_DS], current_regs[REG_IRQNO],
- current_regs[REG_ERRCODE]);
- lldbg("edi:%08x esi:%08x ebp:%08x esp:%08x\n",
- current_regs[REG_EDI], current_regs[REG_ESI],
- current_regs[REG_EBP], current_regs[REG_ESP]);
- lldbg("ebx:%08x edx:%08x ecx:%08x eax:%08x\n",
- current_regs[REG_EBX], current_regs[REG_EDX],
- current_regs[REG_ECX], current_regs[REG_EAX]);
- lldbg("eip:%08x cs:%08x flg:%08x sp:%08x ss:%08x\n",
- current_regs[REG_EIP], current_regs[REG_CS],
- current_regs[REG_EFLAGS], current_regs[REG_SP],
- current_regs[REG_SS]);
- }
-}
-#else
-# define up_registerdump()
-#endif
-
-/****************************************************************************
* Name: up_dumpstate
****************************************************************************/
@@ -226,7 +196,10 @@ static void up_dumpstate(void)
/* Then dump the registers (if available) */
- up_registerdump();
+ if (current_regs != NULL)
+ {
+ up_registerdump(current_regs);
+ }
}
#else
# define up_dumpstate()
diff --git a/nuttx/arch/x86/src/common/up_internal.h b/nuttx/arch/x86/src/common/up_internal.h
index 35b4e7b5c..d8e25329e 100644
--- a/nuttx/arch/x86/src/common/up_internal.h
+++ b/nuttx/arch/x86/src/common/up_internal.h
@@ -163,28 +163,8 @@ extern void up_lowputc(char ch);
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
-extern void up_doirq(int irq, uint32_t *regs);
-#ifdef CONFIG_PAGING
-extern void up_pginitialize(void);
-extern uint32_t *up_va2pte(uintptr_t vaddr);
-extern void up_dataabort(uint32_t *regs, uint32_t far, uint32_t fsr);
-#else /* CONFIG_PAGING */
-# define up_pginitialize()
-extern void up_dataabort(uint32_t *regs);
-#endif /* CONFIG_PAGING */
-extern void up_prefetchabort(uint32_t *regs);
extern void up_syscall(uint32_t *regs);
-extern void up_undefinedinsn(uint32_t *regs);
-
-/* Defined in up_vectors.S */
-
-extern void up_vectorundefinsn(void);
-extern void up_vectorswi(void);
-extern void up_vectorprefetch(void);
-extern void up_vectordata(void);
-extern void up_vectoraddrexcptn(void);
-extern void up_vectorirq(void);
-extern void up_vectorfiq(void);
+extern void up_registerdump(uint32_t *regs);
/* Defined in up_allocateheap.c */
diff --git a/nuttx/arch/x86/src/i486/up_regdump.c b/nuttx/arch/x86/src/i486/up_regdump.c
new file mode 100644
index 000000000..68d31cdce
--- /dev/null
+++ b/nuttx/arch/x86/src/i486/up_regdump.c
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * arch/x86/src/i486/up_regdump.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+#include <nuttx/irq.h>
+
+#include "up_internal.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Output debug info -- even if debug is not selected. */
+
+#undef lldbg
+#define lldbg lib_lowprintf
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+/****************************************************************************
+ * Name: up_registerdump
+ ****************************************************************************/
+
+void up_registerdump(uint32_t *regs)
+{
+ lldbg(" ds:%08x irq:%08x err:%08x\n",
+ regs[REG_DS], regs[REG_IRQNO], regs[REG_ERRCODE]);
+ lldbg("edi:%08x esi:%08x ebp:%08x esp:%08x\n",
+ regs[REG_EDI], regs[REG_ESI], regs[REG_EBP], regs[REG_ESP]);
+ lldbg("ebx:%08x edx:%08x ecx:%08x eax:%08x\n",
+ regs[REG_EBX], regs[REG_EDX], regs[REG_ECX], regs[REG_EAX]);
+ lldbg("eip:%08x cs:%08x flg:%08x sp:%08x ss:%08x\n",
+ regs[REG_EIP], regs[REG_CS], regs[REG_EFLAGS], regs[REG_SP],
+ regs[REG_SS]);
+}
diff --git a/nuttx/arch/x86/src/qemu/Make.defs b/nuttx/arch/x86/src/qemu/Make.defs
index 6bcf102f9..4c3a83380 100755
--- a/nuttx/arch/x86/src/qemu/Make.defs
+++ b/nuttx/arch/x86/src/qemu/Make.defs
@@ -41,9 +41,9 @@ HEAD_ASRC = qemu_head.S
CMN_ASRCS = i486_utils.S
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \
- up_createstack.c up_mdelay.c up_udelay.c up_exit.c \
+ up_createstack.c up_mdelay.c up_udelay.c up_exit.c\
up_initialize.c up_initialstate.c up_interruptcontext.c \
- up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \
+ up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c up_regdump.c \
up_releasepending.c up_releasestack.c up_reprioritizertr.c \
up_sigdeliver.c up_schedulesigaction.c up_unblocktask.c \
up_usestack.c
diff --git a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
index 6f63f2382..0396753f7 100644
--- a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
+++ b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
@@ -120,17 +120,17 @@ up_fullcontextrestore:
/* Now restore the remaining registers */
- movl (4*REG_EDI)(%ebx), %edi
- movl (4*REG_ESI)(%ebx), %esi
- movl (4*REG_EBP)(%ebx), %ebp
- movl (4*REG_EDX)(%ebx), %edx
- movl (4*REG_ECX)(%ebx), %ecx
+ movl (4*REG_EDI)(%eax), %edi
+ movl (4*REG_ESI)(%eax), %esi
+ movl (4*REG_EBP)(%eax), %ebp
+ movl (4*REG_EDX)(%eax), %edx
+ movl (4*REG_ECX)(%eax), %ecx
/* Restore the segment registers */
- mov (4*REG_DS)(%ebx), %ds
- mov (4*REG_CS)(%ebx), %cs
- mov (4*REG_SS)(%ebx), %ss
+ mov (4*REG_DS)(%eax), %ds
+ mov (4*REG_CS)(%eax), %cs
+ mov (4*REG_SS)(%eax), %ss
/* Restore the correct value of EAX, EBX, and the EFLAGS then return */