Rev 2339 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2339 | Rev 2349 | ||
|---|---|---|---|
| Line 28... | Line 28... | ||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | /** @addtogroup arm32boot |
30 | /** @addtogroup arm32boot |
| 31 | * @{ |
31 | * @{ |
| 32 | */ |
32 | */ |
| 33 | /** @file |
33 | /** @file |
| - | 34 | * @brief Memory management used while booting the kernel. |
|
| - | 35 | * |
|
| - | 36 | * So called "section" paging is used while booting the kernel. The term "section" |
|
| - | 37 | * comes from the ARM architecture specification and stands for the following: |
|
| - | 38 | * one-level paging, 1MB sized pages, 4096 entries in the page table. |
|
| 34 | */ |
39 | */ |
| 35 | 40 | ||
| 36 | 41 | ||
| 37 | #ifndef BOOT_arm32__MM_H |
42 | #ifndef BOOT_arm32__MM_H |
| 38 | #define BOOT_arm32__MM_H |
43 | #define BOOT_arm32__MM_H |
| Line 42... | Line 47... | ||
| 42 | #include "types.h" |
47 | #include "types.h" |
| 43 | #endif |
48 | #endif |
| 44 | 49 | ||
| 45 | 50 | ||
| 46 | /** Frame width. */ |
51 | /** Frame width. */ |
| 47 | #define FRAME_WIDTH 20 /* 4KB frames */ |
52 | #define FRAME_WIDTH 20 |
| 48 | 53 | ||
| 49 | /** Frame size. */ |
54 | /** Frame size. */ |
| 50 | #define FRAME_SIZE (1 << FRAME_WIDTH) |
55 | #define FRAME_SIZE (1 << FRAME_WIDTH) |
| 51 | 56 | ||
| 52 | /** Page size in 2-level paging which is switched on later in the kernel initialization. */ |
57 | /** Page size in 2-level paging which is switched on later after the kernel initialization. */ |
| 53 | #define PAGE_SIZE (1 << 12) |
58 | #define KERNEL_PAGE_SIZE (1 << 12) |
| 54 | 59 | ||
| 55 | 60 | ||
| 56 | #ifndef __ASM__ |
61 | #ifndef __ASM__ |
| - | 62 | /** Converts kernel address to physical address. */ |
|
| 57 | # define KA2PA(x) (((uintptr_t) (x)) - 0x80000000) |
63 | # define KA2PA(x) (((uintptr_t) (x)) - 0x80000000) |
| - | 64 | /** Converts physical address to kernel address. */ |
|
| 58 | # define PA2KA(x) (((uintptr_t) (x)) + 0x80000000) |
65 | # define PA2KA(x) (((uintptr_t) (x)) + 0x80000000) |
| 59 | #else |
66 | #else |
| 60 | # define KA2PA(x) ((x) - 0x80000000) |
67 | # define KA2PA(x) ((x) - 0x80000000) |
| 61 | # define PA2KA(x) ((x) + 0x80000000) |
68 | # define PA2KA(x) ((x) + 0x80000000) |
| 62 | #endif |
69 | #endif |
| Line 80... | Line 87... | ||
| 80 | 87 | ||
| 81 | #ifndef __ASM__ |
88 | #ifndef __ASM__ |
| 82 | 89 | ||
| 83 | 90 | ||
| 84 | /** Page table level 0 entry - "section" format is used (one-level paging, 1MB sized |
91 | /** Page table level 0 entry - "section" format is used (one-level paging, 1MB sized |
| 85 | * pages). Used only while booting the kernel. */ |
92 | * pages). Used only while booting the kernel. |
| - | 93 | */ |
|
| 86 | typedef struct { |
94 | typedef struct { |
| 87 | unsigned descriptor_type : 2; |
95 | unsigned descriptor_type : 2; |
| 88 | unsigned bufferable : 1; |
96 | unsigned bufferable : 1; |
| 89 | unsigned cacheable : 1; |
97 | unsigned cacheable : 1; |
| 90 | unsigned impl_specific : 1; |
98 | unsigned impl_specific : 1; |