On Sun, Oct 17, 2010 at 8:51 AM, wilbur.chan <wilbur512@xxxxxxxxx> wrote: > 1) In linux ,esspecially in TLB refilling, Âis Context[PTEBase] used > to store cpuid? (refer to build_get_pgde32 in tlbex.c) On 32-bit systems, PTEBase stores a byte offset that can be added to &pgd_current[0]. i.e. smp_processor_id() * sizeof(unsigned long) So the TLB refill handler can find pgd for the current CPU using code that looks something like this: 0: 401b2000 mfc0 k1,c0_context 4: 3c1a8054 lui k0,0x8054 8: 001bddc2 srl k1,k1,0x17 c: 035bd821 addu k1,k0,k1 ... 14: 8f7b5008 lw k1,20488(k1) where pgd_current is at 0x8054_5008, and PTEBase is 0, 4, 8, 12, ... See also: TLBMISS_HANDLER_SETUP(). For 64-bit systems with CONFIG_MIPS_PGD_C0_CONTEXT, it looks like a direct pgd pointer is now being stored in Context, to speed up the TLB handlers.