On Sun, Sep 10, 2017 at 01:45:39PM +0200, Maxime Villard wrote:
> > it is a VA (it's a pointer to a pte, not the pte iself)
> 
> Sorry, I meant the contrary: it is called with a va, while it should take a
> pte. Right now we're doing:
> 
>       frames[i] = xpmap_ptetomach((pt_entry_t *)va) >> PAGE_SHIFT;
> 
> It seems to me it should be
> 
>       pte = kvtopte(va);
>       frames[i] = xpmap_ptetomach(pte) >> PAGE_SHIFT;
> 
> Am I missing something?

I think it should be
        ptp = kvtopte(va);
        frames[f] = (*ptp & PG_FRAME) >> PAGE_SHIFT;

        But at first glance it looks like xpmap_ptetomach() returns the same
        result as (*ptp & PG_FRAME)

> 
> > > And is it normal that in
> > > i386::gdt_init_cpu() we're not using a mask on the pte when doing
> > > [*ptp >> PAGE_SHIFT]?
> > 
> > Why should it be masked ?
> 
> Because PG_NX is above bit 12. I believe it should be:
> 
>       frames[f] = (*ptp & PG_FRAME) >> PAGE_SHIFT;

probably right

-- 
Manuel Bouyer <bou...@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

Reply via email to