Commit | Line | Data |
---|---|---|
d1f2db4b AT |
1 | // (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> |
2 | // See License.txt file for copyright and license details. | |
3 | ||
4 | #include <stdint.h> | |
5 | #include "pdp11_register.h" | |
6 | ||
7 | void | |
8 | init_mmu(void) | |
9 | { | |
10 | ||
ff4fc705 | 11 | /* |
d1f2db4b AT |
12 | * First populate the relocation registers, all zero since we want an |
13 | * identity mapping, except the highest page that we remap to the physical MMIO | |
14 | * range. | |
15 | */ | |
16 | SET(KISAR0,PAR_PAF,0000000); | |
17 | SET(KISAR1,PAR_PAF,0000000); | |
18 | SET(KISAR2,PAR_PAF,0000000); | |
19 | SET(KISAR3,PAR_PAF,0000000); | |
20 | SET(KISAR4,PAR_PAF,0000000); | |
21 | SET(KISAR5,PAR_PAF,0000000); | |
22 | SET(KISAR6,PAR_PAF,0000000); | |
23 | SET(KISAR7,PAR_PAF,0177600); | |
24 | ||
ff4fc705 AT |
25 | /* |
26 | * Now populate the page descriptor registers. See EK-KDJ1B-UG page 1-19 | |
27 | * for details of each field. | |
d1f2db4b AT |
28 | */ |
29 | uint16_t data = 0; | |
30 | SET(data,PDR_BYPASCACHE,0); | |
31 | SET(data,PDR_PAGELEN,0177); | |
32 | SET(data,PDR_PAGEWRITEN,0); | |
33 | SET(data,PDR_EXPANDDIR,0); | |
34 | SET(data,PDR_ACCESSCTRL,03); | |
35 | ||
36 | KISDR0 = data; | |
37 | KISDR1 = data; | |
38 | KISDR2 = data; | |
39 | KISDR3 = data; | |
40 | KISDR4 = data; | |
41 | KISDR5 = data; | |
42 | KISDR6 = data; | |
6f68b4a0 AT |
43 | |
44 | SET(data,PDR_BYPASCACHE,1); | |
45 | ||
d1f2db4b AT |
46 | KISDR7 = data; |
47 | ||
ff4fc705 AT |
48 | /* |
49 | * Enable the MMU with a 22-bit mapping. | |
50 | */ | |
51 | SET(MMR3,MMR3_KRNSPLTID,0); | |
d1f2db4b AT |
52 | SET(MMR3,MMR3_EN_22BIT,1); |
53 | SET(MMR0,MMR0_EN_MMU,1); | |
54 | } | |
55 |