x86: fatal: Remove possible deadcode
esf_get_sp is used only when CONFIG_THREAD_STACK_INFO is enabled.
Just move this function around to be inside an ifdef guard.
@@ -33,25 +33,26 @@ FUNC_NORETURN void arch_system_halt(unsigned int reason)
}
#endif
-static inline uintptr_t esf_get_sp(const z_arch_esf_t *esf)
+static inline uintptr_t esf_get_code(const z_arch_esf_t *esf)
{
#ifdef CONFIG_X86_64
- return esf->rsp;
+ return esf->code;
#else
- return esf->esp;
+ return esf->errorCode;
#endif
}
-static inline uintptr_t esf_get_code(const z_arch_esf_t *esf)
+#ifdef CONFIG_THREAD_STACK_INFO
+
+static inline uintptr_t esf_get_sp(const z_arch_esf_t *esf)
{
#ifdef CONFIG_X86_64
- return esf->code;
+ return esf->rsp;
#else
- return esf->errorCode;
+ return esf->esp;
#endif
}
-#ifdef CONFIG_THREAD_STACK_INFO
__pinned_func
bool z_x86_check_stack_bounds(uintptr_t addr, size_t size, uint16_t cs)
{
