mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
arch/tricore: record trapinfo for coredump
use global var record trap type and reason info for coredump Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
31adcde41b
commit
4e40393cc4
@@ -61,6 +61,8 @@ volatile bool g_interrupt_context[CONFIG_SMP_NCPUS];
|
||||
|
||||
void up_initialize(void)
|
||||
{
|
||||
tricore_trapinit();
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
||||
#ifdef USE_SERIALDRIVER
|
||||
|
||||
@@ -201,6 +201,7 @@ void tricore_sigdeliver(void);
|
||||
|
||||
void tricore_svcall(volatile void *trap);
|
||||
void tricore_trapcall(volatile void *trap);
|
||||
void tricore_trapinit(void);
|
||||
|
||||
/* Context Save Areas *******************************************************/
|
||||
|
||||
|
||||
@@ -34,16 +34,33 @@
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <sched/sched.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "tricore_internal.h"
|
||||
|
||||
#include "IfxCpu_Trap.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static IfxCpu_Trap g_trapinfo;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void tricore_trapinfo(volatile void *trap)
|
||||
{
|
||||
IfxCpu_Trap *ctrap = (IfxCpu_Trap *)trap;
|
||||
|
||||
g_trapinfo.tCpu = ctrap->tCpu;
|
||||
g_trapinfo.tClass = ctrap->tClass;
|
||||
g_trapinfo.tId = ctrap->tId;
|
||||
g_trapinfo.tAddr = ctrap->tAddr;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -290,6 +307,8 @@ void tricore_trapcall(volatile void *trap)
|
||||
IfxCpu_Trap_Class tclass = (IfxCpu_Trap_Class)ctrap->tClass;
|
||||
unsigned int tid = ctrap->tId;
|
||||
|
||||
tricore_trapinfo(trap);
|
||||
|
||||
regs = tricore_csa2addr(__mfcr(CPU_PCXI));
|
||||
pcxi = regs[REG_UPCXI];
|
||||
regs = tricore_csa2addr(pcxi);
|
||||
@@ -342,3 +361,19 @@ void tricore_trapcall(volatile void *trap)
|
||||
up_irq_save();
|
||||
PANIC_WITH_REGS("Trap", regs);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: tricore_trapinit
|
||||
*
|
||||
* Description:
|
||||
* Trap init for tricore arch.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tricore_trapinit(void)
|
||||
{
|
||||
#ifdef CONFIG_COREDUMP
|
||||
coredump_add_memory_region(&g_trapinfo, sizeof(g_trapinfo),
|
||||
PF_REGISTER);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -223,7 +223,9 @@ static const char *g_white_prefix[] =
|
||||
"Http", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */
|
||||
"Disk", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */
|
||||
"Xedge", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */
|
||||
"tAddr", /* Ref: arch/tricore/src */
|
||||
"tClass", /* Ref: arch/tricore/src */
|
||||
"tCpu", /* Ref: arch/tricore/src */
|
||||
"tId", /* Ref: arch/tricore/src */
|
||||
NULL
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user