WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Liu, Benjamin" <benjamin.liu@xxxxxxxxx>
Subject: Re: [Xen-devel] What function pointer does %%gs contain?
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Mon, 18 Oct 2004 09:44:25 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 18 Oct 2004 10:35:05 +0100
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: Your message of "Mon, 18 Oct 2004 15:31:13 +0800." <3ACA40606221794F80A5670F0AF15F8404BFDBB9@pdsmsx403>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>