Resolving physical addresses (change in 2.4.x?)

Christoph Baumann (cb@sorcus.com)
Wed, 24 Jul 2002 08:11:11 +0200


Hi,

with a 2.2.19 kernel I used the routine below to resolve physical addresses
for preparing gather/scatter DMA. Using it on unmapped memory (allocated but
not yet used) it returned zero. Knowing this I could force the mapping of
such memory. Now with 2.4.x kernels I get something like 0x100000 for
unmapped pages.
Even recognizing these as unmapped and resolving anew, produced a frozen
machine once the DMA used these addresses. Was there a change in 2.4.x so
that my resolving routine now works incorrect?

/*resolve virt. addresses to phys.*/
unsigned long ch_get_physpage(unsigned long virtaddr)
{
/*Stuff for browsing through the memory page tables*/
pgd_t *pgd_t_dir;
pmd_t *pmd_t_dir;
pte_t *pte_t_dir;

/*Get physical address*/
pgd_t_dir=pgd_offset(current->mm,virtaddr);
pmd_t_dir=pmd_offset(pgd_t_dir,virtaddr);
pte_t_dir=pte_offset(pmd_t_dir,virtaddr);
return virt_to_bus((void *)pte_page(*pte_t_dir));
}

Mit freundlichen Gruessen / Best regards
Dipl.-Phys. Christoph Baumann

---
SORCUS Computer GmbH
Im Breitspiel 11 c
D-69126 Heidelberg

Tel.: +49(0)6221/3206-0 Fax: +49(0)6221/3206-66

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/