aboutsummaryrefslogtreecommitdiff
path: root/memory.h
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-11-19 17:49:20 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-11-19 17:49:20 +0100
commit39145f6d1b8c57abe2bc0167b2b413970d0dfdb6 (patch)
tree2e2a76590e749579676720505aa38c57f85a95a4 /memory.h
parent11541f1d1eaaefebd6d01b42e92a65606e4bc382 (diff)
downloadrpi-MMU-example-39145f6d1b8c57abe2bc0167b2b413970d0dfdb6.tar.gz
rpi-MMU-example-39145f6d1b8c57abe2bc0167b2b413970d0dfdb6.zip
split kernel into more files
Diffstat (limited to 'memory.h')
-rw-r--r--memory.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/memory.h b/memory.h
new file mode 100644
index 0000000..2d0f6f4
--- /dev/null
+++ b/memory.h
@@ -0,0 +1,35 @@
+#ifndef MEMORY_H
+#define MEMORY_H
+
+#define INTERRUPT_VECTOR_TABLE_START ((uint32_t) 0x0)
+
+#define STACK_START ((uint32_t) 0x4000)
+#define STACK_END ((uint32_t) 0x8000)
+
+extern char __end;
+extern char __start;
+
+#define KERNEL_START ((uint32_t) &__start)
+#define KERNEL_END ((uint32_t) &__end)
+
+// first 2^14 aligned address after the kernel
+#define TRANSLATION_TABLE_BASE \
+ (((KERNEL_END - (uint32_t) 1) & ~((uint32_t) 0x3fff)) \
+ + (uint32_t) 0x4000)
+
+#define TRANSLATION_TABLE_END \
+ (TRANSLATION_TABLE_BASE + (uint32_t) (4096 * 4))
+
+#define PRIVILEGED_MEMORY_END TRANSLATION_TABLE_END
+
+#define UNPRIVILEGED_MEMORY_START \
+ (((PRIVILEGED_MEMORY_END - (uint32_t) 1) & ~((uint32_t) 0x3fff)) \
+ + (uint32_t) 0x4000)
+
+#define PL0_SECTION_NUMBER ((uint32_t) 0b101010101010)
+#define PL0_SECTION_NUMBER_STR "0b101010101010"
+
+#define VIRTUAL_PL0_MEMORY_START (PL0_SECTION_NUMBER << 20)
+
+#endif // MEMORY_H
+