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