voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

commit 6ef96df11b3aa0a5367df9be0fcb1dc02f94a277
parent ddf168c71ef495d152dd68294a1f01328d86fef5
Author: oblique <psyberbits@gmail.com>
Date:   Sat,  4 Aug 2012 22:53:15 +0300

fixed: invalidate TLB after we map a physical memory to virtual memory

Diffstat:
Mkernel/mmu.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/mmu.c b/kernel/mmu.c @@ -14,8 +14,9 @@ void mmu_init() { mmu_ttb[i] = L1_FAULT; asm volatile ( - /* invalidate TLB */ - "mov v1, #0 \n\t" + /* invalidate TLB + * v1 is ignored + */ "mcr p15, 0, v1, c8, c7, 0 \n\t" /* set TTBCR */ "mov v1, #0 \n\t" @@ -27,20 +28,18 @@ void mmu_init() { "ldr v1, =0x55555555 \n\t" "mcr p15, 0, v1, c3, c0, 0 \n\t" /* invalidate TLB */ - "mov v1, #0 \n\t" "mcr p15, 0, v1, c8, c7, 0 \n\t" /* enable AFE */ "mrc p15, 0, v1, c1, c0, 0 \n\t" "orr v1, v1, #(1 << 29) \n\t" "mcr p15, 0, v1, c1, c0, 0 \n\t" - : : : "v1" + : : : "v1", "memory" ); } void mmu_enable() { asm volatile ( /* invalidate TLB */ - "mov v1, #0 \n\t" "mcr p15, 0, v1, c8, c7, 0 \n\t" /* enable MMU */ "mrc p15, 0, v1, c1, c0, 0 \n\t" @@ -121,5 +120,9 @@ int mmu_map_page(void *phys, void *virt, uint_t npages, mmu_ap_t perms) { virt_a += PAGE_SIZE; } + /* invalidate TLB */ + asm volatile("mcr p15, 0, v1, c8, c7, 0" + : : : "v1", "memory"); + return 0; }