diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-02 16:37:22 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-02 16:37:22 +0100 |
commit | 401bf03070458cf3a5ee6947bd01a8f397fe2909 (patch) | |
tree | 568efb820ccf996118546108e98566584a3a904f /memory.h | |
parent | 4b530611e8cd1a342a7e4461ac002cf715da26b3 (diff) | |
download | rpi-MMU-example-401bf03070458cf3a5ee6947bd01a8f397fe2909.tar.gz rpi-MMU-example-401bf03070458cf3a5ee6947bd01a8f397fe2909.zip |
create a separate library for kernel code that should run in PL0 mode
Diffstat (limited to 'memory.h')
-rw-r--r-- | memory.h | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -1,6 +1,10 @@ #ifndef MEMORY_H #define MEMORY_H +#include "paging.h" + +#define SECTION_SIZE (((uint32_t) 1) << 20) + #define INTERRUPT_VECTOR_TABLE_START ((uint32_t) 0x0) #define STACK_START ((uint32_t) 0x4000) @@ -20,11 +24,21 @@ extern char __start; #define TRANSLATION_TABLE_END \ (TRANSLATION_TABLE_BASE + (uint32_t) (4096 * 4)) -#define PRIVILEGED_MEMORY_END TRANSLATION_TABLE_END +#define LIBKERNEL_SECTION_START \ + (((TRANSLATION_TABLE_END - (uint32_t) 1) & ~((uint32_t) 0xfffff)) \ + + SECTION_SIZE) + +#define LIBKERNEL_SECTION_END \ + (LIBKERNEL_SECTION_START + SECTION_SIZE) -#define UNPRIVILEGED_MEMORY_START \ - (((PRIVILEGED_MEMORY_END - (uint32_t) 1) & ~((uint32_t) 0xfffff)) \ - + (uint32_t) 0x100000) +// section for libkernel is flat-mapped +#define LIBKERNEL_SECTION_NUMBER (LIBKERNEL_SECTION_START >> 20) + +#define PRIVILEGED_MEMORY_END LIBKERNEL_SECTION_END + +#define UNPRIVILEGED_MEMORY_START PRIVILEGED_MEMORY_END +#define UNPRIVILEGED_MEMORY_END \ + (UNPRIVILEGED_MEMORY_START + SECTION_SIZE) #define PL0_SECTION_NUMBER ((uint32_t) 0b101010101010) #define PL0_SECTION_NUMBER_STR "0b101010101010" @@ -32,4 +46,4 @@ extern char __start; #define VIRTUAL_PL0_MEMORY_START (PL0_SECTION_NUMBER << 20) #endif // MEMORY_H - + |