I''m trying to retrieve and print the interrupt descriptor table of a guest OS but every address is coming out 0x00000000. Here''s what I''m doing: vcpu_guest_context_t ctx; int i; int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0, &ctx); if (res < 0) { fprintf (stderr, "xc_vcpu_getcontext failed!\n"); return; } for (i = 0 ; i < 256 ; ++i) { printf ("Interrupt %d: Address 0x%08x\n", i, ctx.trap_ctxt[i].address); } I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP Pro and Vista Ultimate, though I assume that part doesn''t matter since the IDT is a processor structure. Any help is greatly appreciated. -matthew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
That''s very wishful code! Unfortunately the IDTR is not exposed via vcpu_context for HVM guests. The only way to get it right now is to do a hvm save hypercall and then parse the pickled state to find the IDTR. It actually should be quite easy. -- Keir On 31/1/08 21:31, "Matthew Donovan" <matthew@atc-nycorp.com> wrote:> > I''m trying to retrieve and print the interrupt descriptor table of a guest > OS but every address is coming out 0x00000000. > > Here''s what I''m doing: > > vcpu_guest_context_t ctx; > int i; > > int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0, &ctx); > if (res < 0) { > fprintf (stderr, "xc_vcpu_getcontext failed!\n"); > return; > } > > for (i = 0 ; i < 256 ; ++i) { > printf ("Interrupt %d: Address 0x%08x\n", > i, > ctx.trap_ctxt[i].address); > } > > > I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP Pro and > Vista Ultimate, though I assume that part doesn''t matter since the IDT is a > processor structure. > > Any help is greatly appreciated. > -matthew > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
But one could get the IDTR for a para-virt guest? Out of curiousity, how hard would it be to do it for HVM guests? -matthew -----Original Message----- From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] Sent: Friday, February 01, 2008 3:40 AM To: Matthew Donovan; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Get IDT from virtual machine That''s very wishful code! Unfortunately the IDTR is not exposed via vcpu_context for HVM guests. The only way to get it right now is to do a hvm save hypercall and then parse the pickled state to find the IDTR. It actually should be quite easy. -- Keir On 31/1/08 21:31, "Matthew Donovan" <matthew@atc-nycorp.com> wrote:> > I''m trying to retrieve and print the interrupt descriptor table of a > guest OS but every address is coming out 0x00000000. > > Here''s what I''m doing: > > vcpu_guest_context_t ctx; > int i; > > int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0,&ctx);> if (res < 0) { > fprintf (stderr, "xc_vcpu_getcontext failed!\n"); > return; > } > > for (i = 0 ; i < 256 ; ++i) { > printf ("Interrupt %d: Address 0x%08x\n", > i, > ctx.trap_ctxt[i].address); > } > > > I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP Pro > and Vista Ultimate, though I assume that part doesn''t matter since the > IDT is a processor structure. > > Any help is greatly appreciated. > -matthew > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yes, your code extracts the virtual IDT for a PV guest. As I said below, doing it for an HVM guest requires you to issue a hvm-save-state hypercall and then pick apart the binary structure that is returned. -- Keir On 1/2/08 17:20, "Matthew Donovan" <matthew@atc-nycorp.com> wrote:> But one could get the IDTR for a para-virt guest? Out of curiousity, how > hard would it be to do it for HVM guests? > > -matthew > > -----Original Message----- > From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] > Sent: Friday, February 01, 2008 3:40 AM > To: Matthew Donovan; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Get IDT from virtual machine > > That''s very wishful code! Unfortunately the IDTR is not exposed via > vcpu_context for HVM guests. The only way to get it right now is to do a hvm > save hypercall and then parse the pickled state to find the IDTR. It > actually should be quite easy. > > -- Keir > > On 31/1/08 21:31, "Matthew Donovan" <matthew@atc-nycorp.com> wrote: > >> >> I''m trying to retrieve and print the interrupt descriptor table of a >> guest OS but every address is coming out 0x00000000. >> >> Here''s what I''m doing: >> >> vcpu_guest_context_t ctx; >> int i; >> >> int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0, > &ctx); >> if (res < 0) { >> fprintf (stderr, "xc_vcpu_getcontext failed!\n"); >> return; >> } >> >> for (i = 0 ; i < 256 ; ++i) { >> printf ("Interrupt %d: Address 0x%08x\n", >> i, >> ctx.trap_ctxt[i].address); >> } >> >> >> I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP Pro >> and Vista Ultimate, though I assume that part doesn''t matter since the >> IDT is a processor structure. >> >> Any help is greatly appreciated. >> -matthew >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I''m sorry if I wasn''t clear. I was wondering why xc_vcpu_getcontext doesn''t get the IDT for HVM guests and what would be required to make it work. -matthew -----Original Message----- From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] Sent: Saturday, February 02, 2008 5:19 AM To: Matthew Donovan; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Get IDT from virtual machine Yes, your code extracts the virtual IDT for a PV guest. As I said below, doing it for an HVM guest requires you to issue a hvm-save-state hypercall and then pick apart the binary structure that is returned. -- Keir On 1/2/08 17:20, "Matthew Donovan" <matthew@atc-nycorp.com> wrote:> But one could get the IDTR for a para-virt guest? Out of curiousity, > how hard would it be to do it for HVM guests? > > -matthew > > -----Original Message----- > From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] > Sent: Friday, February 01, 2008 3:40 AM > To: Matthew Donovan; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Get IDT from virtual machine > > That''s very wishful code! Unfortunately the IDTR is not exposed via > vcpu_context for HVM guests. The only way to get it right now is to do > a hvm save hypercall and then parse the pickled state to find the > IDTR. It actually should be quite easy. > > -- Keir > > On 31/1/08 21:31, "Matthew Donovan" <matthew@atc-nycorp.com> wrote: > >> >> I''m trying to retrieve and print the interrupt descriptor table of a >> guest OS but every address is coming out 0x00000000. >> >> Here''s what I''m doing: >> >> vcpu_guest_context_t ctx; >> int i; >> >> int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0, > &ctx); >> if (res < 0) { >> fprintf (stderr, "xc_vcpu_getcontext failed!\n"); >> return; >> } >> >> for (i = 0 ; i < 256 ; ++i) { >> printf ("Interrupt %d: Address 0x%08x\n", >> i, >> ctx.trap_ctxt[i].address); >> } >> >> >> I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP >> Pro and Vista Ultimate, though I assume that part doesn''t matter >> since the IDT is a processor structure. >> >> Any help is greatly appreciated. >> -matthew >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
The IDT isn''t even necessarily expressible as a PV ''trap_table'': e.g., task gates can''t be expressed, nor can the interrupt-stack selector bits in a 64-bit gate. -- Keir On 4/2/08 13:28, "Matthew Donovan" <matthew@atc-nycorp.com> wrote:> I''m sorry if I wasn''t clear. I was wondering why xc_vcpu_getcontext doesn''t > get the IDT for HVM guests and what would be required to make it work. > > -matthew > > -----Original Message----- > From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] > Sent: Saturday, February 02, 2008 5:19 AM > To: Matthew Donovan; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Get IDT from virtual machine > > Yes, your code extracts the virtual IDT for a PV guest. As I said below, > doing it for an HVM guest requires you to issue a hvm-save-state hypercall > and then pick apart the binary structure that is returned. > > -- Keir > > > On 1/2/08 17:20, "Matthew Donovan" <matthew@atc-nycorp.com> wrote: > >> But one could get the IDTR for a para-virt guest? Out of curiousity, >> how hard would it be to do it for HVM guests? >> >> -matthew >> >> -----Original Message----- >> From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] >> Sent: Friday, February 01, 2008 3:40 AM >> To: Matthew Donovan; xen-devel@lists.xensource.com >> Subject: Re: [Xen-devel] Get IDT from virtual machine >> >> That''s very wishful code! Unfortunately the IDTR is not exposed via >> vcpu_context for HVM guests. The only way to get it right now is to do >> a hvm save hypercall and then parse the pickled state to find the >> IDTR. It actually should be quite easy. >> >> -- Keir >> >> On 31/1/08 21:31, "Matthew Donovan" <matthew@atc-nycorp.com> wrote: >> >>> >>> I''m trying to retrieve and print the interrupt descriptor table of a >>> guest OS but every address is coming out 0x00000000. >>> >>> Here''s what I''m doing: >>> >>> vcpu_guest_context_t ctx; >>> int i; >>> >>> int res = xc_vcpu_getcontext (xai->xc_handle, xai->domain_id, 0, >> &ctx); >>> if (res < 0) { >>> fprintf (stderr, "xc_vcpu_getcontext failed!\n"); >>> return; >>> } >>> >>> for (i = 0 ; i < 256 ; ++i) { >>> printf ("Interrupt %d: Address 0x%08x\n", >>> i, >>> ctx.trap_ctxt[i].address); >>> } >>> >>> >>> I''m using Xen 3.1.2 on Fedora Core 8. The guest OS''s have been XP >>> Pro and Vista Ultimate, though I assume that part doesn''t matter >>> since the IDT is a processor structure. >>> >>> Any help is greatly appreciated. >>> -matthew >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >> >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel