Skip to content

Commit

Permalink
xtensa: coredump: support dumping privilege stack
Browse files Browse the repository at this point in the history
Adds the bits to support dumping privilege stack during
coredump.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
  • Loading branch information
dcpleung committed Sep 17, 2024
1 parent e7bc619 commit 63dbb51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arch/xtensa/core/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/debug/coredump.h>
#include <xtensa_asm2_context.h>
#include <zephyr/offsets.h>
Expand Down Expand Up @@ -189,3 +190,18 @@ uint16_t arch_coredump_tgt_code_get(void)
{
return COREDUMP_TGT_XTENSA;
}

#if defined(CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK)
void arch_coredump_priv_stack_dump(struct k_thread *thread)
{
struct xtensa_thread_stack_header *hdr_stack_obj;
uintptr_t start_addr, end_addr;

hdr_stack_obj = (struct xtensa_thread_stack_header *)thread->stack_obj;

start_addr = (uintptr_t)&hdr_stack_obj->privilege_stack[0];
end_addr = start_addr + sizeof(hdr_stack_obj->privilege_stack);

coredump_memory_dump(start_addr, end_addr);
}
#endif /* CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK */
1 change: 1 addition & 0 deletions boards/qemu/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
config BOARD_QEMU_XTENSA
select QEMU_TARGET
select ARCH_SUPPORTS_COREDUMP
select ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
select XTENSA_MMU if BOARD_QEMU_XTENSA_DC233C_MMU

0 comments on commit 63dbb51

Please sign in to comment.