mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-07 07:52:37 +00:00
Update the xtensa backend to work better with the new fatal error architecture. Move the stack frame dump (xtensa uses a variable-size frame becuase we don't spill unused register windows, so it doesn't strictly have an ESF struct) into z_xtensa_fatal_error(). Unify the older exception logging with the newer one (they'd been sort of glomed together in the recent rework), mostly using the asm2 code but with the exception cause stringification and the PS register field extraction from the older one. Note that one shortcoming is that the way the dispatch code works, we don't have access to the spilled frame from within the spurious error handler, so this can't log the interrupted CPU state. This isn't fixable easily without adding overhead to every interrupt entry, so it needs to stay the way it is for now. Longer term we could exract the caller frame from the window state and figure it out with some elaborate assembly, I guess. Fixes #18140 Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
/*
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
* Copyright (c) 2016 Cadence Design Systems, Inc.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief Xtensa public exception handling
|
|
*
|
|
* Xtensa-specific kernel exception handling interface. Included by
|
|
* arch/xtensa/arch.h.
|
|
*/
|
|
|
|
#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_EXC_H_
|
|
#define ZEPHYR_INCLUDE_ARCH_XTENSA_EXC_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef _ASMLANGUAGE
|
|
/**
|
|
* @brief Exception Stack Frame
|
|
*
|
|
* A pointer to an "exception stack frame" (ESF) is passed as an argument
|
|
* to exception handlers registered via nanoCpuExcConnect().
|
|
*/
|
|
struct __esf {
|
|
/* FIXME - not finished yet */
|
|
sys_define_gpr_with_alias(a1, sp);
|
|
u32_t pc;
|
|
};
|
|
|
|
/* Xtensa uses a variable length stack frame depending on how many
|
|
* register windows are in use. This isn't a struct type, it just
|
|
* matches the register/stack-unit width.
|
|
*/
|
|
typedef int z_arch_esf_t;
|
|
|
|
void z_xtensa_dump_stack(const z_arch_esf_t *stack);
|
|
char *z_xtensa_exccause(unsigned int cause_code);
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_EXC_H_ */
|