|
1 | 1 | #ifndef _MMU_H_ |
2 | 2 | #define _MMU_H_ |
3 | 3 |
|
| 4 | +#include "sysconfig.h" |
| 5 | + |
4 | 6 | /* |
5 | 7 | * This file contains: |
6 | 8 | * |
|
12 | 14 | /* |
13 | 15 | * Part 1. ARM definitions. |
14 | 16 | */ |
15 | | -#define MAXPA (512 * 1024 * 1024) |
16 | 17 | #define BY2PG 4096 // bytes to a page |
17 | 18 | #define PDMAP (4*1024) // bytes mapped by a third page table entry |
18 | 19 |
|
|
36 | 37 | /* Page Table/Directory Entry flags |
37 | 38 | * these are defined by the hardware |
38 | 39 | */ |
39 | | -#define PTE_V 0x0003 // Table Entry Valid bit |
40 | | -#define PBE_V 0x0001 // Block Entry Valid bit |
41 | | -#define PTE_R 0x0000 // Dirty bit ,'0' means only read ,otherwise make interrupt |
42 | | -// #define PTE_G 0x0100 // Global bit |
43 | | -// #define PTE_D 0x0002 // fileSystem Cached is dirty |
44 | | -// #define PTE_COW 0x0001 // Copy On Write |
45 | | -// #define PTE_UC 0x0800 // unCached |
46 | | -// #define PTE_LIBRARY 0x0004 // share memmory |
| 40 | +#define PTE_V 0x3 << 0 // Table Entry Valid bit |
| 41 | +#define PBE_V 0x1 << 0 // Block Entry Valid bit |
| 42 | +#define PTE_R 0x0 << 0 // Dirty bit ,'0' means only read ,otherwise make interrupt |
| 43 | +#define ATTRIB_AP_RW_EL1 0x0 << 6 |
| 44 | +#define ATTRIB_AP_RW_ALL 0x1 << 6 |
| 45 | +#define ATTRIB_AP_RO_EL1 0x2 << 6 |
| 46 | +#define ATTRIB_AP_RO_ALL 0x3 << 6 |
| 47 | +#define ATTRIB_SH_NON_SHAREABLE 0x0 << 8 |
| 48 | +#define ATTRIB_SH_OUTER_SHAREABLE 0x2 << 8 |
| 49 | +#define ATTRIB_SH_INNER_SHAREABLE 0x3 << 8 |
| 50 | +#define AF 0x1 << 10 |
| 51 | +#define PXN 0x0 << 53 |
| 52 | +#define UXN 0x1UL << 54 |
| 53 | + |
| 54 | +#define ATTRINDX_NORMAL 0 // inner/outer write-back non-transient, non-allocating |
| 55 | +#define ATTRINDX_DEVICE 1 // Device-nGnRE |
| 56 | +#define ATTRINDX_COHERENT 2 // Device-nGnRnE |
47 | 57 |
|
48 | 58 | /* |
49 | 59 | * Part 2. Our conventions. |
|
54 | 64 | o | | |
55 | 65 | o | ... | |
56 | 66 | o | | |
57 | | - o UTOP -----> +----------------------------+------------0x 0430 9000 |
| 67 | + o EL2STACKTOP -----> +----------------------------+------------0x 0400 0000 |
| 68 | + o | EL2 stack | |
| 69 | + o KSTACKTOP -----> +----------------------------+------------0x 03C0 0000 |
| 70 | + o | Kernel stack | |
| 71 | + o UTOP -----> +----------------------------+------------0x 0230 1000 |
58 | 72 | o | PAGES | |
59 | | - o UPAGES -----> +----------------------------+------------0x 0400 9000 |
| 73 | + o UPAGES -----> +----------------------------+------------0x 0200 1000 |
60 | 74 | o | Page Table | |
61 | | - o UVPT, EL3STACKTOP -----> +----------------------------+------------0x 0400 8000 |
62 | | - o | EL3 stack | |
63 | | - o KSTACKTOP -----> +----------------------------+------------0x 03C0 8000 |
64 | | - o | Kernel stack | |
65 | | - o | | |
| 75 | + o UVPT -----> +----------------------------|------------0x 0200 0000 |
66 | 76 | o | Kernel Text | |
67 | 77 | o KERNBASE -----> +----------------------------+------------0x 8 0000 |
68 | 78 | o | reserved | |
69 | 79 | a 0 ------------> +----------------------------+------------0x 0000 |
70 | 80 | o |
71 | 81 | */ |
72 | 82 |
|
73 | | -#define KERNBASE 0x8000 |
74 | | - |
75 | | -#define KSTACKTOP EL3STACKTOP - 0x400000 |
76 | | -#define EL3STACKTOP 0x04008000 |
77 | | -#define UVPT EL3STACKTOP |
78 | | -#define UPAGES UVPT + 0x1000 |
79 | | -#define UTOP UPAGES + 0x300000 |
80 | | - |
81 | | -#define KSTKSIZE (60*1024*1024) |
82 | | - |
83 | 83 | #ifndef __ASSEMBLER__ |
84 | 84 |
|
85 | 85 | /* |
|
0 commit comments