diff --git a/arch/x86/src/i486/up_assert.c b/arch/x86/src/common/up_assert.c similarity index 88% rename from arch/x86/src/i486/up_assert.c rename to arch/x86/src/common/up_assert.c index 69a6fe92395de3519065d8621cb87822bf0afc2b..55ba376b4ea251cd385e135d9a477f46f368aade 100644 --- a/arch/x86/src/i486/up_assert.c +++ b/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> @@ -108,36 +108,6 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base) # define up_stackdump() #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/arch/x86/src/common/up_internal.h b/arch/x86/src/common/up_internal.h index 35b4e7b5ce965a35f752c7b8768c44048f584e0f..d8e25329e9d7eef4ca3526a67f49ad6f8e331163 100644 --- a/arch/x86/src/common/up_internal.h +++ b/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/arch/x86/src/i486/up_regdump.c b/arch/x86/src/i486/up_regdump.c new file mode 100644 index 0000000000000000000000000000000000000000..68d31cdce479e997338e091082396500c5e32d7c --- /dev/null +++ b/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/arch/x86/src/qemu/Make.defs b/arch/x86/src/qemu/Make.defs index 6bcf102f924bb07e1fa96cde7c55dae4a35e129f..4c3a83380d5b5d3c430d54ec3c6c1217a16278c8 100755 --- a/arch/x86/src/qemu/Make.defs +++ b/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/arch/x86/src/qemu/qemu_fullcontextrestore.S b/arch/x86/src/qemu/qemu_fullcontextrestore.S index 6f63f23820b5a7f7b7f68aa52585dea1d70974ad..0396753f7b6f1fa552631738c742772640ee86f8 100644 --- a/arch/x86/src/qemu/qemu_fullcontextrestore.S +++ b/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 */ diff --git a/configs/qemu-i486/ostest/ld.script b/configs/qemu-i486/ostest/ld.script index eb4fcd290c2e274ac406f10499d90ea8a50a98ff..5b3053f56c9e772f3b729c82e949348ac5a26047 100755 --- a/configs/qemu-i486/ostest/ld.script +++ b/configs/qemu-i486/ostest/ld.script @@ -49,7 +49,6 @@ SECTIONS .text ALIGN (0x1000) : { _srodata = ABSOLUTE(.); *(.rodata .rodata.*) - *(.rdata .rdata.*) *(.fixup) *(.gnu.warning) *(.glue_7)