Skip to content

Commit

Permalink
xtensa: limit speical exit() to XT_SIMULATOR
Browse files Browse the repository at this point in the history
Use the common exit() provided by libc so we get standard behavior
across all architectures.  So only implement a special exit when
XT_SIMULATOR is defined.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak authored and carlescufi committed May 8, 2023
1 parent 4421b80 commit f8ddd3d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions arch/xtensa/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,18 @@ void z_xtensa_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
z_fatal_error(reason, esf);
}

#ifdef XT_SIMULATOR
void exit(int return_code)
{
#ifdef XT_SIMULATOR
__asm__ (
"mov a3, %[code]\n\t"
"movi a2, %[call]\n\t"
"simcall\n\t"
:
: [code] "r" (return_code), [call] "i" (SYS_exit)
: "a3", "a2");
#else
LOG_ERR("exit(%d)", return_code);
k_panic();
#endif
CODE_UNREACHABLE;
}
#endif

#ifdef XT_SIMULATOR
FUNC_NORETURN void z_system_halt(unsigned int reason)
Expand Down

0 comments on commit f8ddd3d

Please sign in to comment.