InternalX86EnablePaging64() does a call to the new 64-bit entry point. This 
call breaks our debugger stack walking code. We need it to be a push $0/jmp. In 
place of a call. The push $0/jmp makes the return address from the call be 0, 
and this tells the debugger to stop walking the frame. In clang and some 
flavors of GCC all C functions spill enough state to the stack so that you can 
walk the stack via an algorithm (on VC++ for X64 you need symbols). 

If this change is OK with folks I can submit a patch.

https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S
    #
    # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
    # in case the callee wishes to spill them.
    #
    lea     -0x20(%r9), %rsp
    pushq   $0        // stop gdb stack unwind
    jmp     *%rax     // call EntryPoint ()

https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
    .byte   0x48
    addl    $0x-0x20, %esp              # add rsp, -20h
    call    *%ebx                       # call rbx
    jmp     .                           # no one should get here
So what we would like to see is:
    .byte   0x48
    addl    $0x-0x20, %esp              # add rsp, -20h
    push    $0        // stop gdb stack unwind
    jmp     *%ebx     // call EntryPoint ()



Thanks,

Andrew Fish
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to