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

  • From: Alex Smith <alex@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 14 Aug 2012 23:35:23 +0100

On 14 August 2012 19:33, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:

> 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.
>

Yeah, unfortunately as far as I'm aware there's no way to detect whether or
not the fault was caused by a non-canonical address access. Don't really
see any reason for #GP to be caught otherwise, I don't think it should
occur in the debugger on x86 unless something is seriously broken.

Thanks,
Alex

Other related posts: