RE: [Xen-devel] Read value of CR3 from DomU VCPU
I looked at the xc_translate_foreign_address() in
tools/libxc/xc_pagetab.c and tried to emulate it. The function below void
do_jeet1() is a hypercall handler function for my custom hypercall to get the
value of CR3 from the guest VCPU. But when I try to call this hypercall, my
machine automatically boots up. Any thoughts?
unsigned long pgdaddr;
printk ("Successfull Hypercall made to __HYPERVISOR_jeet1\n");
pgdaddr = xen_cr3_to_pfn(ctx.nat->ctrlreg);
printk ("PGDADDR:%lx\n", pgdaddr);
From: Tim Deegan [Tim.Deegan@xxxxxxxxxx]
Sent: Thursday, May 05, 2011 2:33 AM
To: Nimgaonkar, Satyajeet
Subject: Re: [Xen-devel] Read value of CR3 from DomU VCPU
At 21:28 +0100 on 04 May (1304544537), Nimgaonkar, Satyajeet wrote:
> I intend to map the DomU kernel memory to the Dom0 using the
> function xc_map_foreign_range(). For this I need the machine frame
> number (mfn) for the page I want to map. To get the value of mfn I want
> to read the value of cr3 from the DomU Vcpu data structure i.e. the
> value of ctrlreg from a vcpu_guest_context object.
Look at xc_translate_foreign_address() in tools/libxc/xc_pagetab.c; it
does VA->MFN translations, including extracting CR3.
> Also I have implemented a hypercall and wish to read the cr3 value in the
> hypercall handler.
> Can anyone share some information regarding how read the cr3 value. Any code
> examples would help me significantly.
> Thanks a lot.
> Xen-devel mailing list
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
Xen-devel mailing list