Problem with accessing page tables

From: Ameya Mitragotri <ameya.mitragotri_at_wipro.com>
Date: 2003-11-08 15:16:38
Hi,

 I wrote following piece of code to traverse the page table for a
particular
Kernel variable. But the PMD access is always a failure.

 I'm using Itanium 2 with linux-2.6.0-test5.
Any pointers will be really helpful. 
Thanks and regards,
Ameya

	pgd_t *pgd;
	pmd_t *pmd;
	pte_t *ptep, pte;
	unsigned long pfn;

	printk(KERN_EMERG "The address is %lx\n\n\n",address);

	pgd = pgd_offset_k(address);
	if (pgd_none(*pgd) || pgd_bad(*pgd))
		goto out;

>>	pmd = pmd_offset(pgd, address); <<<
One of the checks below fails because the call pmd_offset gives pmd 
With value o.

	if (pmd_none(*pmd))
		goto out;
	if (pmd_bad(*pmd))
		goto out;

	ptep = pte_offset_kernel(pmd, address);
	if (!ptep)
		goto out;
	pte = *ptep;
	pte_unmap(ptep);
	if (pte_present(pte)) {
		if (!write || (pte_write(pte) && pte_dirty(pte))) {
			pfn = pte_pfn(pte);
			if (pfn_valid(pfn)) {
				struct page *page = pfn_to_page(pfn);

				//mark_page_accessed(page);
				return page;
			}
		}
	}
	else
	{
		printk(KERN_EMERG "pte entry not present \n");
	}

out:
	printk(KERN_EMERG "At out \n");
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Nov 7 23:17:01 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST