From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?GB2312?B?zuLI8Q==?= <19890121wr@gmail.com> Subject: Fwd: about page table Date: Mon, 12 Sep 2011 17:16:33 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1015080626==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1015080626== Content-Type: multipart/alternative; boundary=e89a8f642d44b9498804acbafbd1 --e89a8f642d44b9498804acbafbd1 Content-Type: text/plain; charset=ISO-8859-1 Hi,everyone I have been using dbg_pv_va2mfn() function to scan PV dom's page table.However,when i intended to modify the page table's entry.Something went wrong. Should I modify the P2M and M2P table,either?But I kind of lose track of how things work at P2M and M2P table.Can someone tell me something about these tables. Or can someone can tell me which function can come in handy,or where to look in. I am in the middle of a project that needs to manipulate the page table in dom. For example, static unsigned long dbg_pv_va2mfn(dbgva_t vaddr, struct domain *dp, uint64_t pgd3val) { l3_pgentry_t l3e, *l3t; l2_pgentry_t l2e, *l2t; l1_pgentry_t l1e, *l1t; unsigned long cr3 = (pgd3val ? pgd3val : dp->vcpu[0]->arch.cr3); unsigned long mfn = cr3 >> PAGE_SHIFT; DBGP2("vaddr:%lx domid:%d cr3:%lx pgd3:%lx\n", vaddr, dp->domain_id, cr3, pgd3val); if ( pgd3val == 0 ) { l3t = map_domain_page(mfn); l3t += (cr3 & 0xFE0UL) >> 3; l3e = l3t[l3_table_offset(vaddr)]; mfn = l3e_get_pfn(l3e); unmap_domain_page(l3t); if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) return INVALID_MFN; } l2t = map_domain_page(mfn); l2e = l2t[l2_table_offset(vaddr)]; mfn = l2e_get_pfn(l2e); unmap_domain_page(l2t); if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || (l2e_get_flags(l2e) & _PAGE_PSE) ) return INVALID_MFN; l1t = map_domain_page(mfn); l1e = l1t[l1_table_offset(vaddr)];----------------------------------(1) mfn = l1e_get_pfn(l1e);----------------------------------------------(2) unmap_domain_page(l1t); return mfn_valid(mfn) ? mfn : INVALID_MFN; } What should i do if i want to change the l1e page table entry.I allocate a page using the function alloc_domheap_page,and use l1e_from_page() to write the l1e entry,but it proved to be wrong,and my system keeps reboot itself. Can anyone gives me a hand? Thanks --e89a8f642d44b9498804acbafbd1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,everyone
I have been using dbg_pv_va2mfn()= function to scan PV dom's page table.However,when i intended to modify= the page table's entry.Something went wrong.
Should I modify the P= 2M and M2P table,either?But I kind of lose track of how things work at P2M = and M2P table.Can someone tell me something about these tables.
Or can someone can tell me which function can come in handy,or where t= o look in.
I am in the middle of =A0a project that needs to manip= ulate the page table in dom.
For example,
static u= nsigned long=A0
dbg_pv_va2mfn(dbgva_t vaddr, struct domain *dp, uint64_t pgd3val)
{
=A0 =A0 l3_pgentry_t l3e, *l3t;
=A0 =A0 l2_pgen= try_t l2e, *l2t;
=A0 =A0 l1_pgentry_t l1e, *l1t;
=A0 = =A0 unsigned long cr3 =3D (pgd3val ? pgd3val : dp->vcpu[0]->arch.cr3)= ;
=A0 =A0 unsigned long mfn =3D cr3 >> PAGE_SHIFT;

<= /div>
=A0 =A0 DBGP2("vaddr:%lx domid:%d cr3:%lx pgd3:%lx\n", = vaddr, dp->domain_id,=A0
=A0 =A0 =A0 =A0 =A0 cr3, pgd3val);

=A0 =A0 if ( pgd3val =3D=3D 0 )
=A0 =A0 {
=A0 =A0 = =A0 =A0 l3t =A0=3D map_domain_page(mfn);
=A0 =A0 =A0 =A0 l3t +=3D= (cr3 & 0xFE0UL) >> 3;
=A0 =A0 =A0 =A0 l3e =3D l3t[l3_t= able_offset(vaddr)];
=A0 =A0 =A0 =A0 mfn =3D l3e_get_pfn(l3e);
=A0 =A0 =A0 =A0 unmap_domain_page(l3t);
=A0 =A0 =A0 =A0 if (= !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
=A0 =A0 =A0 =A0 =A0 = =A0 return INVALID_MFN;
=A0 =A0 }

=A0 = =A0 l2t =3D map_domain_page(mfn);
=A0 =A0 l2e =3D l2t[l2_table_offset(vaddr)];
=A0 =A0 mfn =3D= l2e_get_pfn(l2e);
=A0 =A0 unmap_domain_page(l2t);
=A0 = =A0 if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ||=A0
=A0 =A0 = =A0 =A0 =A0(l2e_get_flags(l2e) & _PAGE_PSE) )
=A0 =A0 =A0 =A0 return INVALID_MFN;

=A0 =A0 l= 1t =3D map_domain_page(mfn);
=A0 =A0 l1e =3D l1t[l1_table_offset(= vaddr)];----------------------------------(1)
=A0 =A0 mfn =3D l1e= _get_pfn(l1e);----------------------------------------------(2) =A0 =A0=A0<= /div>
=A0 =A0 unmap_domain_page(l1t);

=A0 =A0 retur= n mfn_valid(mfn) ? mfn : INVALID_MFN;
}
What shou= ld i do if i want to change the l1e page table entry.I allocate a page usin= g the function alloc_domheap_page,and use l1e_from_page() to write the l1e = entry,but it proved to be wrong,and my system keeps reboot itself.
Can anyone gives me a hand?=A0
=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0Thanks

--e89a8f642d44b9498804acbafbd1-- --===============1015080626== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1015080626==--