linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* A question about man_page in linux-kernel
@ 2007-07-01 14:24 kang shuo
  0 siblings, 0 replies; only message in thread
From: kang shuo @ 2007-07-01 14:24 UTC (permalink / raw)
  To: linuxppc-embedded

hi:
    I had read some ppc code in linux-2.6.20. There is a question
about map_page function. map_page seems to implement the map between
virtual address and physical address. But I can not understand how the
tlb entry operation is done in the code in map_page. The map_page is
as the following:

int
map_page(unsigned long va, phys_addr_t pa, int flags)
{
       pmd_t *pd;
       pte_t *pg;
       int err = -ENOMEM;

       /* Use upper 10 bits of VA to index the first level map */
       pd = pmd_offset(pgd_offset_k(va), va);
       /* Use middle 10 bits of VA to index the second-level map */
       pg = pte_alloc_kernel(pd, va);
       if (pg != 0) {
               err = 0;
               set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
__pgprot(flags)));
               if (mem_init_done)
                       flush_HPTE(0, va, pmd_val(*pd));
       }
       return err;
}

       Could anyone give me some hints about where and when tlb entry
is setup according to map_page function. That is very appreciate.

-- Thanks
-- Michael.Kang

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-01 14:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-01 14:24 A question about man_page in linux-kernel kang shuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).