[haiku-commits] Re: BRANCH xyzzy-github.x86_64 - src/system/kernel/arch/x86/64

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 14 Aug 2012 20:33:31 +0200

xyzzy-github.x86_64 wrote:
> +static void
> +x86_64_general_protection_fault(iframe* frame)
> +{
> + if (debug_debugger_running()) {
> + // Handle GPFs if there is a debugger fault handler installed, for
> + // non-canonical address accesses.
> + cpu_ent* cpu = &gCPU[smp_get_current_cpu()];
> + if (cpu->fault_handler != 0) {
> + debug_set_page_fault_info(0, frame->ip, DEBUG_PAGE_FAULT_NO_INFO);
> + frame->ip = cpu->fault_handler;
> + frame->bp = cpu->fault_handler_stack_pointer;
> + return;
> + }
> + }
> +
> + x86_unexpected_exception(frame);
> +}

This does, of course, also catch all cases where the #GP is generated for a 
different reason than dereferencing a non-canonical address. I'm undecided, 
maybe this is a good thing and should also be done for x86.

CU, Ingo

Other related posts: