github.com/f-secure-foundry/tamago@v0.0.0-20220307101044-d73fcdd7f11b/arm/mmu.s (about) 1 // ARM processor support 2 // https://github.com/f-secure-foundry/tamago 3 // 4 // Copyright (c) F-Secure Corporation 5 // https://foundry.f-secure.com 6 // 7 // Use of this source code is governed by the license 8 // that can be found in the LICENSE file. 9 10 #include "textflag.h" 11 12 // func set_ttbr0(addr uint32) 13 TEXT ·set_ttbr0(SB),NOSPLIT,$0-4 14 MOVW $0, R0 15 16 // Data Memory Barrier 17 MCR 15, 0, R0, C7, C10, 5 18 19 // Invalidate Instruction Cache 20 MCR 15, 0, R0, C7, C5, 0 21 22 // Data Synchronization Barrier 23 MCR 15, 0, R0, C7, C10, 4 24 25 // Invalidate unified TLB 26 MCR 15, 0, R0, C8, C7, 0 27 28 // Set TTBR0 29 MOVW addr+0(FP), R0 30 MCR 15, 0, R0, C2, C0, 0 31 32 // Use TTBR0 for translation table walks 33 MOVW $0, R0 34 MCR 15, 0, R0, C2, C0, 2 35 36 // Set Domain Access 37 MOVW $1, R0 38 MCR 15, 0, R0, C3, C0, 0 39 40 // Enable MMU 41 MRC 15, 0, R0, C1, C0, 0 42 ORR $1, R0 43 MCR 15, 0, R0, C1, C0, 0 44 45 RET