From 3f51dabd0830f4351d2a3d1cfda85cd3cc67b928 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 28 Mar 2007 15:59:51 +0000 Subject: [PATCH] Another fault handler instance where we have to trick gcc4 not to optimize our code away. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20450 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/system/kernel/arch/x86/arch_debug.c b/src/system/kernel/arch/x86/arch_debug.c index 0fe23e3afc..bbfe17353c 100644 --- a/src/system/kernel/arch/x86/arch_debug.c +++ b/src/system/kernel/arch/x86/arch_debug.c @@ -57,6 +57,10 @@ get_next_frame(addr_t ebp, addr_t *_next, addr_t *_eip) { // set fault handler, so that we can safely access user stacks thread_get_current_thread()->fault_handler = (addr_t)&&error; + // Fake goto to trick the compiler not to optimize the code at the label + // away. + if (ebp == 0) + goto error; *_eip = ((struct stack_frame *)ebp)->return_address; *_next = (addr_t)((struct stack_frame *)ebp)->previous;