[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] What function pointer does %%gs contain?



The function address that is pushed by the individual fault handlers
before they call the common error_code path. It's a gross abuse of the
GS symbolic constant. :-)

Try running through one of the fault paths by hand, writing down the
stack state at each step...

 HTH,
 Keir

> I'm searching Xen's source code to understand exception handling. I've
> pasted a piece of code below.
> 
> In arch/x86/x86_32/entry.S:
> error_code:
>       pushl %fs
>       pushl %es
>       pushl %ds
>       pushl %eax
>       xorl  %eax,%eax
>       pushl %ebp
>       pushl %edi
>       pushl %esi
>       pushl %edx
>       decl  %eax                      # eax = -1
>       pushl %ecx
>       pushl %ebx
>       cld
>       movl  %gs,%ecx
>       movl  ORIG_EAX(%esp), %esi      # get the error code
>       movl  GS(%esp), %edi            # get the function address
>       movl  %eax, ORIG_EAX(%esp)
>       movl  %ecx, GS(%esp)
>       movl  $(__HYPERVISOR_DS),%edx
>       movl  %edx,%ds
>       movl  %edx,%es
>       movl  %edx,%fs
>       movl  %edx,%gs
>       movl  %esp,%edx
>       pushl %esi                      # push the error code
>       pushl %edx                      # push the pt_regs pointer
>       GET_CURRENT(%ebx)
>       call  *%edi
>         addl  $8,%esp
>         movb  CS(%esp),%al
>       testb $3,%al
>       je    restore_all_xen
>         jmp   process_guest_exception_and_events
> 
> But I can not understand what function does following sentence refer to
>       movl  GS(%esp), %edi            # get the function address
> Where does it come from?
> 
> Thanks,
> Benjamin
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/xen-devel
 -=- MIME -=- 
I'm searching Xen's source code to understand exception handling. I've
pasted a piece of code below.

In arch/x86/x86_32/entry.S:
error_code:
        pushl %fs
        pushl %es
        pushl %ds
        pushl %eax
        xorl  %eax,%eax
        pushl %ebp
        pushl %edi
        pushl %esi
        pushl %edx
        decl  %eax                      # eax =3D -1
        pushl %ecx
        pushl %ebx
        cld
        movl  %gs,%ecx
        movl  ORIG_EAX(%esp), %esi      # get the error code
        movl  GS(%esp), %edi            # get the function address
        movl  %eax, ORIG_EAX(%esp)
        movl  %ecx, GS(%esp)
        movl  $(__HYPERVISOR_DS),%edx
        movl  %edx,%ds
        movl  %edx,%es
        movl  %edx,%fs
        movl  %edx,%gs
        movl  %esp,%edx
        pushl %esi                      # push the error code
        pushl %edx                      # push the pt_regs pointer
        GET_CURRENT(%ebx)
        call  *%edi
        addl  $8,%esp
        movb  CS(%esp),%al
        testb $3,%al
        je    restore_all_xen
        jmp   process_guest_exception_and_events

But I can not understand what function does following sentence refer to
        movl  GS(%esp), %edi            # get the function address
Where does it come from?

Thanks,
Benjamin


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.