linux-mips
[Top] [All Lists]

Are page tables allocated in KSEG0 or in KSEG2?

To: <linux-mips@oss.sgi.com>
Subject: Are page tables allocated in KSEG0 or in KSEG2?
From: "Raghav P" <raghav@ishoni.com>
Date: Sat, 30 Jun 2001 14:51:17 +0530
Importance: Normal
Reply-to: <raghav@ishoni.com>
Sender: owner-linux-mips@oss.sgi.com
I was going thru the TLB exception for R2300 and had the following doubts
which I hope someone can help me out with. ( am sorry if this is a newbie
question but since this is MIPS specific I am posting here)

The code is in arch/mips/kernel/head.S for user TLB:

        /* TLB refill, EXL == 0, R[23]00 version */
        LEAF(except_vec0_r2300)
        .set    noat
        .set    mips1
        mfc0    k0, CP0_BADVADDR
        lw      k1, current_pgd                 # get pgd pointer
        srl     k0, k0, 22
        sll     k0, k0, 2
        addu    k1, k1, k0
        mfc0    k0, CP0_CONTEXT
        lw      k1, (k1)
        and     k0, k0, 0xffc
        addu    k1, k1, k0
        lw      k0, (k1)
        nop
        mtc0    k0, CP0_ENTRYLO0
        mfc0    k1, CP0_EPC
        tlbwr
        jr      k1
        rfe
        END(except_vec0_r2300)

My linux book says that pgd and pte entries are not setup by the kernel
until a pagefault exception occurs.
The above code will work only if the pgd and pte tables are stored in kseg2;
if they were stored in kseg0 then if a pgd has an invalid pte entry the
above code will index into an invalid pte page and get a wrong physical
address.
But the pgd_alloc() and pte_alloc() routines seem to be allocating physical
pages from kseg0 for pgd and pte tables.
Am I missing something here???

Thanks
Raghav




<Prev in Thread] Current Thread [Next in Thread>
  • Are page tables allocated in KSEG0 or in KSEG2?, Raghav P <=