Thread (54 messages) flat view 54 messages, 14 authors, 2001-01-23

Re: [Dri-devel] PPC Lockup (ati-pcigart-branch)

From: Roman Zippel <hidden>
Date: 2001-01-22 21:58:38

Hi,

On Mon, 22 Jan 2001, Dan Malek wrote:
I do this:

		pgd = pgd_offset_k(i);
		if (pgd) {
			pmd = pmd_offset(pgd, i);
			if (pmd && pmd_present(*pmd)) {
				pte = pte_offset(pmd, i);
				if (pte && pte_present(*pte)) {
					/* Do your stuff */
				}
			}
		}
There is no need to test the pointers and you forgot a pgd_present(),
otherwise you might get a problem on architectures with 3-level mmus.
Anyway to get to the page struct, this should do it:

        pgd = pgd_offset_k(addr);
        if (!pgd_present(*pgd))
                return NULL;
        pmd = pmd_offset(pgd, addr);
        if (!pmd_present(*pmd))
                return NULL;
        pte = pte_offset(pmd, addr);
        if (!pte_present(*pte))
                return NULL;
        return pte_page(*pte);

bye, Roman


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help