From 19d4caaaabf751347c5289a1e6c05a1a2d86d24a Mon Sep 17 00:00:00 2001 From: Alexey Brodkin Date: Wed, 16 Oct 2019 14:44:16 +0300 Subject: [PATCH] arch: arc: Implement z_arch_system_halt() "brk" is a break-point instruction which among other things halts ARC core. As compared to pure halt (which is "flag 1" for ARC) it is much more convenient as it might be executed from either secure mode or normal mode (with SecureShield enabled), while "flag" instruction will raise privilege violation exception if SecureShield is enabled and we're in "normal" mode. Signed-off-by: Alexey Brodkin --- arch/arc/core/fatal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arc/core/fatal.c b/arch/arc/core/fatal.c index 3f5bbc67931..c14a0e2c7fd 100644 --- a/arch/arc/core/fatal.c +++ b/arch/arc/core/fatal.c @@ -34,3 +34,12 @@ FUNC_NORETURN void z_arch_syscall_oops(void *ssf_ptr) z_arc_fatal_error(K_ERR_KERNEL_OOPS, ssf_ptr); CODE_UNREACHABLE; } + +FUNC_NORETURN void z_arch_system_halt(unsigned int reason) +{ + ARG_UNUSED(reason); + + __asm__("brk"); + + CODE_UNREACHABLE; +}