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

Re: [Xen-devel] [PATCH 02/38] arm: handy function to print a walk of the hypervisor page tables



At 12:57 +0100 on 07 Jun (1339073860), Ian Campbell wrote:
> On Thu, 2012-06-07 at 09:45 +0100, Tim Deegan wrote:
> > Hi,
> > 
> > At 15:39 +0000 on 01 Jun (1338565171), Ian Campbell wrote:
> > > +void dump_pt_walk(uint32_t addr)
> > > +{
> > > +    paddr_t second_ma, third_ma;
> > > +    lpae_t *first = NULL, *second = NULL, *third = NULL;
> > > +    uint64_t httbr = READ_CP64(HTTBR);
> > > +
> > > +    printk("Walking Hypervisor VA %#"PRIx32" via HTTBR %#"PRIx64"\n",
> > > +           addr, httbr);
> > > +
> > > +    BUG_ON( (lpae_t *)(unsigned long)(httbr - xen_phys_offset) != 
> > > xen_pgtable );
> > > +    first = xen_pgtable;
> > > +    printk("1ST[%#03"PRIx32"] = %p[%#03"PRIx32"] = %#llx = %#016llx\n",
> > > +           first_table_offset(addr),
> > > +           first, first_table_offset(addr),
> > > +           virt_to_maddr(&first[first_table_offset(addr)]),
> > > +           first[first_table_offset(addr)].bits);
> > > +
> > > +    if ( !first[first_table_offset(addr)].pt.valid ||
> > > +         !first[first_table_offset(addr)].pt.table )
> > > +        goto done;
> > 
> > This could probably be a for loop rather than open-coding three
> > almost-identical printks.
> 
> The *_table_offsets macro names are different at each stage, I suppose I
> could open code the equivalent shifts, but I'd rather keep using the
> access macros.

Ah, OK.  In that case, open-coded is fine. 

Tim.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.