Hi, I have created hypercalls that can be invoked from ring-3 by setting the ring-3 gate in xen. This works fine when I invoke the hypercall from Dom0. I want to invoke the same from a HVM DomU. But I keep getting the segmentation fault when I invoke the ring3_hyperacall from HVM DomU. Any ideas? *The setting up gate is as follows:* _set_gate(idt_table+0x92, 14, 3, &hypercall); * The hypercall invoking code looks like this:* int ring3_hypercall(unsigned long va, int command) { int ret; asm("int $0x92" : "=a"(ret) : "a"(40), "b"(va), "c"(command)); return ret; } ~ SDK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
That is because "int $0x92" only switch the context to guest''s IDT instead of hypervisor''s IDT by default. Xiantao From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Srujan Kotikela Sent: Saturday, December 03, 2011 4:52 AM To: xen-devel@lists.xensource.com Subject: [Xen-devel] Ring3 Hypercalls from HVM DomU Hi, I have created hypercalls that can be invoked from ring-3 by setting the ring-3 gate in xen. This works fine when I invoke the hypercall from Dom0. I want to invoke the same from a HVM DomU. But I keep getting the segmentation fault when I invoke the ring3_hyperacall from HVM DomU. Any ideas? The setting up gate is as follows: _set_gate(idt_table+0x92, 14, 3, &hypercall); The hypercall invoking code looks like this: int ring3_hypercall(unsigned long va, int command) { int ret; asm("int $0x92" : "=a"(ret) : "a"(40), "b"(va), "c"(command)); return ret; } ~ SDK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
At 14:52 -0600 on 02 Dec (1322837525), Srujan Kotikela wrote:> Hi, > > I have created hypercalls that can be invoked from ring-3 by setting the > ring-3 gate in xen. This works fine when I invoke the hypercall from Dom0. > I want to invoke the same from a HVM DomU. But I keep getting the > segmentation fault when I invoke the ring3_hyperacall from HVM DomU. Any > ideas? > > *The setting up gate is as follows:* > _set_gate(idt_table+0x92, 14, 3, &hypercall); > * > The hypercall invoking code looks like this:* > int ring3_hypercall(unsigned long va, int command) > { > int ret; > > asm("int $0x92" : "=a"(ret) : "a"(40), "b"(va), "c"(command));In a HVM guest this won''t trap to the hypervisor. You''ll need to replace it with something that causes a VMEXIT. The obvious candidate is VMCALL but that will just raise #UD from ring 3. You could try piggybacking on the CPUID intercept or something like that. Tim.
On Mon, 2011-12-05 at 06:23 +0000, Zhang, Xiantao wrote:> That is because “int $0x92” only switch the context to guest’s IDT > instead of hypervisor’s IDT by default."by default"? Is there some mechanism by which an int instruction in non-root mode can cause a vmexit to a host IDT entry instead of the guest IDT? I didn't see it based on a quick skim of relevant chapters of the SDM. Ian.> > Xiantao > > > > From: xen-devel-bounces@lists.xensource.com > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Srujan > Kotikela > Sent: Saturday, December 03, 2011 4:52 AM > To: xen-devel@lists.xensource.com > Subject: [Xen-devel] Ring3 Hypercalls from HVM DomU > > > > Hi, > > > > > I have created hypercalls that can be invoked from ring-3 by setting > the ring-3 gate in xen. This works fine when I invoke the hypercall > from Dom0. I want to invoke the same from a HVM DomU. But I keep > getting the segmentation fault when I invoke the ring3_hyperacall from > HVM DomU. Any ideas? > > The setting up gate is as follows: > _set_gate(idt_table+0x92, 14, 3, &hypercall); > > > > The hypercall invoking code looks like this: > int ring3_hypercall(unsigned long va, int command) > { > int ret; > > asm("int $0x92" : "=a"(ret) : "a"(40), "b"(va), "c"(command)); > > return ret; > } > > ~ SDK > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel