Re: [patch 31/43] lguest: Boot with virtual == physical to get closer to native Linux.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-09-26 at 17:12 -0700, Jeremy Fitzhardinge wrote:
> rusty@xxxxxxxxxxxxxxx wrote:
> > +/* We walk down the guest page tables to get a guest-physical address */
> > +unsigned long guest_pa(struct lguest *lg, unsigned long vaddr)
> > +{
> > +	pgd_t gpgd;
> > +	pte_t gpte;
> > +
> > +	/* First step: get the top-level Guest page table entry. */
> > +	gpgd = __pgd(lgread_u32(lg, gpgd_addr(lg, vaddr)));
> > +	/* Toplevel not present?  We can't map it in. */
> > +	if (!(pgd_flags(gpgd) & _PAGE_PRESENT))
> > +		kill_guest(lg, "Bad address %#lx", vaddr);
> > +
> > +	gpte = __pte(lgread_u32(lg, gpte_addr(lg, gpgd, vaddr)));
> > +	if (!(pte_flags(gpte) & _PAGE_PRESENT))
> > +		kill_guest(lg, "Bad address %#lx", vaddr);
> > +
> > +	return pte_pfn(gpte) * PAGE_SIZE | (vaddr & ~PAGE_MASK);
> > +}
> 
> That's nice and general, but is it necessary?  Is this just to handle
> the two cases of booting with P=V, then switching to the normal kernel
> offset?

Hi Jeremy,

	It's probably overkill, but it has the advantage of being
straightforward and futureproof.

Cheers,
Rusty.


_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux