kernel: remove z_fatal_print()

Use LOG_ERR instead.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-08-07 09:06:23 +02:00 committed by Anas Nashif
commit a470ba1999
14 changed files with 216 additions and 238 deletions

View file

@ -16,13 +16,14 @@
#include <offsets_short.h> #include <offsets_short.h>
#include <toolchain.h> #include <toolchain.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
void z_arc_fatal_error(unsigned int reason, const z_arch_esf_t *esf) void z_arc_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{ {
if (reason == K_ERR_CPU_EXCEPTION) { if (reason == K_ERR_CPU_EXCEPTION) {
z_fatal_print("Faulting instruction address = 0x%lx", LOG_ERR("Faulting instruction address = 0x%lx",
z_arc_v2_aux_reg_read(_ARC_V2_ERET)); z_arc_v2_aux_reg_read(_ARC_V2_ERET));
} }
z_fatal_error(reason, esf); z_fatal_error(reason, esf);

View file

@ -18,8 +18,8 @@
#include <kernel.h> #include <kernel.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <exc_handle.h> #include <exc_handle.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
Z_EXC_DECLARE(z_arch_user_string_nlen); Z_EXC_DECLARE(z_arch_user_string_nlen);
@ -154,32 +154,32 @@ static void dump_protv_exception(u32_t cause, u32_t parameter)
{ {
switch (cause) { switch (cause) {
case 0x0: case 0x0:
z_fatal_print("Instruction fetch violation (%s)", LOG_ERR("Instruction fetch violation (%s)",
get_protv_access_err(parameter)); get_protv_access_err(parameter));
break; break;
case 0x1: case 0x1:
z_fatal_print("Memory read protection violation (%s)", LOG_ERR("Memory read protection violation (%s)",
get_protv_access_err(parameter)); get_protv_access_err(parameter));
break; break;
case 0x2: case 0x2:
z_fatal_print("Memory write protection violation (%s)", LOG_ERR("Memory write protection violation (%s)",
get_protv_access_err(parameter)); get_protv_access_err(parameter));
break; break;
case 0x3: case 0x3:
z_fatal_print("Memory read-modify-write violation (%s)", LOG_ERR("Memory read-modify-write violation (%s)",
get_protv_access_err(parameter)); get_protv_access_err(parameter));
break; break;
case 0x10: case 0x10:
z_fatal_print("Normal vector table in secure memory"); LOG_ERR("Normal vector table in secure memory");
break; break;
case 0x11: case 0x11:
z_fatal_print("NS handler code located in S memory"); LOG_ERR("NS handler code located in S memory");
break; break;
case 0x12: case 0x12:
z_fatal_print("NSC Table Range Violation"); LOG_ERR("NSC Table Range Violation");
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
} }
@ -188,46 +188,46 @@ static void dump_machine_check_exception(u32_t cause, u32_t parameter)
{ {
switch (cause) { switch (cause) {
case 0x0: case 0x0:
z_fatal_print("double fault"); LOG_ERR("double fault");
break; break;
case 0x1: case 0x1:
z_fatal_print("overlapping TLB entries"); LOG_ERR("overlapping TLB entries");
break; break;
case 0x2: case 0x2:
z_fatal_print("fatal TLB error"); LOG_ERR("fatal TLB error");
break; break;
case 0x3: case 0x3:
z_fatal_print("fatal cache error"); LOG_ERR("fatal cache error");
break; break;
case 0x4: case 0x4:
z_fatal_print("internal memory error on instruction fetch"); LOG_ERR("internal memory error on instruction fetch");
break; break;
case 0x5: case 0x5:
z_fatal_print("internal memory error on data fetch"); LOG_ERR("internal memory error on data fetch");
break; break;
case 0x6: case 0x6:
z_fatal_print("illegal overlapping MPU entries"); LOG_ERR("illegal overlapping MPU entries");
if (parameter == 0x1) { if (parameter == 0x1) {
z_fatal_print(" - jump and branch target"); LOG_ERR(" - jump and branch target");
} }
break; break;
case 0x10: case 0x10:
z_fatal_print("secure vector table not located in secure memory"); LOG_ERR("secure vector table not located in secure memory");
break; break;
case 0x11: case 0x11:
z_fatal_print("NSC jump table not located in secure memory"); LOG_ERR("NSC jump table not located in secure memory");
break; break;
case 0x12: case 0x12:
z_fatal_print("secure handler code not located in secure memory"); LOG_ERR("secure handler code not located in secure memory");
break; break;
case 0x13: case 0x13:
z_fatal_print("NSC target address not located in secure memory"); LOG_ERR("NSC target address not located in secure memory");
break; break;
case 0x80: case 0x80:
z_fatal_print("uncorrectable ECC or parity error in vector memory"); LOG_ERR("uncorrectable ECC or parity error in vector memory");
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
} }
@ -236,54 +236,54 @@ static void dump_privilege_exception(u32_t cause, u32_t parameter)
{ {
switch (cause) { switch (cause) {
case 0x0: case 0x0:
z_fatal_print("Privilege violation"); LOG_ERR("Privilege violation");
break; break;
case 0x1: case 0x1:
z_fatal_print("disabled extension"); LOG_ERR("disabled extension");
break; break;
case 0x2: case 0x2:
z_fatal_print("action point hit"); LOG_ERR("action point hit");
break; break;
case 0x10: case 0x10:
switch (parameter) { switch (parameter) {
case 0x1: case 0x1:
z_fatal_print("N to S return using incorrect return mechanism"); LOG_ERR("N to S return using incorrect return mechanism");
break; break;
case 0x2: case 0x2:
z_fatal_print("N to S return with incorrect operating mode"); LOG_ERR("N to S return with incorrect operating mode");
break; break;
case 0x3: case 0x3:
z_fatal_print("IRQ/exception return fetch from wrong mode"); LOG_ERR("IRQ/exception return fetch from wrong mode");
break; break;
case 0x4: case 0x4:
z_fatal_print("attempt to halt secure processor in NS mode"); LOG_ERR("attempt to halt secure processor in NS mode");
break; break;
case 0x20: case 0x20:
z_fatal_print("attempt to access secure resource from normal mode"); LOG_ERR("attempt to access secure resource from normal mode");
break; break;
case 0x40: case 0x40:
z_fatal_print("SID violation on resource access (APEX/UAUX/key NVM)"); LOG_ERR("SID violation on resource access (APEX/UAUX/key NVM)");
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
break; break;
case 0x13: case 0x13:
switch (parameter) { switch (parameter) {
case 0x20: case 0x20:
z_fatal_print("attempt to access secure APEX feature from NS mode"); LOG_ERR("attempt to access secure APEX feature from NS mode");
break; break;
case 0x40: case 0x40:
z_fatal_print("SID violation on access to APEX feature"); LOG_ERR("SID violation on access to APEX feature");
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
} }
@ -291,7 +291,7 @@ static void dump_privilege_exception(u32_t cause, u32_t parameter)
static void dump_exception_info(u32_t vector, u32_t cause, u32_t parameter) static void dump_exception_info(u32_t vector, u32_t cause, u32_t parameter)
{ {
if (vector >= 0x10 && vector <= 0xFF) { if (vector >= 0x10 && vector <= 0xFF) {
z_fatal_print("interrupt %u", vector); LOG_ERR("interrupt %u", vector);
return; return;
} }
@ -300,55 +300,55 @@ static void dump_exception_info(u32_t vector, u32_t cause, u32_t parameter)
*/ */
switch (vector) { switch (vector) {
case ARC_EV_RESET: case ARC_EV_RESET:
z_fatal_print("Reset"); LOG_ERR("Reset");
break; break;
case ARC_EV_MEM_ERROR: case ARC_EV_MEM_ERROR:
z_fatal_print("Memory Error"); LOG_ERR("Memory Error");
break; break;
case ARC_EV_INS_ERROR: case ARC_EV_INS_ERROR:
z_fatal_print("Instruction Error"); LOG_ERR("Instruction Error");
break; break;
case ARC_EV_MACHINE_CHECK: case ARC_EV_MACHINE_CHECK:
z_fatal_print("EV_MachineCheck"); LOG_ERR("EV_MachineCheck");
dump_machine_check_exception(cause, parameter); dump_machine_check_exception(cause, parameter);
break; break;
case ARC_EV_TLB_MISS_I: case ARC_EV_TLB_MISS_I:
z_fatal_print("EV_TLBMissI"); LOG_ERR("EV_TLBMissI");
break; break;
case ARC_EV_TLB_MISS_D: case ARC_EV_TLB_MISS_D:
z_fatal_print("EV_TLBMissD"); LOG_ERR("EV_TLBMissD");
break; break;
case ARC_EV_PROT_V: case ARC_EV_PROT_V:
z_fatal_print("EV_ProtV"); LOG_ERR("EV_ProtV");
dump_protv_exception(cause, parameter); dump_protv_exception(cause, parameter);
break; break;
case ARC_EV_PRIVILEGE_V: case ARC_EV_PRIVILEGE_V:
z_fatal_print("EV_PrivilegeV"); LOG_ERR("EV_PrivilegeV");
dump_privilege_exception(cause, parameter); dump_privilege_exception(cause, parameter);
break; break;
case ARC_EV_SWI: case ARC_EV_SWI:
z_fatal_print("EV_SWI"); LOG_ERR("EV_SWI");
break; break;
case ARC_EV_TRAP: case ARC_EV_TRAP:
z_fatal_print("EV_Trap"); LOG_ERR("EV_Trap");
break; break;
case ARC_EV_EXTENSION: case ARC_EV_EXTENSION:
z_fatal_print("EV_Extension"); LOG_ERR("EV_Extension");
break; break;
case ARC_EV_DIV_ZERO: case ARC_EV_DIV_ZERO:
z_fatal_print("EV_DivZero"); LOG_ERR("EV_DivZero");
break; break;
case ARC_EV_DC_ERROR: case ARC_EV_DC_ERROR:
z_fatal_print("EV_DCError"); LOG_ERR("EV_DCError");
break; break;
case ARC_EV_MISALIGNED: case ARC_EV_MISALIGNED:
z_fatal_print("EV_Misaligned"); LOG_ERR("EV_Misaligned");
break; break;
case ARC_EV_VEC_UNIT: case ARC_EV_VEC_UNIT:
z_fatal_print("EV_VecUnit"); LOG_ERR("EV_VecUnit");
break; break;
default: default:
z_fatal_print("unknown"); LOG_ERR("unknown");
break; break;
} }
} }
@ -401,9 +401,9 @@ void _Fault(z_arch_esf_t *esf, u32_t old_sp)
return; return;
} }
z_fatal_print("***** Exception vector: 0x%x, cause code: 0x%x, parameter 0x%x", LOG_ERR("***** Exception vector: 0x%x, cause code: 0x%x, parameter 0x%x",
vector, cause, parameter); vector, cause, parameter);
z_fatal_print("Address 0x%x", exc_addr); LOG_ERR("Address 0x%x", exc_addr);
#ifdef CONFIG_ARC_EXCEPTION_DEBUG #ifdef CONFIG_ARC_EXCEPTION_DEBUG
dump_exception_info(vector, cause, parameter); dump_exception_info(vector, cause, parameter);
#endif #endif

View file

@ -18,10 +18,11 @@
#include <kernel_structs.h> #include <kernel_structs.h>
#include <inttypes.h> #include <inttypes.h>
#include <exc_handle.h> #include <exc_handle.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
#if defined(CONFIG_PRINTK) || defined(CONFIG_LOG) #if defined(CONFIG_PRINTK) || defined(CONFIG_LOG)
#define PR_EXC(...) z_fatal_print(__VA_ARGS__) #define PR_EXC(...) LOG_ERR(__VA_ARGS__)
#define STORE_xFAR(reg_var, reg) u32_t reg_var = (u32_t)reg #define STORE_xFAR(reg_var, reg) u32_t reg_var = (u32_t)reg
#else #else
#define PR_EXC(...) #define PR_EXC(...)

View file

@ -17,28 +17,29 @@
#include <kernel.h> #include <kernel.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
static void esf_dump(const z_arch_esf_t *esf) static void esf_dump(const z_arch_esf_t *esf)
{ {
z_fatal_print("r0/a1: 0x%08x r1/a2: 0x%08x r2/a3: 0x%08x", LOG_ERR("r0/a1: 0x%08x r1/a2: 0x%08x r2/a3: 0x%08x",
esf->basic.a1, esf->basic.a2, esf->basic.a3); esf->basic.a1, esf->basic.a2, esf->basic.a3);
z_fatal_print("r3/a4: 0x%08x r12/ip: 0x%08x r14/lr: 0x%08x", LOG_ERR("r3/a4: 0x%08x r12/ip: 0x%08x r14/lr: 0x%08x",
esf->basic.a4, esf->basic.ip, esf->basic.lr); esf->basic.a4, esf->basic.ip, esf->basic.lr);
z_fatal_print(" xpsr: 0x%08x", esf->basic.xpsr); LOG_ERR(" xpsr: 0x%08x", esf->basic.xpsr);
#if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING) #if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING)
for (int i = 0; i < 16; i += 4) { for (int i = 0; i < 16; i += 4) {
z_fatal_print("s[%d]: 0x%08x s[%d]: 0x%08x" LOG_ERR("s[%d]: 0x%08x s[%d]: 0x%08x"
" s[%d]: 0x%08x s[%d]: 0x%08x\n", " s[%d]: 0x%08x s[%d]: 0x%08x\n",
i, (u32_t)esf->s[i], i, (u32_t)esf->s[i],
i + 1, (u32_t)esf->s[i + 1], i + 1, (u32_t)esf->s[i + 1],
i + 2, (u32_t)esf->s[i + 2], i + 2, (u32_t)esf->s[i + 2],
i + 3, (u32_t)esf->s[i + 3]); i + 3, (u32_t)esf->s[i + 3]);
} }
z_fatal_print("fpscr: 0x%08x\n", esf->fpscr); LOG_ERR("fpscr: 0x%08x\n", esf->fpscr);
#endif #endif
z_fatal_print("Faulting instruction address (r15/pc): 0x%08x", LOG_ERR("Faulting instruction address (r15/pc): 0x%08x",
esf->basic.pc); esf->basic.pc);
} }
void z_arm_fatal_error(unsigned int reason, const z_arch_esf_t *esf) void z_arm_fatal_error(unsigned int reason, const z_arch_esf_t *esf)

View file

@ -8,7 +8,8 @@
#include <arch/cpu.h> #include <arch/cpu.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <inttypes.h> #include <inttypes.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
FUNC_NORETURN void z_nios2_fatal_error(unsigned int reason, FUNC_NORETURN void z_nios2_fatal_error(unsigned int reason,
const z_arch_esf_t *esf) const z_arch_esf_t *esf)
@ -21,16 +22,16 @@ FUNC_NORETURN void z_nios2_fatal_error(unsigned int reason,
* entry. We may want to introduce a config option to save and * entry. We may want to introduce a config option to save and
* dump all registers, at the expense of some stack space. * dump all registers, at the expense of some stack space.
*/ */
z_fatal_print("Faulting instruction: 0x%08x", esf->instr - 4); LOG_ERR("Faulting instruction: 0x%08x", esf->instr - 4);
z_fatal_print(" r1: 0x%08x r2: 0x%08x r3: 0x%08x r4: 0x%08x", LOG_ERR(" r1: 0x%08x r2: 0x%08x r3: 0x%08x r4: 0x%08x",
esf->r1, esf->r2, esf->r3, esf->r4); esf->r1, esf->r2, esf->r3, esf->r4);
z_fatal_print(" r5: 0x%08x r6: 0x%08x r7: 0x%08x r8: 0x%08x", LOG_ERR(" r5: 0x%08x r6: 0x%08x r7: 0x%08x r8: 0x%08x",
esf->r5, esf->r6, esf->r7, esf->r8); esf->r5, esf->r6, esf->r7, esf->r8);
z_fatal_print(" r9: 0x%08x r10: 0x%08x r11: 0x%08x r12: 0x%08x", LOG_ERR(" r9: 0x%08x r10: 0x%08x r11: 0x%08x r12: 0x%08x",
esf->r9, esf->r10, esf->r11, esf->r12); esf->r9, esf->r10, esf->r11, esf->r12);
z_fatal_print(" r13: 0x%08x r14: 0x%08x r15: 0x%08x ra: 0x%08x", LOG_ERR(" r13: 0x%08x r14: 0x%08x r15: 0x%08x ra: 0x%08x",
esf->r13, esf->r14, esf->r15, esf->ra); esf->r13, esf->r14, esf->r15, esf->ra);
z_fatal_print("estatus: %08x", esf->estatus); LOG_ERR("estatus: %08x", esf->estatus);
} }
z_fatal_error(reason, esf); z_fatal_error(reason, esf);
@ -116,13 +117,13 @@ FUNC_NORETURN void _Fault(const z_arch_esf_t *esf)
cause = (exc_reg & NIOS2_EXCEPTION_REG_CAUSE_MASK) cause = (exc_reg & NIOS2_EXCEPTION_REG_CAUSE_MASK)
>> NIOS2_EXCEPTION_REG_CAUSE_OFST; >> NIOS2_EXCEPTION_REG_CAUSE_OFST;
z_fatal_print("Exception cause: %d ECCFTL: 0x%x", cause, eccftl); LOG_ERR("Exception cause: %d ECCFTL: 0x%x", cause, eccftl);
#if CONFIG_EXTRA_EXCEPTION_INFO #if CONFIG_EXTRA_EXCEPTION_INFO
z_fatal_print("reason: %s", cause_str(cause)); LOG_ERR("reason: %s", cause_str(cause));
#endif #endif
if (BIT(cause) & NIOS2_BADADDR_CAUSE_MASK) { if (BIT(cause) & NIOS2_BADADDR_CAUSE_MASK) {
badaddr_reg = z_nios2_creg_read(NIOS2_CR_BADADDR); badaddr_reg = z_nios2_creg_read(NIOS2_CR_BADADDR);
z_fatal_print("Badaddr: 0x%x", badaddr_reg); LOG_ERR("Badaddr: 0x%x", badaddr_reg);
} }
#endif /* ALT_CPU_HAS_EXTRA_EXCEPTION_INFO */ #endif /* ALT_CPU_HAS_EXTRA_EXCEPTION_INFO */
#endif /* CONFIG_PRINTK || CONFIG_LOG */ #endif /* CONFIG_PRINTK || CONFIG_LOG */

View file

@ -19,12 +19,14 @@
#include <ksched.h> #include <ksched.h>
#include <kswap.h> #include <kswap.h>
#include <debug/tracing.h> #include <debug/tracing.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);
FUNC_NORETURN void z_irq_spurious(void *unused) FUNC_NORETURN void z_irq_spurious(void *unused)
{ {
ARG_UNUSED(unused); ARG_UNUSED(unused);
z_fatal_print("Spurious interrupt detected! ipending: %x", LOG_ERR("Spurious interrupt detected! ipending: %x",
z_nios2_creg_read(NIOS2_CR_IPENDING)); z_nios2_creg_read(NIOS2_CR_IPENDING));
z_nios2_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); z_nios2_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
} }

View file

@ -7,24 +7,25 @@
#include <kernel.h> #include <kernel.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <inttypes.h> #include <inttypes.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
FUNC_NORETURN void z_riscv_fatal_error(unsigned int reason, FUNC_NORETURN void z_riscv_fatal_error(unsigned int reason,
const z_arch_esf_t *esf) const z_arch_esf_t *esf)
{ {
if (esf != NULL) { if (esf != NULL) {
z_fatal_print("Faulting instruction address = 0x%08lx", LOG_ERR("Faulting instruction address = 0x%08lx",
esf->mepc); esf->mepc);
z_fatal_print(" ra: 0x%08lx gp: 0x%08lx tp: 0x%08lx t0: 0x%08lx", LOG_ERR(" ra: 0x%08lx gp: 0x%08lx tp: 0x%08lx t0: 0x%08lx",
esf->ra, esf->gp, esf->tp, esf->t0); esf->ra, esf->gp, esf->tp, esf->t0);
z_fatal_print(" t1: 0x%08lx t2: 0x%08lx t3: 0x%08lx t4: 0x%08lx", LOG_ERR(" t1: 0x%08lx t2: 0x%08lx t3: 0x%08lx t4: 0x%08lx",
esf->t1, esf->t2, esf->t3, esf->t4); esf->t1, esf->t2, esf->t3, esf->t4);
z_fatal_print(" t5: 0x%08lx t6: 0x%08lx a0: 0x%08lx a1: 0x%08lx", LOG_ERR(" t5: 0x%08lx t6: 0x%08lx a0: 0x%08lx a1: 0x%08lx",
esf->t5, esf->t6, esf->a0, esf->a1); esf->t5, esf->t6, esf->a0, esf->a1);
z_fatal_print(" a2: 0x%08lx a3: 0x%08lx a4: 0x%08lx a5: 0x%08lx", LOG_ERR(" a2: 0x%08lx a3: 0x%08lx a4: 0x%08lx a5: 0x%08lx",
esf->a2, esf->a3, esf->a4, esf->a5); esf->a2, esf->a3, esf->a4, esf->a5);
z_fatal_print(" a6: 0x%08lx a7: 0x%08lx\n", LOG_ERR(" a6: 0x%08lx a7: 0x%08lx\n",
esf->a6, esf->a7); esf->a6, esf->a7);
} }
z_fatal_error(reason, esf); z_fatal_error(reason, esf);
@ -58,7 +59,7 @@ FUNC_NORETURN void _Fault(const z_arch_esf_t *esf)
__asm__ volatile("csrr %0, mcause" : "=r" (mcause)); __asm__ volatile("csrr %0, mcause" : "=r" (mcause));
mcause &= SOC_MCAUSE_EXP_MASK; mcause &= SOC_MCAUSE_EXP_MASK;
z_fatal_print("Exception cause %s (%ld)", cause_str(mcause), mcause); LOG_ERR("Exception cause %s (%ld)", cause_str(mcause), mcause);
z_riscv_fatal_error(K_ERR_CPU_EXCEPTION, esf); z_riscv_fatal_error(K_ERR_CPU_EXCEPTION, esf);
} }

View file

@ -6,6 +6,8 @@
#include <toolchain.h> #include <toolchain.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);
FUNC_NORETURN void z_irq_spurious(void *unused) FUNC_NORETURN void z_irq_spurious(void *unused)
{ {
@ -17,11 +19,11 @@ FUNC_NORETURN void z_irq_spurious(void *unused)
mcause &= SOC_MCAUSE_EXP_MASK; mcause &= SOC_MCAUSE_EXP_MASK;
z_fatal_print("Spurious interrupt detected! IRQ: %ld", mcause); LOG_ERR("Spurious interrupt detected! IRQ: %ld", mcause);
#if defined(CONFIG_RISCV_HAS_PLIC) #if defined(CONFIG_RISCV_HAS_PLIC)
if (mcause == RISCV_MACHINE_EXT_IRQ) { if (mcause == RISCV_MACHINE_EXT_IRQ) {
z_fatal_print("PLIC interrupt line causing the IRQ: %d", LOG_ERR("PLIC interrupt line causing the IRQ: %d",
riscv_plic_get_irq()); riscv_plic_get_irq());
} }
#endif #endif
z_riscv_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); z_riscv_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);

View file

@ -19,7 +19,8 @@
#include <ia32/exception.h> #include <ia32/exception.h>
#include <inttypes.h> #include <inttypes.h>
#include <exc_handle.h> #include <exc_handle.h>
#include <logging/log_ctrl.h> #include <logging/log.h>
LOG_MODULE_DECLARE(os);
__weak void z_debug_fatal_hook(const z_arch_esf_t *esf) { ARG_UNUSED(esf); } __weak void z_debug_fatal_hook(const z_arch_esf_t *esf) { ARG_UNUSED(esf); }
@ -77,13 +78,13 @@ static void unwind_stack(u32_t base_ptr, u16_t cs)
int i; int i;
if (base_ptr == 0U) { if (base_ptr == 0U) {
z_fatal_print("NULL base ptr"); LOG_ERR("NULL base ptr");
return; return;
} }
for (i = 0; i < MAX_STACK_FRAMES; i++) { for (i = 0; i < MAX_STACK_FRAMES; i++) {
if (base_ptr % sizeof(base_ptr) != 0U) { if (base_ptr % sizeof(base_ptr) != 0U) {
z_fatal_print("unaligned frame ptr"); LOG_ERR("unaligned frame ptr");
return; return;
} }
@ -97,7 +98,7 @@ static void unwind_stack(u32_t base_ptr, u16_t cs)
* stack buffer * stack buffer
*/ */
if (check_stack_bounds((u32_t)frame, sizeof(*frame), cs)) { if (check_stack_bounds((u32_t)frame, sizeof(*frame), cs)) {
z_fatal_print(" corrupted? (bp=%p)", frame); LOG_ERR(" corrupted? (bp=%p)", frame);
break; break;
} }
#endif #endif
@ -105,8 +106,7 @@ static void unwind_stack(u32_t base_ptr, u16_t cs)
if (frame->ret_addr == 0U) { if (frame->ret_addr == 0U) {
break; break;
} }
z_fatal_print(" 0x%08x (0x%x)", frame->ret_addr, LOG_ERR(" 0x%08x (0x%x)", frame->ret_addr, frame->args);
frame->args);
base_ptr = frame->next; base_ptr = frame->next;
} }
} }
@ -128,17 +128,17 @@ FUNC_NORETURN void z_arch_system_halt(unsigned int reason)
FUNC_NORETURN void z_x86_fatal_error(unsigned int reason, const z_arch_esf_t *esf) FUNC_NORETURN void z_x86_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{ {
if (esf != NULL) { if (esf != NULL) {
z_fatal_print("eax: 0x%08x, ebx: 0x%08x, ecx: 0x%08x, edx: 0x%08x", LOG_ERR("eax: 0x%08x, ebx: 0x%08x, ecx: 0x%08x, edx: 0x%08x",
esf->eax, esf->ebx, esf->ecx, esf->edx); esf->eax, esf->ebx, esf->ecx, esf->edx);
z_fatal_print("esi: 0x%08x, edi: 0x%08x, ebp: 0x%08x, esp: 0x%08x", LOG_ERR("esi: 0x%08x, edi: 0x%08x, ebp: 0x%08x, esp: 0x%08x",
esf->esi, esf->edi, esf->ebp, esf->esp); esf->esi, esf->edi, esf->ebp, esf->esp);
z_fatal_print("eflags: 0x%08x cs: 0x%04x cr3: %p", esf->eflags, LOG_ERR("eflags: 0x%08x cs: 0x%04x cr3: %p", esf->eflags,
esf->cs & 0xFFFFU, z_x86_page_tables_get()); esf->cs & 0xFFFFU, z_x86_page_tables_get());
#ifdef CONFIG_EXCEPTION_STACK_TRACE #ifdef CONFIG_EXCEPTION_STACK_TRACE
z_fatal_print("call trace:"); LOG_ERR("call trace:");
#endif #endif
z_fatal_print("eip: 0x%08x", esf->eip); LOG_ERR("eip: 0x%08x", esf->eip);
#ifdef CONFIG_EXCEPTION_STACK_TRACE #ifdef CONFIG_EXCEPTION_STACK_TRACE
unwind_stack(esf->ebp, esf->cs); unwind_stack(esf->ebp, esf->cs);
#endif #endif
@ -153,7 +153,7 @@ void z_x86_spurious_irq(const z_arch_esf_t *esf)
int vector = z_irq_controller_isr_vector_get(); int vector = z_irq_controller_isr_vector_get();
if (vector >= 0) { if (vector >= 0) {
z_fatal_print("IRQ vector: %d", vector); LOG_ERR("IRQ vector: %d", vector);
} }
z_x86_fatal_error(K_ERR_SPURIOUS_IRQ, esf); z_x86_fatal_error(K_ERR_SPURIOUS_IRQ, esf);
@ -208,17 +208,17 @@ FUNC_NORETURN static void generic_exc_handle(unsigned int vector,
{ {
switch (vector) { switch (vector) {
case IV_GENERAL_PROTECTION: case IV_GENERAL_PROTECTION:
z_fatal_print("General Protection Fault"); LOG_ERR("General Protection Fault");
break; break;
case IV_DEVICE_NOT_AVAILABLE: case IV_DEVICE_NOT_AVAILABLE:
z_fatal_print("Floating point unit not enabled"); LOG_ERR("Floating point unit not enabled");
break; break;
default: default:
z_fatal_print("CPU exception %d", vector); LOG_ERR("CPU exception %d", vector);
break; break;
} }
if ((BIT(vector) & _EXC_ERROR_CODE_FAULTS) != 0) { if ((BIT(vector) & _EXC_ERROR_CODE_FAULTS) != 0) {
z_fatal_print("Exception code: 0x%x", pEsf->errorCode); LOG_ERR("Exception code: 0x%x", pEsf->errorCode);
} }
z_x86_fatal_error(K_ERR_CPU_EXCEPTION, pEsf); z_x86_fatal_error(K_ERR_CPU_EXCEPTION, pEsf);
} }
@ -275,16 +275,16 @@ EXC_FUNC_NOCODE(IV_MACHINE_CHECK);
#ifdef CONFIG_X86_MMU #ifdef CONFIG_X86_MMU
static void dump_entry_flags(const char *name, x86_page_entry_data_t flags) static void dump_entry_flags(const char *name, x86_page_entry_data_t flags)
{ {
z_fatal_print("%s: 0x%x%x %s, %s, %s, %s", name, (u32_t)(flags>>32), LOG_ERR("%s: 0x%x%x %s, %s, %s, %s", name, (u32_t)(flags>>32),
(u32_t)(flags), (u32_t)(flags),
flags & (x86_page_entry_data_t)MMU_ENTRY_PRESENT ? flags & (x86_page_entry_data_t)MMU_ENTRY_PRESENT ?
"Present" : "Non-present", "Present" : "Non-present",
flags & (x86_page_entry_data_t)MMU_ENTRY_WRITE ? flags & (x86_page_entry_data_t)MMU_ENTRY_WRITE ?
"Writable" : "Read-only", "Writable" : "Read-only",
flags & (x86_page_entry_data_t)MMU_ENTRY_USER ? flags & (x86_page_entry_data_t)MMU_ENTRY_USER ?
"User" : "Supervisor", "User" : "Supervisor",
flags & (x86_page_entry_data_t)MMU_ENTRY_EXECUTE_DISABLE ? flags & (x86_page_entry_data_t)MMU_ENTRY_EXECUTE_DISABLE ?
"Execute Disable" : "Execute Enabled"); "Execute Disable" : "Execute Enabled");
} }
static void dump_mmu_flags(struct x86_mmu_pdpt *pdpt, void *addr) static void dump_mmu_flags(struct x86_mmu_pdpt *pdpt, void *addr)
@ -306,13 +306,13 @@ static void dump_page_fault(z_arch_esf_t *esf)
__asm__ ("mov %%cr2, %0" : "=r" (cr2)); __asm__ ("mov %%cr2, %0" : "=r" (cr2));
err = esf->errorCode; err = esf->errorCode;
z_fatal_print("***** CPU Page Fault (error code 0x%08x)", err); LOG_ERR("***** CPU Page Fault (error code 0x%08x)", err);
z_fatal_print("%s thread %s address 0x%08x", LOG_ERR("%s thread %s address 0x%08x",
(err & US) != 0U ? "User" : "Supervisor", (err & US) != 0U ? "User" : "Supervisor",
(err & ID) != 0U ? "executed" : ((err & WR) != 0U ? (err & ID) != 0U ? "executed" : ((err & WR) != 0U ?
"wrote" : "wrote" :
"read"), cr2); "read"), cr2);
#ifdef CONFIG_X86_MMU #ifdef CONFIG_X86_MMU
#ifdef CONFIG_X86_KPTI #ifdef CONFIG_X86_KPTI
@ -408,7 +408,7 @@ static __used void df_handler_bottom(void)
_df_tss.esp = (u32_t)(_df_stack + sizeof(_df_stack)); _df_tss.esp = (u32_t)(_df_stack + sizeof(_df_stack));
_df_tss.eip = (u32_t)df_handler_top; _df_tss.eip = (u32_t)df_handler_top;
z_fatal_print("Double Fault"); LOG_ERR("Double Fault");
#ifdef CONFIG_THREAD_STACK_INFO #ifdef CONFIG_THREAD_STACK_INFO
if (check_stack_bounds(_df_esf.esp, 0, _df_esf.cs)) { if (check_stack_bounds(_df_esf.esp, 0, _df_esf.cs)) {
reason = K_ERR_STACK_CHK_FAIL; reason = K_ERR_STACK_CHK_FAIL;

View file

@ -8,8 +8,11 @@
#include <debug/tracing.h> #include <debug/tracing.h>
#include <ksched.h> #include <ksched.h>
#include <irq_offload.h> #include <irq_offload.h>
#include <logging/log.h>
#include "xuk.h" #include "xuk.h"
LOG_MODULE_DECLARE(os);
/* Always pick a lowest priority interrupt for scheduling IPI's, by /* Always pick a lowest priority interrupt for scheduling IPI's, by
* definition they're done on behalf of thread mode code and should * definition they're done on behalf of thread mode code and should
* never preempt a true device interrupt * never preempt a true device interrupt
@ -51,13 +54,13 @@ void z_unhandled_vector(int vector, int err, struct xuk_entry_frame *f)
/* Yes, there are five regsiters missing. See notes on /* Yes, there are five regsiters missing. See notes on
* xuk_entry_frame/xuk_stack_frame. * xuk_entry_frame/xuk_stack_frame.
*/ */
z_fatal_print("*** FATAL ERROR vector %d code %d", vector, err); LOG_ERR("*** FATAL ERROR vector %d code %d", vector, err);
z_fatal_print("*** RIP %d:0x%llx RSP %d:0x%llx RFLAGS 0x%llx", LOG_ERR("*** RIP %d:0x%llx RSP %d:0x%llx RFLAGS 0x%llx",
(int)f->cs, f->rip, (int)f->ss, f->rsp, f->rflags); (int)f->cs, f->rip, (int)f->ss, f->rsp, f->rflags);
z_fatal_print("*** RAX 0x%llx RCX 0x%llx RDX 0x%llx RSI 0x%llx RDI 0x%llx", LOG_ERR("*** RAX 0x%llx RCX 0x%llx RDX 0x%llx RSI 0x%llx RDI 0x%llx",
f->rax, f->rcx, f->rdx, f->rsi, f->rdi); f->rax, f->rcx, f->rdx, f->rsi, f->rdi);
z_fatal_print("*** R8 0x%llx R9 0x%llx R10 0x%llx R11 0x%llx", LOG_ERR("*** R8 0x%llx R9 0x%llx R10 0x%llx R11 0x%llx",
f->r8, f->r9, f->r10, f->r11); f->r8, f->r9, f->r10, f->r11);
/* FIXME: Why isn't xuk_entry_frame a z_arch_esf_t? */ /* FIXME: Why isn't xuk_entry_frame a z_arch_esf_t? */
z_fatal_error(x86_64_except_reason, NULL); z_fatal_error(x86_64_except_reason, NULL);

View file

@ -10,6 +10,8 @@
#include <kernel_arch_data.h> #include <kernel_arch_data.h>
#include <xtensa/specreg.h> #include <xtensa/specreg.h>
#include <xtensa-asm2-context.h> #include <xtensa-asm2-context.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);
#ifdef XT_SIMULATOR #ifdef XT_SIMULATOR
#include <xtensa/simcall.h> #include <xtensa/simcall.h>
@ -101,8 +103,8 @@ XTENSA_ERR_NORET void FatalErrorHandler(void)
XTENSA_ERR_NORET void ReservedInterruptHandler(unsigned int intNo) XTENSA_ERR_NORET void ReservedInterruptHandler(unsigned int intNo)
{ {
z_fatal_print("INTENABLE = 0x%x INTERRUPT = 0x%x (%x)", LOG_ERR("INTENABLE = 0x%x INTERRUPT = 0x%x (%x)",
get_sreg(INTENABLE), (1 << intNo), intNo); get_sreg(INTENABLE), (1 << intNo), intNo);
z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
} }
@ -117,7 +119,7 @@ void exit(int return_code)
: [code] "r" (return_code), [call] "i" (SYS_exit) : [code] "r" (return_code), [call] "i" (SYS_exit)
: "a3", "a2"); : "a3", "a2");
#else #else
z_fatal_print("exit(%d)", return_code); LOG_ERR("exit(%d)", return_code);
k_panic(); k_panic();
#endif #endif
} }

View file

@ -11,6 +11,9 @@
#include <kernel_internal.h> #include <kernel_internal.h>
#include <kswap.h> #include <kswap.h>
#include <_soc_inthandlers.h> #include <_soc_inthandlers.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);
void *xtensa_init_stack(int *stack_top, void *xtensa_init_stack(int *stack_top,
void (*entry)(void *, void *, void *), void (*entry)(void *, void *, void *),
@ -77,8 +80,8 @@ void z_irq_spurious(void *arg)
__asm__ volatile("rsr.interrupt %0" : "=r"(irqs)); __asm__ volatile("rsr.interrupt %0" : "=r"(irqs));
__asm__ volatile("rsr.intenable %0" : "=r"(ie)); __asm__ volatile("rsr.intenable %0" : "=r"(ie));
z_fatal_print(" ** Spurious INTERRUPT(s) %p, INTENABLE = %p", LOG_ERR(" ** Spurious INTERRUPT(s) %p, INTENABLE = %p",
(void *)irqs, (void *)ie); (void *)irqs, (void *)ie);
z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
} }
@ -86,38 +89,37 @@ void z_xtensa_dump_stack(const z_arch_esf_t *stack)
{ {
int *bsa = *(int **)stack; int *bsa = *(int **)stack;
z_fatal_print(" ** A0 %p SP %p A2 %p A3 %p", LOG_ERR(" ** A0 %p SP %p A2 %p A3 %p",
(void *)bsa[BSA_A0_OFF/4], (void *)bsa[BSA_A0_OFF/4],
((char *)bsa) + BASE_SAVE_AREA_SIZE, ((char *)bsa) + BASE_SAVE_AREA_SIZE,
(void *)bsa[BSA_A2_OFF/4], (void *)bsa[BSA_A3_OFF/4]); (void *)bsa[BSA_A2_OFF/4], (void *)bsa[BSA_A3_OFF/4]);
if (bsa - stack > 4) { if (bsa - stack > 4) {
z_fatal_print(" ** A4 %p A5 %p A6 %p A7 %p", LOG_ERR(" ** A4 %p A5 %p A6 %p A7 %p",
(void *)bsa[-4], (void *)bsa[-3], (void *)bsa[-4], (void *)bsa[-3],
(void *)bsa[-2], (void *)bsa[-1]); (void *)bsa[-2], (void *)bsa[-1]);
} }
if (bsa - stack > 8) { if (bsa - stack > 8) {
z_fatal_print(" ** A8 %p A9 %p A10 %p A11 %p", LOG_ERR(" ** A8 %p A9 %p A10 %p A11 %p",
(void *)bsa[-8], (void *)bsa[-7], (void *)bsa[-8], (void *)bsa[-7],
(void *)bsa[-6], (void *)bsa[-5]); (void *)bsa[-6], (void *)bsa[-5]);
} }
if (bsa - stack > 12) { if (bsa - stack > 12) {
z_fatal_print(" ** A12 %p A13 %p A14 %p A15 %p", LOG_ERR(" ** A12 %p A13 %p A14 %p A15 %p",
(void *)bsa[-12], (void *)bsa[-11], (void *)bsa[-12], (void *)bsa[-11],
(void *)bsa[-10], (void *)bsa[-9]); (void *)bsa[-10], (void *)bsa[-9]);
} }
#if XCHAL_HAVE_LOOPS #if XCHAL_HAVE_LOOPS
z_fatal_print(" ** LBEG %p LEND %p LCOUNT %p", LOG_ERR(" ** LBEG %p LEND %p LCOUNT %p",
(void *)bsa[BSA_LBEG_OFF/4], (void *)bsa[BSA_LBEG_OFF/4],
(void *)bsa[BSA_LEND_OFF/4], (void *)bsa[BSA_LEND_OFF/4],
(void *)bsa[BSA_LCOUNT_OFF/4]); (void *)bsa[BSA_LCOUNT_OFF/4]);
#endif #endif
z_fatal_print(" ** SAR %p", (void *)bsa[BSA_SAR_OFF/4]); LOG_ERR(" ** SAR %p", (void *)bsa[BSA_SAR_OFF/4]);
} }
static inline unsigned int get_bits(int offset, int num_bits, unsigned int val) static inline unsigned int get_bits(int offset, int num_bits, unsigned int val)
@ -174,8 +176,8 @@ void *xtensa_excint1_c(int *interrupted_stack)
} else if (cause == EXCCAUSE_SYSCALL) { } else if (cause == EXCCAUSE_SYSCALL) {
/* Just report it to the console for now */ /* Just report it to the console for now */
z_fatal_print(" ** SYSCALL PS %p PC %p", LOG_ERR(" ** SYSCALL PS %p PC %p",
(void *)bsa[BSA_PS_OFF/4], (void *)bsa[BSA_PC_OFF/4]); (void *)bsa[BSA_PS_OFF/4], (void *)bsa[BSA_PC_OFF/4]);
z_xtensa_dump_stack(interrupted_stack); z_xtensa_dump_stack(interrupted_stack);
/* Xtensa exceptions don't automatically advance PC, /* Xtensa exceptions don't automatically advance PC,
@ -189,18 +191,18 @@ void *xtensa_excint1_c(int *interrupted_stack)
__asm__ volatile("rsr.excvaddr %0" : "=r"(vaddr)); __asm__ volatile("rsr.excvaddr %0" : "=r"(vaddr));
z_fatal_print(" ** FATAL EXCEPTION"); LOG_ERR(" ** FATAL EXCEPTION");
z_fatal_print(" ** CPU %d EXCCAUSE %d (%s)", LOG_ERR(" ** CPU %d EXCCAUSE %d (%s)",
z_arch_curr_cpu()->id, cause, z_arch_curr_cpu()->id, cause,
z_xtensa_exccause(cause)); z_xtensa_exccause(cause));
z_fatal_print(" ** PC %p VADDR %p", LOG_ERR(" ** PC %p VADDR %p",
(void *)bsa[BSA_PC_OFF/4], (void *)vaddr); (void *)bsa[BSA_PC_OFF/4], (void *)vaddr);
z_fatal_print(" ** PS %p", (void *)bsa[BSA_PS_OFF/4]); LOG_ERR(" ** PS %p", (void *)bsa[BSA_PS_OFF/4]);
z_fatal_print(" ** (INTLEVEL:%d EXCM: %d UM:%d RING:%d WOE:%d OWB:%d CALLINC:%d)", LOG_ERR(" ** (INTLEVEL:%d EXCM: %d UM:%d RING:%d WOE:%d OWB:%d CALLINC:%d)",
get_bits(0, 4, ps), get_bits(4, 1, ps), get_bits(0, 4, ps), get_bits(4, 1, ps),
get_bits(5, 1, ps), get_bits(6, 2, ps), get_bits(5, 1, ps), get_bits(6, 2, ps),
get_bits(18, 1, ps), get_bits(18, 1, ps),
get_bits(8, 4, ps), get_bits(16, 2, ps)); get_bits(8, 4, ps), get_bits(16, 2, ps));
/* FIXME: legacy xtensa port reported "HW" exception /* FIXME: legacy xtensa port reported "HW" exception
* for all unhandled exceptions, which seems incorrect * for all unhandled exceptions, which seems incorrect

View file

@ -88,27 +88,4 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf);
*/ */
void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf); void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf);
/**
* Print messages related to an exception
*
* This ensures the following:
* - The log system will enter panic mode if it is not already
* - Messages will be sent to printk() or the log subsystem if it is enabled
*
* Log subsystem filtering is disabled.
* To conform with log subsystem semantics, newlines are automatically
* appended, invoke this once per line.
*
* @param fmt Format string
* @param ... Optional list of format arguments
*
* FIXME: Implemented in C file to avoid #include loops, disentangle and
* make this a macro
*/
#if defined(CONFIG_LOG) || defined(CONFIG_PRINTK)
__printf_like(1, 2) void z_fatal_print(const char *fmt, ...);
#else
#define z_fatal_print(...) do { } while (false)
#endif
#endif /* ZEPHYR_INCLUDE_FATAL_H */ #endif /* ZEPHYR_INCLUDE_FATAL_H */

View file

@ -38,13 +38,12 @@ __weak void k_sys_fatal_error_handler(unsigned int reason,
ARG_UNUSED(esf); ARG_UNUSED(esf);
LOG_PANIC(); LOG_PANIC();
z_fatal_print("Halting system"); LOG_ERR("Halting system");
z_arch_system_halt(reason); z_arch_system_halt(reason);
CODE_UNREACHABLE; CODE_UNREACHABLE;
} }
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
#if defined(CONFIG_LOG) || defined(CONFIG_PRINTK)
static const char *thread_name_get(struct k_thread *thread) static const char *thread_name_get(struct k_thread *thread)
{ {
const char *thread_name = k_thread_name_get(thread); const char *thread_name = k_thread_name_get(thread);
@ -74,18 +73,6 @@ static const char *reason_to_str(unsigned int reason)
} }
} }
void z_fatal_print(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
printk("FATAL: ");
vprintk(fmt, ap);
printk("\n");
va_end(ap);
}
#endif /* CONFIG_LOG || CONFIG_PRINTK */
/* LCOV_EXCL_START */ /* LCOV_EXCL_START */
FUNC_NORETURN void k_fatal_halt(unsigned int reason) FUNC_NORETURN void k_fatal_halt(unsigned int reason)
{ {
@ -93,7 +80,6 @@ FUNC_NORETURN void k_fatal_halt(unsigned int reason)
} }
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf) void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{ {
struct k_thread *thread = k_current_get(); struct k_thread *thread = k_current_get();
@ -101,8 +87,7 @@ void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
/* sanitycheck looks for the "ZEPHYR FATAL ERROR" string, don't /* sanitycheck looks for the "ZEPHYR FATAL ERROR" string, don't
* change it without also updating sanitycheck * change it without also updating sanitycheck
*/ */
z_fatal_print(">>> ZEPHYR FATAL ERROR %d: %s", reason, LOG_ERR(">>> ZEPHYR FATAL ERROR %d: %s", reason, reason_to_str(reason));
reason_to_str(reason));
/* FIXME: This doesn't seem to work as expected on all arches. /* FIXME: This doesn't seem to work as expected on all arches.
* Need a reliable way to determine whether the fault happened when * Need a reliable way to determine whether the fault happened when
@ -115,8 +100,8 @@ void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
* } * }
*/ */
z_fatal_print("Current thread: %p (%s)", thread, LOG_ERR("Current thread: %p (%s)", thread,
thread_name_get(thread)); log_strdup(thread_name_get(thread)));
k_sys_fatal_error_handler(reason, esf); k_sys_fatal_error_handler(reason, esf);