arch: save user context in assert common code

This is the work continue with #7875

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2022-12-21 22:26:38 +08:00 committed by Xiang Xiao
parent cb958e5d69
commit 45394eb6dc
110 changed files with 654 additions and 1271 deletions

View file

@ -198,9 +198,9 @@ APIs Exported by Architecture-Specific Logic to NuttX
function should disable interrupts before performing scheduling
operations.
.. c:function:: void up_assert(FAR const char *filename, int linenum)
.. c:function:: void up_dump_register(FAR void *dumpregs)
Assertions may be handled in an
Register dump may be handled in an
architecture-specific way.
.. c:function:: void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)

View file

@ -82,7 +82,7 @@ int arm_start_handler(int irq, void *context, void *arg)
/* Dump registers so that we can see what is going to happen on return */
#if 0
arm_registerdump(tcb->xcp.regs);
up_dump_register(tcb->xcp.regs);
#endif
/* Then switch contexts. This instantiates the exception context of the

View file

@ -20,14 +20,12 @@
# Common ARM files
CMN_CSRCS += arm_allocateheap.c arm_assert.c
CMN_CSRCS += arm_createstack.c arm_exit.c
CMN_CSRCS += arm_initialize.c arm_lowputs.c
CMN_CSRCS += arm_modifyreg16.c arm_modifyreg32.c
CMN_CSRCS += arm_modifyreg8.c arm_nputs.c
CMN_CSRCS += arm_releasestack.c arm_saveusercontext.c
CMN_CSRCS += arm_stackframe.c arm_registerdump.c arm_getintstack.c
CMN_CSRCS += arm_vfork.c arm_switchcontext.c arm_usestack.c
CMN_CSRCS += arm_allocateheap.c arm_createstack.c arm_exit.c
CMN_CSRCS += arm_getintstack.c arm_initialize.c arm_lowputs.c
CMN_CSRCS += arm_modifyreg8.c arm_modifyreg16.c arm_modifyreg32.c
CMN_CSRCS += arm_nputs.c arm_releasestack.c arm_registerdump.c
CMN_CSRCS += arm_stackframe.c arm_saveusercontext.c
CMN_CSRCS += arm_switchcontext.c arm_usestack.c arm_vfork.c
ifneq ($(CONFIG_ALARM_ARCH),y)
ifneq ($(CONFIG_TIMER_ARCH),y)

View file

@ -1,74 +0,0 @@
/****************************************************************************
* arch/arm/src/common/arm_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "sched/sched.h"
#include "arm_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint8_t s_last_regs[XCPTCONTEXT_SIZE];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
struct tcb_s *rtcb = running_task();
board_autoled_on(LED_ASSERTION);
/* Update the xcp context */
if (CURRENT_REGS)
{
rtcb->xcp.regs = (uint32_t *)CURRENT_REGS;
}
else
{
up_saveusercontext(s_last_regs);
rtcb->xcp.regs = (uint32_t *)s_last_regs;
}
/* Dump the interrupt registers */
arm_registerdump(rtcb->xcp.regs);
}

View file

@ -480,8 +480,6 @@ size_t arm_stack_check(void *stackbase, size_t nbytes);
void arm_stack_color(void *stackbase, size_t nbytes);
#endif
void arm_registerdump(volatile uint32_t *regs);
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -51,11 +51,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: arm_registerdump
* Name: up_dump_register
****************************************************************************/
void arm_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
/* Dump the interrupt registers */
_alert("R0: %08" PRIx32 " R1: %08" PRIx32

View file

@ -43,12 +43,11 @@ endif
# Common C source files ( OS call up_xxx)
CMN_CSRCS = arm64_initialize.c arm64_initialstate.c arm64_boot.c
CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c
CMN_CSRCS += arm64_createstack.c arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c arm64_createstack.c
CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c arm64_switchcontext.c
CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c
CMN_CSRCS += arm64_sigdeliver.c arm64_systemreset.c
CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c
CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c arm64_systemreset.c
CMN_CSRCS += arm64_backtrace.c arm64_getintstack.c arm64_registerdump.c
# Common C source files ( hardware BSP )
CMN_CSRCS += arm64_mmu.c arm64_arch_timer.c arm64_cache.c

View file

@ -1,101 +0,0 @@
/****************************************************************************
* arch/arm64/src/common/arm64_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdint.h>
#include <nuttx/arch.h>
#include <debug.h>
#include "arm64_arch.h"
#include "arm64_internal.h"
#include "chip.h"
#ifdef CONFIG_ARCH_FPU
#include "arm64_fpu.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_dump_fatal
****************************************************************************/
void arm64_dump_fatal(struct regs_context *regs)
{
#ifdef CONFIG_SCHED_BACKTRACE
struct tcb_s *rtcb = (struct tcb_s *)regs->tpidr_el1;
/* Show back trace */
sched_dumpstack(rtcb->pid);
#endif
/* Dump the registers */
arm64_registerdump(regs);
}
void up_mdelay(unsigned int milliseconds)
{
volatile unsigned int i;
volatile unsigned int j;
for (i = 0; i < milliseconds; i++)
{
for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
{
}
}
}
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
struct tcb_s *rtcb = (struct tcb_s *)arch_get_current_tcb();
/* Update the xcp context */
if (CURRENT_REGS)
{
/* in interrupt */
rtcb->xcp.regs = (uint64_t *)CURRENT_REGS;
}
else
{
up_saveusercontext(rtcb->xcp.regs);
}
/* Dump the registers */
arm64_registerdump((struct regs_context *)rtcb->xcp.regs);
}

View file

@ -284,6 +284,42 @@ static void print_ec_cause(uint64_t esr)
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_mdelay
****************************************************************************/
void up_mdelay(unsigned int milliseconds)
{
volatile unsigned int i;
volatile unsigned int j;
for (i = 0; i < milliseconds; i++)
{
for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
{
}
}
}
/****************************************************************************
* Name: arm64_dump_fatal
****************************************************************************/
void arm64_dump_fatal(struct regs_context *regs)
{
#ifdef CONFIG_SCHED_BACKTRACE
struct tcb_s *rtcb = (struct tcb_s *)regs->tpidr_el1;
/* Show back trace */
sched_dumpstack(rtcb->pid);
#endif
/* Dump the registers */
up_dump_register(regs);
}
/****************************************************************************
* Name: arm64_fatal_error
*

View file

@ -347,8 +347,6 @@ size_t arm64_stack_check(void *stackbase, size_t nbytes);
void arm64_stack_color(void *stackbase, size_t nbytes);
#endif
void arm64_registerdump(struct regs_context * regs);
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -53,11 +53,14 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: arm64_registerdump
* Name: up_dump_register
****************************************************************************/
void arm64_registerdump(struct regs_context * regs)
void up_dump_register(void *dumpregs)
{
volatile struct regs_context *regs = dumpregs ? dumpregs :
(struct regs_context *)CURRENT_REGS;
_alert("stack = %p\n", regs);
_alert("x0: 0x%-16"PRIx64" x1: 0x%"PRIx64"\n",
regs->regs[REG_X0], regs->regs[REG_X1]);

View file

@ -82,6 +82,8 @@
# define REG_PC2 37
#endif
#define XCPTCONTEXT_SIZE XCPTCONTEXT_REGS
/****************************************************************************
* Public Types
****************************************************************************/

View file

@ -82,6 +82,7 @@
#define INTCONTEXT_REGS 8 /* r8-r12, lr, pc, sr */
#define XCPTCONTEXT_REGS 17 /* Plus r0-r7, sp */
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
/****************************************************************************
* Public Types

View file

@ -24,14 +24,12 @@ HEAD_ASRC = avr_nommuhead.S
# Common AVR/AVR32 files
CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_doswitch.S
CMN_CSRCS = avr_assert.c avr_allocateheap.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_mdelay.c avr_udelay.c avr_exit.c avr_idle.c
CMN_CSRCS += avr_initialize.c avr_initialstate.c
CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_doswitch.S avr_saveusercontext.S
CMN_CSRCS = avr_allocateheap.c avr_copystate.c avr_createstack.c avr_exit.c
CMN_CSRCS += avr_mdelay.c avr_udelay.c avr_initialize.c avr_initialstate.c avr_idle.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_stackframe.c
CMN_CSRCS += avr_switchcontext.c avr_usestack.c avr_doirq.c avr_nputs.c
CMN_CSRCS += avr_registerdump.c avr_getintstack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_stackframe.c avr_switchcontext.c
CMN_CSRCS += avr_usestack.c avr_doirq.c avr_nputs.c avr_registerdump.c avr_getintstack.c
# Required AT32UC3 files

View file

@ -24,15 +24,14 @@ HEAD_ASRC = at90usb_head.S
# Common AVR files
CMN_ASRCS = avr_doswitch.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c
CMN_CSRCS += avr_registerdump.c avr_getintstack.c
CMN_ASRCS = avr_doswitch.S avr_saveusercontext.S
CMN_CSRCS = avr_allocateheap.c avr_copystate.c avr_createstack.c
CMN_CSRCS += avr_doirq.c avr_exit.c avr_idle.c avr_irq.c avr_udelay.c
CMN_CSRCS += avr_initialize.c avr_initialstate.c avr_lowputs.c avr_mdelay.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c avr_registerdump.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_getintstack.c
CMN_CSRCS += avr_stackframe.c avr_switchcontext.c avr_usestack.c
# Configuration-dependent common files

View file

@ -24,15 +24,14 @@ HEAD_ASRC = atmega_head.S
# Common AVR files
CMN_ASRCS = avr_doswitch.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_ASRCS = avr_doswitch.S avr_saveusercontext.S
CMN_CSRCS = avr_allocateheap.c avr_copystate.c avr_createstack.c
CMN_CSRCS += avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c avr_mdelay.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c avr_registerdump.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_getintstack.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c
CMN_CSRCS += avr_registerdump.c avr_getintstack.c
# Configuration-dependent common files

View file

@ -48,11 +48,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: avr_registerdump
* Name: up_dump_register
****************************************************************************/
void avr_registerdump(volatile uint8_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint8_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Are user registers available from interrupt processing? */
if (regs)
@ -98,4 +100,3 @@ void avr_registerdump(volatile uint8_t *regs)
#endif
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/risc-v/src/common/riscv_assert.c
/************************************************************************************
* arch/avr/src/avr/avr_saveusercontext.S
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -16,61 +16,55 @@
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
************************************************************************************/
/****************************************************************************
/************************************************************************************
* Included Files
****************************************************************************/
************************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdint.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include "excptmacros.h"
#include <arch/board/board.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
#include "sched/sched.h"
#include "riscv_internal.h"
/************************************************************************************
* Public Symbols
************************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
.file "avr_saveusercontext.S"
/****************************************************************************
* Private Data
****************************************************************************/
/************************************************************************************
* Macros
************************************************************************************/
static uint8_t s_last_regs[XCPTCONTEXT_SIZE];
/****************************************************************************
/************************************************************************************
* Public Functions
****************************************************************************/
************************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_saveusercontext
*
* Description:
* Save the current thread context
*
****************************************************************************/
void up_assert(void)
{
struct tcb_s *rtcb = running_task();
.text
.globl up_saveusercontext
.func up_saveusercontext
up_saveusercontext:
/* Use X [r26:r27] to reference the save structure. (X is Call-used) */
board_autoled_on(LED_ASSERTION);
movw r26, r24
/* Update the xcp context */
/* Save the context to saveregs */
if (CURRENT_REGS)
{
rtcb->xcp.regs = (uintptr_t *)CURRENT_REGS;
}
else
{
up_saveusercontext(s_last_regs);
rtcb->xcp.regs = (uintptr_t *)s_last_regs;
}
USER_SAVE
riscv_registerdump(rtcb->xcp.regs);
}
.endfunc
.end

View file

@ -48,11 +48,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: avr_registerdump
* Name: up_dump_register
****************************************************************************/
void avr_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Are user registers available from interrupt processing? */
if (regs)
@ -74,4 +76,3 @@ void avr_registerdump(volatile uint32_t *regs)
_alert("SR: %08x\n", regs[REG_SR]);
}
}

View file

@ -0,0 +1,86 @@
/************************************************************************************
* arch/avr/src/avr32/avr_saveusercontext.S
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <arch/irq.h>
#include <arch/avr32/avr32.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Symbols
************************************************************************************/
.file "avr_saveusercontext.S"
/************************************************************************************
* Macros
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Name: up_saveusercontext
*
* Description:
* Save the current thread context
*
****************************************************************************/
.text
.globl up_saveusercontext
.type up_saveusercontext, @function
up_saveusercontext:
/* "Pickle" the current thread context in the saveregs "can." r12=saveregs. */
/* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
/* ^r12 */
/* Sample SR and set r12 to just after the LR storage location. */
/* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
/* ^r12 */
mfsr r10, AVR32_SR
sub r12, -4*(REG_LR+1)
/* Then "push" PC=LR, LR, SR, and SP as they are on entry. */
/* xx xx xx xx xx xx xx xx SP SR PC LR xx xx xx xx xx */
/* ^r12 */
st.w --r12, lr
st.w --r12, lr
st.w --r12, r10
st.w --r12, sp
/* Save the preserved/static registers, r0-r7. There is no reason to save the */
/* scratch/volatile registers, r8-r12, in this context. */
/* 07 06 05 04 03 02 01 00 SP SR PC LR xx xx xx xx xx */
/* ^r12 */
stm --r12, r0-r7
.size up_saveusercontext, .-up_saveusercontext
.end

View file

@ -119,11 +119,6 @@ void weak_function avr_dma_initialize(void);
void avr_sigdeliver(void);
void avr_lowputc(char ch);
void avr_lowputs(const char *str);
#ifdef CONFIG_ARCH_FAMILY_AVR32
void avr_registerdump(volatile uint32_t *regs);
#else
void avr_registerdump(volatile uint8_t *regs);
#endif
/* Defined in common/avr_allocateheap.c or chip/xxx_allocateheap.c */

View file

@ -1,63 +0,0 @@
/****************************************************************************
* arch/ceva/src/common/ceva_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "ceva_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint32_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
volatile uint32_t *regs = CURRENT_REGS;
/* Are user registers available from interrupt processing? */
if (regs == NULL)
{
/* No.. capture user registers by hand */
up_saveusercontext(s_last_regs);
regs = s_last_regs;
}
ceva_registerdump(regs);
}

View file

@ -305,8 +305,6 @@ size_t ceva_stack_check(uintptr_t alloc, size_t size);
void ceva_stack_color(void *stackbase, size_t nbytes);
#endif
void ceva_registerdump(volatile uint32_t *regs);
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -45,11 +45,12 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: ceva_registerdump
* Name: up_dump_register
****************************************************************************/
void ceva_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
int rx;
/* Dump the interrupt registers */

View file

@ -195,8 +195,6 @@ void hc_usbuninitialize(void);
# define hc_usbuninitialize()
#endif
void hc_registerdump(volatile uint8_t *regs);
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_HC_SRC_COMMON_UP_INTERNAL_H */

View file

@ -20,14 +20,14 @@
HEAD_ASRC = m9s12_vectors.S
CMN_CSRCS = hc_allocateheap.c hc_copystate.c hc_createstack.c
CMN_CSRCS += hc_doirq.c hc_exit.c hc_idle.c hc_initialize.c
CMN_CSRCS = hc_allocateheap.c hc_copystate.c hc_createstack.c hc_doirq.c
CMN_CSRCS += hc_exit.c hc_getintstack.c hc_idle.c hc_initialize.c
CMN_CSRCS += hc_mdelay.c hc_modifyreg16.c hc_modifyreg32.c hc_modifyreg8.c
CMN_CSRCS += hc_nputs.c hc_releasestack.c hc_getintstack.c
CMN_CSRCS += hc_stackframe.c hc_udelay.c hc_switchcontext.c hc_usestack.c
CMN_CSRCS += hc_nputs.c hc_releasestack.c hc_stackframe.c hc_switchcontext.c
CMN_CSRCS += hc_udelay.c hc_usestack.c
CHIP_ASRCS = m9s12_start.S m9s12_lowputc.S m9s12_saveusercontext.S
CHIP_CSRCS = m9s12_assert.c m9s12_gpio.c m9s12_gpioirq.c m9s12_initialstate.c
CHIP_CSRCS = m9s12_gpio.c m9s12_gpioirq.c m9s12_initialstate.c
CHIP_CSRCS += m9s12_irq.c m9s12_serial.c m9s12_registerdump.c
ifneq ($(CONFIG_SCHED_TICKLESS),y)

View file

@ -1,70 +0,0 @@
/****************************************************************************
* arch/hc/src/m9s12/m9s12_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "sched/sched.h"
#include "hc_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint8_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
volatile uint8_t *regs = g_current_regs;
board_autoled_on(LED_ASSERTION);
/* Are user registers available from interrupt processing? */
if (regs == NULL)
{
/* No.. capture user registers by hand */
up_saveusercontext(s_last_regs);
regs = s_last_regs;
}
hc_registerdump(regs);
}

View file

@ -47,11 +47,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: hc_registerdump
* Name: up_dump_register
****************************************************************************/
void hc_registerdump(volatile uint8_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint8_t *regs = dumpregs ? dumpregs : (uint8_t *)g_current_regs;
_alert("A:%02x B:%02x X:%02x%02x Y:%02x%02x PC:%02x%02x CCR:%02x\n",
regs[REG_A], regs[REG_B], regs[REG_XH], regs[REG_XL],
regs[REG_YH], regs[REG_YL], regs[REG_PCH], regs[REG_PCL],

View file

@ -136,7 +136,12 @@
/* Context switching system calls *******************************************/
/* SYS call 0: (not used) */
/* SYS call 0:
*
* int up_saveusercontext(void *saveregs);
*/
#define SYS_save_context (0)
/* SYS call 1:
*

View file

@ -176,10 +176,6 @@ void mips_copystate(uint32_t *dest, uint32_t *src);
void mips_lowputs(const char *str);
/* Debug */
void mips_registerdump(volatile uint32_t *regs);
/* Common MIPS32 functions defined in arch/mips/src/MIPS32 */
/* IRQs */

View file

@ -48,11 +48,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: mips_registerdump
* Name: up_dump_register
****************************************************************************/
void mips_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
/* Are user registers available from interrupt processing? */
if (regs)

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/avr/src/common/avr_assert.c
* arch/mips/src/mips32/mips_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -23,22 +23,28 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "avr_internal.h"
#include <arch/syscall.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
void up_assert(void)
int up_saveusercontext(void *saveregs)
{
board_autoled_on(LED_ASSERTION);
avr_registerdump(g_current_regs);
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}

View file

@ -109,13 +109,33 @@ int mips_swint0(int irq, void *context, void *arg)
#ifdef CONFIG_DEBUG_SYSCALL_INFO
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_R4]);
mips_registerdump(regs);
up_dump_register(regs);
#endif
/* Handle the SWInt according to the command in $4 */
switch (regs[REG_R4])
{
/* R4=SYS_save_context: This is a save context command:
*
* int up_saveusercontext(void *saveregs);
*
* At this point, the following values are saved in context:
*
* R4 = SYS_save_context
* R5 = saveregs
*
* In this case, we simply need to copy the current registers to the
* save register space references in the saved R1 and return.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_A1] != 0);
mips_copystate((uint32_t *)regs[REG_A1], regs);
}
break;
/* R4=SYS_restore_context: This a restore context command:
*
* void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
@ -256,7 +276,7 @@ int mips_swint0(int irq, void *context, void *arg)
if (regs != CURRENT_REGS)
{
svcinfo("SWInt Return: Context switch!\n");
mips_registerdump(CURRENT_REGS);
up_dump_register(CURRENT_REGS);
}
else
{

View file

@ -25,15 +25,14 @@ HEAD_ASRC = pic32mx_head.S
# Common MIPS files
CMN_ASRCS = mips_syscall0.S vfork.S
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
CMN_CSRCS += mips_registerdump.c mips_getintstack.c
CMN_CSRCS = mips_allocateheap.c mips_copystate.c mips_createstack.c
CMN_CSRCS += mips_doirq.c mips_exit.c mips_getintstack.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c mips_mdelay.c
CMN_CSRCS += mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c mips_registerdump.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c mips_swint0.c
CMN_CSRCS += mips_stackframe.c mips_switchcontext.c mips_saveusercontext.c
CMN_CSRCS += mips_udelay.c mips_usestack.c mips_vfork.c
# Configuration dependent common files

View file

@ -25,15 +25,14 @@ HEAD_ASRC = pic32mz_head.S
# Common MIPS files
CMN_ASRCS = mips_syscall0.S vfork.S mips_cache.S
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
CMN_CSRCS += mips_registerdump.c mips_getintstack.c
CMN_CSRCS = mips_allocateheap.c mips_copystate.c mips_createstack.c
CMN_CSRCS += mips_doirq.c mips_exit.c mips_getintstack.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c mips_mdelay.c
CMN_CSRCS += mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c mips_registerdump.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c mips_swint0.c
CMN_CSRCS += mips_stackframe.c mips_switchcontext.c mips_saveusercontext.c
CMN_CSRCS += mips_udelay.c mips_usestack.c mips_vfork.c
# Configuration dependent common files

View file

@ -61,7 +61,12 @@
/* Context switching system calls *******************************************/
/* SYS call 0: (not used) */
/* SYS call 0:
*
* int up_saveusercontext(void *saveregs);
*/
#define SYS_save_context (0)
/* SYS call 1:
*

View file

@ -27,11 +27,9 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c
CHIP_ASRCS = lm32_syscall.S
CHIP_CSRCS = lm32_allocateheap.c lm32_assert.c
CHIP_CSRCS += lm32_copystate.c lm32_createstack.c lm32_decodeirq.c
CHIP_CSRCS += lm32_doirq.c lm32_registerdump.c lm32_exit.c lm32_idle.c
CHIP_CSRCS += lm32_initialstate.c lm32_irq.c
CHIP_CSRCS += lm32_releasestack.c lm32_stackframe.c lm32_swint.c
CHIP_CSRCS += lm32_switchcontext.c
CHIP_CSRCS += lm32_schedulesigaction.c lm32_sigdeliver.c
CHIP_CSRCS += lm32_flushcache.c lm32_usetack.c
CHIP_CSRCS = lm32_allocateheap.c lm32_copystate.c lm32_createstack.c
CHIP_CSRCS += lm32_decodeirq.c lm32_doirq.c lm32_exit.c lm32_flushcache.c
CHIP_CSRCS += lm32_idle.c lm32_initialstate.c lm32_irq.c lm32_usetack.c
CHIP_CSRCS += lm32_registerdump.c lm32_releasestack.c lm32_swint.c
CHIP_CSRCS += lm32_stackframe.c lm32_switchcontext.c lm32_sigdeliver.c
CHIP_CSRCS += lm32_schedulesigaction.c lm32_saveusercontext.c

View file

@ -126,9 +126,5 @@ void lm32_sigdeliver(void);
void lm32_flush_dcache(void);
void lm32_flush_icache(void);
/* Debug ********************************************************************/
void lm32_registerdump(volatile uint32_t *regs);
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_MISOC_SRC_LM32_LM32_H */

View file

@ -47,11 +47,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: lm32_registerdump
* Name: up_dump_register
****************************************************************************/
void lm32_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Are user registers available from interrupt processing? */
if (regs)
@ -85,4 +87,3 @@ void lm32_registerdump(volatile uint32_t *regs)
_alert(" IE:%08x\n", regs[REG_X32_NDX]);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_assert.c
* arch/misoc/src/lm32/lm32_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -24,22 +24,27 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "lm32.h"
#include <arch/syscall.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
void up_assert(void)
int up_saveusercontext(void *saveregs)
{
board_autoled_on(LED_ASSERTION);
lm32_registerdump(g_current_regs);
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}

View file

@ -106,13 +106,33 @@ int lm32_swint(int irq, void *context, void *arg)
#ifdef CONFIG_DEBUG_SYSCALL_INFO
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_A0]);
lm32_registerdump(regs);
up_dump_register(regs);
#endif
/* Handle the SWInt according to the command in $a0 */
switch (regs[REG_A0])
{
/* A0=SYS_save_context: This is a save context command:
*
* int up_saveusercontext(void *saveregs);
*
* At this point, the following values are saved in context:
*
* A0 = SYS_save_context
* A1 = saveregs
*
* In this case, we simply need to copy the current registers to the
* save register space references in the saved R1 and return.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_A1] != 0);
lm32_copystate((uint32_t *)regs[REG_A1], regs);
}
break;
/* A0=SYS_restore_context: This a restore context command:
*
* void up_fullcontextrestore(uint32_t *restoreregs)
@ -254,7 +274,7 @@ int lm32_swint(int irq, void *context, void *arg)
if (regs != g_current_regs)
{
svcinfo("SWInt Return: Context switch!\n");
lm32_registerdump(g_current_regs);
up_dump_register(g_current_regs);
}
else
{

View file

@ -27,11 +27,10 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c
CHIP_ASRCS = minerva_syscall.S
CHIP_CSRCS = minerva_allocateheap.c minerva_assert.c
CHIP_CSRCS += minerva_copystate.c minerva_createstack.c minerva_decodeirq.c
CHIP_CSRCS += minerva_doirq.c minerva_registerdump.c minerva_exit.c minerva_idle.c
CHIP_CSRCS += minerva_initialstate.c minerva_irq.c
CHIP_CSRCS += minerva_releasestack.c minerva_stackframe.c minerva_swint.c
CHIP_CSRCS += minerva_switchcontext.c
CHIP_CSRCS += minerva_schedulesigaction.c minerva_sigdeliver.c
CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c minerva_usetack.c
CHIP_CSRCS = minerva_allocateheap.c minerva_copystate.c minerva_createstack.c
CHIP_CSRCS += minerva_decodeirq.c minerva_doirq.c minerva_doexceptions.c
CHIP_CSRCS += minerva_exit.c minerva_flushcache.c minerva_idle.c minerva_irq.c
CHIP_CSRCS += minerva_initialstate.c minerva_registerdump.c minerva_releasestack.c
CHIP_CSRCS += minerva_stackframe.c minerva_swint.c minerva_saveusercontext.c
CHIP_CSRCS += minerva_switchcontext.c minerva_schedulesigaction.c minerva_sigdeliver.c
CHIP_CSRCS += minerva_usetack.c

View file

@ -125,9 +125,5 @@ void minerva_sigdeliver(void);
void minerva_flush_dcache(void);
void minerva_flush_icache(void);
/* Debug ********************************************************************/
void mineva_registerdump(volatile uint32_t *regs);
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_MISOC_SRC_MINERVA_MINERVA_H */

View file

@ -47,11 +47,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: mineva_registerdump
* Name: up_dump_register
****************************************************************************/
void mineva_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Are user registers available from interrupt processing? */
if (regs)
@ -84,4 +86,3 @@ void mineva_registerdump(volatile uint32_t *regs)
_alert(" IE:%08x\n", regs[REG_CSR_MSTATUS]);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_assert.c
* arch/misoc/src/minerva/minerva_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -24,22 +24,27 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "minerva.h"
#include <arch/syscall.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
void up_assert(void)
int up_saveusercontext(void *saveregs)
{
board_autoled_on(LED_ASSERTION);
mineva_registerdump(g_current_regs);
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}

View file

@ -109,6 +109,21 @@ int minerva_swint(int irq, void *context, void *arg)
switch (regs[REG_A0])
{
/* A0=SYS_save_context: This a save context command: void
* int up_saveusercontext(void *saveregs);
* At this point, the following values are saved in context: A0 =
* SYS_save_context A1 = saveregs A2 = saveregs. In this case, we
* save the context registers to the save register area referenced by
* the saved contents of R5.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_A1] != 0);
minerva_copystate((uint32_t *) regs[REG_A1], regs);
}
break;
/* A0=SYS_restore_context: This a restore context command: void
* up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; At
* this point, the following values are saved in context: A0 =

View file

@ -1,70 +0,0 @@
/****************************************************************************
* arch/or1k/src/common/or1k_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "sched/sched.h"
#include "or1k_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint32_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
volatile uint32_t *regs = CURRENT_REGS;
board_autoled_on(LED_ASSERTION);
/* Are user registers available from interrupt processing? */
if (regs == NULL)
{
/* No.. capture user registers by hand */
up_saveusercontext(s_last_regs);
regs = s_last_regs;
}
or1k_registerdump(regs);
}

View file

@ -323,8 +323,6 @@ size_t or1k_stack_check(uintptr_t alloc, size_t size);
void or1k_stack_color(void *stackbase, size_t nbytes);
#endif
void or1k_registerdump(volatile uint32_t *regs);
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -46,11 +46,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: or1k_registerdump
* Name: up_dump_register
****************************************************************************/
void or1k_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
/* Dump the interrupt registers */
_alert("R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",

View file

@ -34,7 +34,6 @@ CMN_CSRCS = or1k_initialize.c \
or1k_copyfullstate.c \
or1k_registerdump.c \
or1k_getintstack.c \
or1k_assert.c \
or1k_exit.c \
or1k_udelay.c \
or1k_mdelay.c \

View file

@ -1,65 +0,0 @@
/****************************************************************************
* arch/renesas/src/common/renesas_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <arch/board/board.h>
#include "renesas_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint32_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
volatile uint32_t *regs = g_current_regs;
board_autoled_on(LED_ASSERTION);
/* Are user registers available from interrupt processing? */
if (regs == NULL)
{
/* No.. capture user registers by hand */
up_saveusercontext(s_last_regs);
regs = s_last_regs;
}
renesas_registerdump(regs);
}

View file

@ -200,9 +200,5 @@ void renesas_usbuninitialize(void);
# define renesas_usbuninitialize()
#endif
/* Defined in chip-specific logic */
void renesas_registerdump(volatile uint32_t *regs);
#endif /* __ASSEMBLY__ */
#endif /* ___ARCH_RENESAS_SRC_COMMON_UP_INTERNAL_H */

View file

@ -20,11 +20,11 @@
HEAD_ASRC = m16c_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasestack.c renesas_getintstack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CMN_CSRCS = renesas_allocateheap.c renesas_createstack.c renesas_doirq.c
CMN_CSRCS += renesas_exit.c renesas_getintstack.c renesas_idle.c
CMN_CSRCS += renesas_initialize.c renesas_lowputs.c renesas_mdelay.c
CMN_CSRCS += renesas_nputs.c renesas_releasestack.c renesas_stackframe.c
CMN_CSRCS += renesas_switchcontext.c renesas_udelay.c renesas_usestack.c
CHIP_ASRCS = m16c_vectors.S
CHIP_CSRCS = m16c_initialstate.c m16c_copystate.c m16c_lowputc.c m16c_irq.c

View file

@ -48,12 +48,12 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: renesas_registerdump
* Name: up_dump_register
****************************************************************************/
void renesas_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
uint8_t *ptr = (uint8_t *)regs;
volatile uint8_t *ptr = dumpregs ? dumpregs : (uint8_t *)g_current_regs;
/* Dump the interrupt registers */

View file

@ -20,11 +20,11 @@
HEAD_ASRC = rx65n_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasestack.c renesas_getintstack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CMN_CSRCS = renesas_allocateheap.c renesas_createstack.c renesas_doirq.c
CMN_CSRCS += renesas_exit.c renesas_getintstack.c renesas_initialize.c
CMN_CSRCS += renesas_idle.c renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasestack.c renesas_switchcontext.c renesas_stackframe.c
CMN_CSRCS += renesas_udelay.c renesas_usestack.c
CHIP_ASRCS = rx65n_vector.S
CHIP_CSRCS = rx65n_lowputc.c rx65n_serial.c rx65n_copystate.c rx65n_irq.c

View file

@ -49,11 +49,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: rx65n_registerdump
* Name: up_dump_register
****************************************************************************/
void renesas_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Dump the interrupt registers */
_alert("PC: %08" PRIx32 " PSW=%08" PRIx32 "\n",

View file

@ -20,13 +20,12 @@
HEAD_ASRC = sh1_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_initialstate.c renesas_lowputs.c
CMN_CSRCS = renesas_allocateheap.c renesas_createstack.c renesas_doirq.c
CMN_CSRCS += renesas_exit.c renesas_getintstack.c renesas_initialize.c
CMN_CSRCS += renesas_idle.c renesas_initialstate.c renesas_lowputs.c
CMN_CSRCS += renesas_mdelay.c renesas_nputs.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_getintstack.c
CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c
CMN_CSRCS += renesas_switchcontext.c renesas_usestack.c
CMN_CSRCS += renesas_stackframe.c renesas_switchcontext.c renesas_udelay.c
CMN_CSRCS += renesas_usestack.c sh1_schedulesigaction.c sh1_sigdeliver.c
CHIP_ASRCS = sh1_vector.S sh1_saveusercontext.S
CHIP_CSRCS = sh1_lowputc.c sh1_irq.c sh1_serial.c sh1_initialstate.c

View file

@ -46,11 +46,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: renesas_registerdump
* Name: up_dump_register
****************************************************************************/
void renesas_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
/* Dump the interrupt registers */
_alert("PC: %08x SR=%08x\n",
@ -67,4 +69,3 @@ void renesas_registerdump(volatile uint32_t *regs)
regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
}

View file

@ -27,14 +27,13 @@ CMN_ASRCS += riscv_vectors.S riscv_exception_common.S riscv_mhartid.S
# Specify C code within the common directory to be included
CMN_CSRCS += riscv_initialize.c riscv_swint.c riscv_mtimer.c
CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_exit.c
CMN_CSRCS += riscv_assert.c riscv_copystate.c riscv_initialstate.c
CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.c
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
CMN_CSRCS += riscv_sigdeliver.c riscv_switchcontext.c riscv_usestack.c
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c
CMN_CSRCS += riscv_exception.c riscv_getnewintctx.c riscv_doirq.c
CMN_CSRCS += riscv_saveusercontext.c riscv_getintstack.c riscv_registerdump.c
CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_copystate.c
CMN_CSRCS += riscv_cpuidlestack.c riscv_doirq.c riscv_exit.c riscv_exception.c
CMN_CSRCS += riscv_getnewintctx.c riscv_getintstack.c riscv_initialstate.c
CMN_CSRCS += riscv_idle.c riscv_modifyreg32.c riscv_nputs.c riscv_releasestack.c
CMN_CSRCS += riscv_registerdump.c riscv_stackframe.c riscv_schedulesigaction.c
CMN_CSRCS += riscv_sigdeliver.c riscv_switchcontext.c riscv_saveusercontext.c
CMN_CSRCS += riscv_usestack.c riscv_tcbinfo.c
ifneq ($(CONFIG_ALARM_ARCH),y)
ifneq ($(CONFIG_TIMER_ARCH),y)

View file

@ -277,8 +277,6 @@ size_t riscv_stack_check(uintptr_t alloc, size_t size);
void riscv_stack_color(void *stackbase, size_t nbytes);
#endif
void riscv_registerdump(volatile uintptr_t *regs);
#ifdef CONFIG_SMP
void riscv_cpu_boot(int cpu);
int riscv_pause_handler(int irq, void *c, void *arg);

View file

@ -47,11 +47,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: riscv_registerdump
* Name: up_dump_register
****************************************************************************/
void riscv_registerdump(volatile uintptr_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uintptr_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
/* Are user registers available from interrupt processing? */
_alert("EPC: %" PRIxREG "\n", regs[REG_EPC]);
@ -86,4 +88,3 @@ void riscv_registerdump(volatile uintptr_t *regs)
regs[REG_SP], regs[REG_FP], regs[REG_TP], regs[REG_RA]);
#endif
}

View file

@ -125,7 +125,7 @@ int riscv_swint(int irq, void *context, void *arg)
#ifdef CONFIG_DEBUG_SYSCALL_INFO
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_A0]);
riscv_registerdump(regs);
up_dump_register(regs);
#endif
/* Handle the SWInt according to the command in $a0 */
@ -513,7 +513,7 @@ int riscv_swint(int irq, void *context, void *arg)
if (regs != CURRENT_REGS)
{
svcinfo("SWInt Return: Context switch!\n");
riscv_registerdump(CURRENT_REGS);
up_dump_register(CURRENT_REGS);
}
else
{

View file

@ -60,7 +60,8 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sim_initialize.c sim_idle.c sim_doirq.c sim_initialstate.c
CSRCS += sim_createstack.c sim_usestack.c sim_releasestack.c sim_stackframe.c
CSRCS += sim_exit.c sim_schedulesigaction.c sim_switchcontext.c sim_heap.c
CSRCS += sim_uart.c sim_assert.c sim_copyfullstate.c sim_sigdeliver.c
CSRCS += sim_uart.c sim_copyfullstate.c sim_sigdeliver.c
CSRCS += sim_registerdump.c sim_saveusercontext.c
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
CSRCS += sim_backtrace.c

View file

@ -1,84 +0,0 @@
/****************************************************************************
* arch/sim/src/sim/sim_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched/sched.h>
#include <debug.h>
#include <stdlib.h>
#include <nuttx/syslog/syslog.h>
#ifdef CONFIG_BOARD_CRASHDUMP
# include <nuttx/board.h>
#endif
#include "sim_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
*
* Description:
* Called to terminate the simulation abnormally in the event of a failed
* assertion.
*
****************************************************************************/
void up_assert(void)
{
struct tcb_s *rtcb = running_task();
if (CURRENT_REGS || is_idle_task(rtcb))
{
/* Exit the simulation */
host_abort(EXIT_FAILURE);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/z80/src/common/z80_assert.c
* arch/sim/src/sim/sim_registerdump.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -24,17 +24,18 @@
#include <nuttx/config.h>
#include "z80_internal.h"
#include <nuttx/arch.h>
#include "sim_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_dump_register
****************************************************************************/
void up_assert(void)
void up_dump_register(void *dumpregs)
{
Z80_REGISTER_DUMP();
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/mips/src/mips32/mips_assert.c
* arch/sim/src/sim/sim_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -24,22 +24,29 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/arch.h>
#include <arch/board/board.h>
#include "mips_internal.h"
#include "sim_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Return:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
void up_assert(void)
int up_saveusercontext(void *saveregs)
{
board_autoled_on(LED_ASSERTION);
mips_registerdump(CURRENT_REGS);
return sim_saveusercontext(saveregs);
}

View file

@ -95,10 +95,11 @@
#define REG_R33 (1) /* R33 */
#define REG_R34 (2) /* R34 */
#define REG_R35 (18) /* R35 */
#define REG_R36 (19) /* R36 */
#define REG_R35 (18) /* R35 */
#define REG_R36 (19) /* R36 */
#define XCPTCONTEXT_REGS (52)
#define XCPTCONTEXT_REGS (68)
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
/* Alternate register names *************************************************/
/* %psr: processor status register */

View file

@ -61,7 +61,12 @@
/* Context switching system calls *******************************************/
/* SYS call 0: (not used) */
/* SYS call 0:
*
* int up_saveusercontext(void *saveregs);
*/
#define SYS_save_context (0)
/* SYS call 1:
*

View file

@ -20,12 +20,12 @@
# Common Sparc files (arch/sparc/src/common)
CMN_CSRCS += sparc_allocateheap.c sparc_assert.c
CMN_CSRCS += sparc_createstack.c sparc_exit.c sparc_idle.c sparc_initialize.c
CMN_CSRCS += sparc_lowputs.c sparc_mdelay.c
CMN_CSRCS += sparc_modifyreg8.c sparc_modifyreg16.c sparc_modifyreg32.c
CMN_CSRCS += sparc_nputs.c sparc_releasestack.c sparc_getintstack.c
CMN_CSRCS += sparc_stackframe.c sparc_udelay.c sparc_usestack.c
CMN_CSRCS += sparc_allocateheap.c sparc_createstack.c sparc_exit.c
CMN_CSRCS += sparc_getintstack.c sparc_idle.c sparc_initialize.c
CMN_CSRCS += sparc_lowputs.c sparc_mdelay.c sparc_modifyreg8.c
CMN_CSRCS += sparc_modifyreg16.c sparc_modifyreg32.c sparc_nputs.c
CMN_CSRCS += sparc_releasestack.c sparc_stackframe.c
CMN_CSRCS += sparc_udelay.c sparc_usestack.c
# Configuration-dependent common files

View file

@ -1,40 +0,0 @@
/****************************************************************************
* arch/sparc/src/common/sparc_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "sparc_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
sparc_registerdump(CURRENT_REGS);
}

View file

@ -183,10 +183,6 @@ void sparc_copystate(uint32_t *dest, uint32_t *src);
void sparc_lowputs(const char *str);
/* Debug */
void sparc_registerdump(volatile uint32_t *regs);
/* Software interrupt 0 handler */
int sparc_swint0(int irq, void *context, void *arg);

View file

@ -25,6 +25,6 @@ include common/Make.defs
CMN_ASRCS += sparc_v8_syscall.S
CMN_CSRCS += sparc_v8_copystate.c sparc_v8_doirq.c
CMN_CSRCS += sparc_v8_initialstate.c sparc_v8_irq.c
CMN_CSRCS += sparc_v8_schedulesigaction.c
CMN_CSRCS += sparc_v8_schedulesigaction.c sparc_v8_saveusercontext.c
CMN_CSRCS += sparc_v8_sigdeliver.c sparc_v8_swint1.c sparc_v8_systemreset.c
CMN_CSRCS += sparc_v8_switchcontext.c sparc_v8_registerdump.c

View file

@ -47,11 +47,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: sparc_registerdump
* Name: up_dump_register
****************************************************************************/
void sparc_registerdump(volatile uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : CURRENT_REGS;
/* Are user registers available from interrupt processing? */
if (regs)

View file

@ -0,0 +1,50 @@
/****************************************************************************
* arch/sparc/src/sparc_v8/sparc_v8_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <arch/syscall.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
int up_saveusercontext(void *saveregs)
{
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}

View file

@ -82,13 +82,33 @@ int sparc_swint1(int irq, void *context, void *arg)
#ifdef CONFIG_DEBUG_SYSCALL_INFO
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_I0]);
up_registerdump(regs);
up_dump_register(regs);
#endif
/* Handle the SWInt according to the command in $4 */
switch (regs[REG_I0])
{
/* A0=SYS_save_context: This is a save context command:
*
* int up_saveusercontext(void *saveregs);
*
* At this point, the following values are saved in context:
*
* A0 = SYS_save_context
* A1 = saveregs
*
* In this case, we simply need to copy the current registers to the
* save register space references in the saved R1 and return.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_I1] != 0);
trap_flush_task((uint32_t *)regs[REG_I1], regs);
}
break;
/* A0=SYS_restore_context: This a restore context command:
*
* void sparc_fullcontextrestore
@ -217,7 +237,7 @@ int sparc_swint1(int irq, void *context, void *arg)
if (regs != CURRENT_REGS)
{
svcinfo("SWInt Return: Context switch!\n");
up_registerdump(CURRENT_REGS);
up_dump_register(CURRENT_REGS);
}
else
{

View file

@ -1,68 +0,0 @@
/****************************************************************************
* arch/x86/src/common/x86_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "sched/sched.h"
#include "x86_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint32_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
board_autoled_on(LED_ASSERTION);
if (g_current_regs != NULL)
{
x86_registerdump((uint32_t *)g_current_regs);
}
else
{
/* Capture and dump user registers by hand */
up_saveusercontext(s_last_regs);
x86_registerdump(s_last_regs);
}
}

View file

@ -177,7 +177,6 @@ void x86_lowputc(char ch);
void x86_lowputs(const char *str);
void x86_syscall(uint32_t *regs);
void x86_registerdump(uint32_t *regs);
/* Defined in up_allocateheap.c */

View file

@ -43,11 +43,13 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: x86_registerdump
* Name: up_dump_register
****************************************************************************/
void x86_registerdump(uint32_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
_alert(" ds:%08x irq:%08x err:%08x\n",
regs[REG_DS], regs[REG_IRQNO], regs[REG_ERRCODE]);
_alert("edi:%08x esi:%08x ebp:%08x esp:%08x\n",

View file

@ -27,14 +27,13 @@ HEAD_ASRC = qemu_head.S
CMN_ASRCS = i486_utils.S i486_syscall6.S
CMN_CSRCS += i486_createstack.c i486_initialstate.c
CMN_CSRCS += x86_allocateheap.c x86_assert.c x86_copystate.c
CMN_CSRCS += x86_exit.c x86_initialize.c x86_mdelay.c x86_udelay.c
CMN_CSRCS += x86_allocateheap.c x86_copystate.c x86_exit.c
CMN_CSRCS += x86_getintstack.c x86_initialize.c x86_mdelay.c
CMN_CSRCS += x86_modifyreg8.c x86_modifyreg16.c x86_modifyreg32.c
CMN_CSRCS += x86_nputs.c x86_switchcontext.c x86_getintstack.c
CMN_CSRCS += x86_nputs.c x86_switchcontext.c x86_udelay.c
CMN_CSRCS += i486_irq.c i486_regdump.c i486_releasestack.c
CMN_CSRCS += i486_savestate.c i486_sigdeliver.c
CMN_CSRCS += i486_schedulesigaction.c i486_stackframe.c
CMN_CSRCS += i486_usestack.c
CMN_CSRCS += i486_savestate.c i486_sigdeliver.c i486_stackframe.c
CMN_CSRCS += i486_schedulesigaction.c i486_usestack.c
# Required QEMU files

View file

@ -1,54 +0,0 @@
/****************************************************************************
* arch/x86_64/src/common/x86_64_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "sched/sched.h"
#include "x86_64_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
board_autoled_on(LED_ASSERTION);
if (g_current_regs != NULL)
{
x86_64_registerdump((uint64_t *)g_current_regs);
}
}

View file

@ -199,7 +199,6 @@ void x86_64_restore_auxstate(struct tcb_s *rtcb);
void x86_64_checktasks(void);
void x86_64_syscall(uint64_t *regs);
void x86_64_registerdump(uint64_t *regs);
/* Defined in up_allocateheap.c */

View file

@ -20,15 +20,15 @@
# Common x86_64 and intel64 files
CMN_CSRCS += x86_64_allocateheap.c x86_64_assert.c x86_64_copystate.c
CMN_CSRCS += x86_64_mdelay.c x86_64_udelay.c x86_64_exit.c x86_64_initialize.c
CMN_CSRCS += x86_64_modifyreg8.c x86_64_modifyreg16.c x86_64_modifyreg32.c x86_64_nputs.c
CMN_CSRCS += x86_64_switchcontext.c x86_64_getintstack.c
CMN_CSRCS += intel64_restore_auxstate.c intel64_createstack.c intel64_initialstate.c
CMN_CSRCS += intel64_regdump.c intel64_releasestack.c intel64_map_region.c
CMN_CSRCS += intel64_savestate.c intel64_sigdeliver.c
CMN_CSRCS += intel64_schedulesigaction.c intel64_stackframe.c
CMN_CSRCS += intel64_usestack.c intel64_irq.c intel64_rtc.c
CMN_CSRCS += x86_64_allocateheap.c x86_64_copystate.c x86_64_exit.c
CMN_CSRCS += x86_64_getintstack.c x86_64_mdelay.c x86_64_initialize.c
CMN_CSRCS += x86_64_modifyreg8.c x86_64_modifyreg16.c x86_64_modifyreg32.c
CMN_CSRCS += x86_64_nputs.c x86_64_switchcontext.c x86_64_udelay.c
CMN_CSRCS += intel64_createstack.c intel64_initialstate.c intel64_irq.c
CMN_CSRCS += intel64_map_region.c intel64_regdump.c intel64_releasestack.c
CMN_CSRCS += intel64_rtc.c intel64_restore_auxstate.c intel64_savestate.c
CMN_CSRCS += intel64_stackframe.c intel64_schedulesigaction.c
CMN_CSRCS += intel64_sigdeliver.c intel64_usestack.c
# Required Intel64 files

View file

@ -170,7 +170,7 @@ uint64_t *isr_handler(uint64_t *regs, uint64_t irq)
"with error code %" PRId64 ":\n",
irq, regs[REG_ERRCODE]);
x86_64_registerdump(regs);
up_dump_register(regs);
up_trash_cpu();
break;

View file

@ -108,8 +108,9 @@ void backtrace(uint64_t rbp)
}
}
void x86_64_registerdump(uint64_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uint64_t *regs = dumpregs ? dumpregs : g_current_regs;
uint64_t mxcsr;
uint64_t cr2;

View file

@ -27,16 +27,14 @@ HEAD_ASRC += xtensa_int_handlers.S xtensa_user_handler.S
CMN_ASRCS = xtensa_context.S xtensa_cpuint.S xtensa_panic.S
CMN_CSRCS = xtensa_assert.c
CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c
CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
CMN_CSRCS = xtensa_assert.c xtensa_cpenable.c xtensa_createstack.c
CMN_CSRCS += xtensa_exit.c xtensa_getintstack.c xtensa_initialize.c
CMN_CSRCS += xtensa_initialstate.c xtensa_irqdispatch.c xtensa_lowputs.c
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
CMN_CSRCS += xtensa_nputs.c xtensa_releasestack.c
CMN_CSRCS += xtensa_schedsigaction.c
CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c
CMN_CSRCS += xtensa_switchcontext.c xtensa_usestack.c xtensa_swint.c
CMN_CSRCS += xtensa_saveusercontext.c xtensa_getintstack.c xtensa_registerdump.c
CMN_CSRCS += xtensa_mdelay.c xtensa_nputs.c xtensa_releasestack.c
CMN_CSRCS += xtensa_registerdump.c xtensa_sigdeliver.c xtensa_switchcontext.c
CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c xtensa_saveusercontext.c
CMN_CSRCS += xtensa_schedsigaction.c xtensa_udelay.c xtensa_usestack.c
# Configuration-dependent common Xtensa files

View file

@ -214,10 +214,6 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
void xtensa_lowputs(const char *str);
/* Debug */
void xtensa_registerdump(uintptr_t *regs);
/* Common XTENSA functions */
/* Initialization */

View file

@ -37,43 +37,10 @@
#include "sched/sched.h"
#include "xtensa.h"
/****************************************************************************
* Private Data
****************************************************************************/
static uint8_t s_last_regs[XCPTCONTEXT_SIZE];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
struct tcb_s *rtcb = running_task();
board_autoled_on(LED_ASSERTION);
/* Update the xcp context */
if (CURRENT_REGS)
{
rtcb->xcp.regs = (uint32_t *)CURRENT_REGS;
}
else
{
up_saveusercontext(s_last_regs);
rtcb->xcp.regs = (uint32_t *)s_last_regs;
}
/* Dump the registers (if available) */
xtensa_registerdump(rtcb->xcp.regs);
}
/****************************************************************************
* Name: xtensa_panic
*

View file

@ -47,11 +47,14 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: xtensa_registerdump
* Name: up_dump_register
****************************************************************************/
void xtensa_registerdump(uintptr_t *regs)
void up_dump_register(void *dumpregs)
{
volatile uintptr_t *regs = dumpregs ? dumpregs :
(uintptr_t *)CURRENT_REGS;
_alert(" PC: %08lx PS: %08lx\n",
(unsigned long)regs[REG_PC], (unsigned long)regs[REG_PS]);
_alert(" A0: %08lx A1: %08lx A2: %08lx A3: %08lx\n",
@ -75,4 +78,3 @@ void xtensa_registerdump(uintptr_t *regs)
(unsigned long)regs[REG_LCOUNT]);
#endif
}

View file

@ -68,7 +68,7 @@ int xtensa_swint(int irq, void *context, void *arg)
#ifdef CONFIG_DEBUG_SYSCALL_INFO
svcinfo("SYSCALL Entry: regs: %p cmd: %" PRIu32 "\n", regs, cmd);
xtensa_registerdump(regs);
up_dump_register(regs);
#endif
/* Handle the syscall according to the command in A2 */
@ -431,7 +431,7 @@ int xtensa_swint(int irq, void *context, void *arg)
if (regs != CURRENT_REGS)
{
svcinfo("SYSCALL Return: Context switch!\n");
xtensa_registerdump(CURRENT_REGS);
up_dump_register(CURRENT_REGS);
}
else
{

View file

@ -166,7 +166,7 @@ void IRAM_ATTR xtensa_appcpu_start(void)
/* Dump registers so that we can see what is going to happen on return */
#if 0
xtensa_registerdump(tcb->xcp.regs);
up_dump_register(tcb->xcp.regs);
#endif
#ifdef CONFIG_ESP32_GPIO_IRQ

View file

@ -1,59 +0,0 @@
/****************************************************************************
* arch/z16/src/common/z16_assert.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include "z16_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static chipreg_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_assert
****************************************************************************/
void up_assert(void)
{
FAR volatile uint32_t *regs32 = (FAR volatile uint32_t *)g_current_regs;
board_autoled_on(LED_ASSERTION);
if (regs32 == NULL)
{
up_saveusercontext(s_last_regs);
regs32 = (FAR volatile uint32_t *)s_last_regs;
}
z16_registerdump(regs32);
}

View file

@ -155,10 +155,6 @@ void z16_netinitialize(void);
# define z16_netinitialize()
#endif
/* Dump stack and registers */
void z16_registerdump(FAR volatile uint32_t *regs);
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_Z16_SRC_COMMON_Z16_INTERNAL_H */

View file

@ -43,12 +43,14 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: z16_registerdump
* Name: up_dump_register
****************************************************************************/
void z16_registerdump(FAR volatile uint32_t *regs)
void up_dump_register(FAR void *dumpregs)
{
#ifdef CONFIG_DEBUG_INFO
FAR uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
_alert("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
"R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
regs[REG_R0 / 2], regs[REG_R1 / 2], regs[REG_R2 / 2],
@ -56,7 +58,7 @@ void z16_registerdump(FAR volatile uint32_t *regs)
regs[REG_R6 / 2], regs[REG_R7 / 2]);
_alert("R8 :%08x R9 :%08x R10:%08x R11:%08x R12:%08x R13:%08x\n"
regs[REG_R8 / 2], regs[REG_R9 / 2], regs[REG_R10 / 2],
regs3[REG_R11 / 2], regs[REG_R12 / 2], regs[REG_R13 / 2]);
regs[REG_R11 / 2], regs[REG_R12 / 2], regs[REG_R13 / 2]);
_alert("FP :%08x SP :%08x FLG:%04x\n"
regs[REG_R14 / 2], regs[REG_R15 / 2], regs[REG_FLAGS]);
#endif

View file

@ -20,12 +20,11 @@
HEAD_SSRC = z16f_head.S
CMN_CSRCS = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c
CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c z16_copystate.c
CMN_CSRCS += z16_mdelay.c z16_udelay.c z16_createstack.c z16_registerdump.c
CMN_CSRCS += z16_switchcontext.c z16_doirq.c z16_usestack.c
CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c
CMN_CSRCS += z16_nputs.c
CMN_CSRCS = z16_allocateheap.c z16_copystate.c z16_createstack.c z16_doirq.c
CMN_CSRCS += z16_exit.c z16_initialstate.c z16_initialize.c z16_idle.c
CMN_CSRCS += z16_mdelay.c z16_nputs.c z16_registerdump.c z16_releasestack.c
CMN_CSRCS += z16_schedulesigaction.c z16_sigdeliver.c z16_switchcontext.c
CMN_CSRCS += z16_stackframe.c z16_udelay.c z16_usestack.c
CHIP_SSRCS = z16f_lowuart.S z16f_saveusercontext.S z16f_restoreusercontext.S
CHIP_CSRCS = z16f_clkinit.c z16f_sysexec.c z16f_irq.c z16f_serial.c

View file

@ -143,14 +143,6 @@ int z80_multicastfilter(FAR struct net_driver_s *dev, FAR uint8_t *mac,
# define z80_multicastfilter(dev, mac, enable)
#endif
/* Dump stack and registers */
#ifdef CONFIG_ARCH_STACKDUMP
# define Z80_REGISTER_DUMP() _REGISTER_DUMP()
#else
# define Z80_REGISTER_DUMP()
#endif
#ifdef __cplusplus
}
#endif

View file

@ -18,12 +18,11 @@
#
############################################################################
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c
CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CMN_CSRCS += z80_nputs.c
CMN_CSRCS = z80_allocateheap.c z80_createstack.c z80_doirq.c
CMN_CSRCS += z80_exit.c z80_interruptcontext.c z80_idle.c
CMN_CSRCS += z80_initialize.c z80_mdelay.c z80_nputs.c
CMN_CSRCS += z80_releasestack.c z80_switchcontext.c
CMN_CSRCS += z80_stackframe.c z80_udelay.c z80_usestack.c
CHIP_ASRCS = ez80_startup.asm ez80_io.asm ez80_irqsave.asm
CHIP_ASRCS += ez80_irqcommon.asm

View file

@ -32,14 +32,6 @@
#include "chip/switch.h"
#include "z80_internal.h"
#ifdef CONFIG_ARCH_STACKDUMP
/****************************************************************************
* Private Data
****************************************************************************/
static chipreg_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
@ -55,18 +47,12 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
* Name: z80_registerdump
* Name: up_dump_register
****************************************************************************/
void ez80_registerdump(void)
void up_dump_register(FAR void *dumpregs)
{
volatile chipreg_t *regs = g_current_regs;
if (regs == NULL)
{
up_saveusercontext(s_last_regs);
regs = s_last_regs;
}
FAR chipreg_t *regs = dumpregs ? dumpregs : g_current_regs;
#ifdef CONFIG_EZ80_Z80MODE
_alert("AF: %04x I: %04x\n",
@ -88,5 +74,3 @@ void ez80_registerdump(void)
regs[XCPT_SP], regs[XCPT_PC]);
#endif
}
#endif /* CONFIG_ARCH_STACKDUMP */

View file

@ -97,10 +97,6 @@
#define RESTORE_USERCONTEXT(tcb) ez80_restorecontext((tcb)->xcp.regs)
/* Dump the current machine registers */
#define _REGISTER_DUMP() ez80_registerdump()
/************************************************************************************
* Public Types
************************************************************************************/
@ -139,10 +135,6 @@ int up_saveusercontext(FAR chipreg_t *regs);
void ez80_restorecontext(FAR chipreg_t *regs);
/* Defined in ez80_registerdump.c */
void ez80_registerdump(void);
#ifdef __cplusplus
}
#endif

View file

@ -26,11 +26,11 @@ HEAD_ASRC = z180_head.asm
endif
endif
CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_createstack.c
CMN_CSRCS += z80_doirq.c z80_exit.c z80_idle.c z80_initialize.c
CMN_CSRCS += z80_interruptcontext.c z80_mdelay.c
CMN_CSRCS += z80_releasestack.c z80_stackframe.c
CMN_CSRCS += z80_switchcontext.c z80_udelay.c z80_usestack.c z80_nputs.c
CMN_CSRCS = z80_allocateheap.c z80_createstack.c z80_doirq.c
CMN_CSRCS += z80_exit.c z80_interruptcontext.c z80_idle.c
CMN_CSRCS += z80_initialize.c z80_mdelay.c z80_nputs.c
CMN_CSRCS += z80_releasestack.c z80_stackframe.c z80_switchcontext.c
CMN_CSRCS += z80_udelay.c z80_usestack.c
CHIP_ASRCS = z180_restoreusercontext.asm z180_saveusercontext.asm
CHIP_ASRCS += z180_vectcommon.asm

View file

@ -154,11 +154,6 @@
} \
while (0)
/* Dump the current machine registers */
#define _REGISTER_DUMP() \
z180_registerdump()
/************************************************************************************
* Public Types
************************************************************************************/
@ -210,10 +205,6 @@ void z180_restoreusercontext(FAR chipreg_t *regs);
void z180_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
FAR chipreg_t *regs);
/* Defined in z180_registerdump.c */
void z180_registerdump(void);
#ifdef __cplusplus
}
#endif

Some files were not shown because too many files have changed in this diff Show more