Resolving physical addresses (change in 2.4.x?)

From: Christoph Baumann (cb@sorcus.com)
Date: Wed Jul 24 2002 - 01:11:11 EST


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/



This archive was generated by hypermail 2b29 : Tue Jul 30 2002 - 14:00:14 EST