I create a first level table. I identify map it.
Code: Select all
for (x = 0; x < 1024; ++x) {
ktlb[x] = (x << 20) | TLB_AP_PRIVACCESS | TLB_SECTION;
}
That works great. No problems.
I decide well let me try a coarse table. This allows the electronic monkeys to come out.
Code: Select all
ktlb[3] = (uint32)tlbsub | TLB_COARSE;
Code: Select all
for (x = 0; x < 4096; ++x)
tlbsub[x] = 2 | (32 << 16) | 0x550;
Before, I turn on pages I do this for a debugging aid.
Code: Select all
a = (uint32*)(32 << 16);
for (x = 0; x < 1024 * 1024; ++x) {
a[x] = (uintptr)&a[x];
}
Now. I turn on paging with sub-pages disabled.
Code: Select all
arm4_tlbsetmode(2);
arm4_tlbset1((uintptr)utlb);
arm4_tlbset0((uintptr)ktlb);
/* set that all domains are checked against the TLB entry access permissions */
arm4_tlbsetdom(0x55555555);
/* enable TLB 0x1 and disable subpages 0x800000 */
arm4_tlbsetctrl(arm4_tlbgetctrl() | 0x1 | (1 << 23));
Now, I should have 4KB pages mapped... monkeys say otherwise.
Here is a debugging loop.
Code: Select all
for (x = 0; x < 256; ++x) {
b = (uint32*)0x300000 + x * 1024;
ksprintf(buf, "small[%x]:%x\n", x, b[0]);
kserdbg_puts(buf);
}
Code: Select all
small[0]:0x200000
small[1]:0x200400
small[2]:0x200800
small[3]:0x200c00
small[4]:0x200000
small[5]:0x200400
small[6]:0x200800
small[7]:0x200c00
Code: Select all
small[0]:0x200000
small[1]:0x200000
small[2]:0x200000
small[3]:0x200000
small[4]:0x200000
small[5]:0x200000
small[6]:0x200000
small[7]:0x200000
Lets try a slightly different test. Notice the + 4 at the end of assignment to b.
Code: Select all
for (x = 0; x < 256; ++x) {
b = (uint32*)0x300000 + x * 1024 + 4;
ksprintf(buf, "small[%x]:%x\n", x, b[0]);
kserdbg_puts(buf);
}
Code: Select all
small[0]:0x200010
small[1]:0x200010
small[2]:0x200010
small[3]:0x200010
small[4]:0x200010
small[5]:0x200010
small[6]:0x200010
small[7]:0x200010
So I got two problems. Why am I getting that odd offset and why am I unable to map 4KB pages instead of 1KB pages?
I must be setting a bit somewhere wrong, but I can not seem to find it.