Hi, I am trying to understand the exception handler of Xen. In
xen/arch/x86/x86_64/entry.S, the entry of the page fault handler is :
ENTRY(page_fault)
movl $TRAP_page_fault,4(%rsp)
jmp handle_exception
Here I did not get why to put the exception vector ($TRAP_page_fault) to
stack before calling handle_exception?
Thanks,
--
Xinxin
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
On 02/10/2012 21:51, Xinxin Jin wrote:> Hi, I am trying to understand the exception handler of Xen. In > xen/arch/x86/x86_64/entry.S, the entry of the page fault handler is : > > ENTRY(page_fault) > movl $TRAP_page_fault,4(%rsp) > jmp handle_exception > > Here I did not get why to put the exception vector ($TRAP_page_fault) > to stack before calling handle_exception?This is so every single exception fills in its cpu_user_regs with the correct trap, so the C code an distinguish if its needs to. (See current.h for the structures which get filled in) ~Andrew> > Thanks, > > -- > Xinxin >
On 02/10/2012 21:51, "Xinxin Jin" <xinxinjin89@gmail.com> wrote:> Hi, I am trying to understand the exception handler of Xen. In > xen/arch/x86/x86_64/entry.S, the entry of the page fault handler is : > > ENTRY(page_fault) > movl $TRAP_page_fault,4(%rsp) > jmp handle_exception > > Here I did not get why to put the exception vector ($TRAP_page_fault) to stack > before calling handle_exception?Otherwise handle_exception would not know which type of exception it was handling, would it. -- Keir> Thanks,