remap_pte_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi,

   I am trying to understand remap_pte_range in 2.4.19 kernel. The name of
the function and the comment suggests that a range of pte are cleared and
set to new pages. But the code just clears the ptes and does not
set the pte entry to a new page. Can you please explain me what is
this function suppose to do and when is it used.

 Thanks a lot.
Raghu

/*
 * maps a range of physical memory into the requested pages. the old *
 mappings are removed. any references to nonexistent pages results * in
 null mappings (currently treated as "copy-on-access") */

static inline void remap_pte_range(pte_t * pte, unsigned long address,
unsigned long size,
	unsigned long phys_addr, pgprot_t prot) {
	unsigned long end;
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;
	do {
		struct page *page;
		pte_t oldpage;
		oldpage = p tep_get_and_clear(pte);
		page = virt_to_page(__va(phys_addr));
		if ((!VALID_PAGE(page)) || PageReserved(page))
 			set_pte(pte, mk_pte_phys(phys_addr, prot));
		forget_pte(oldpage);
		address += PAGE_SIZE;
		phys_addr += PAGE_SIZE;
		pte++;
	} while (address && (address < end));
}
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux