aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-31 17:36:50 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-31 17:36:50 +0100
commit030cc96003d4518463b40f20d4194e51b1745c86 (patch)
treebe5b70d67c35e9328f450bde48f335536052c1ce
parentb77ef684b07bcd91c168b15f71611786dd5a3377 (diff)
downloadrpi-MMU-example-030cc96003d4518463b40f20d4194e51b1745c86.tar.gz
rpi-MMU-example-030cc96003d4518463b40f20d4194e51b1745c86.zip
don't statically define the unprivileged section (we're going to have many dynamically-claimed unprivileged sections)
-rw-r--r--kernel_stage2.ld9
-rw-r--r--memory.h7
-rw-r--r--setup.c3
3 files changed, 3 insertions, 16 deletions
diff --git a/kernel_stage2.ld b/kernel_stage2.ld
index a30105e..a3df063 100644
--- a/kernel_stage2.ld
+++ b/kernel_stage2.ld
@@ -60,13 +60,4 @@ SECTIONS
_stack_top = .;
}
-
- .unprivileged_memory (NOLOAD) :
- {
- _unprivileged_memory_start = .;
-
- . = . + MMU_SECTION_SIZE;
-
- _unprivileged_memory_end = .;
- }
}
diff --git a/memory.h b/memory.h
index 2ab5485..c7952f0 100644
--- a/memory.h
+++ b/memory.h
@@ -29,8 +29,6 @@ extern char _sections_list_start;
extern char _sections_list_end;
extern char _stack_start;
extern char _stack_top;
-extern char _unprivileged_memory_start;
-extern char _unprivileged_memory_end;
#define KERNEL_START ((size_t) &__start) // this is 0x0
#define KERNEL_END ((size_t) &__end)
@@ -50,11 +48,8 @@ extern char _unprivileged_memory_end;
#define PRIVILEGED_MEMORY_END STACK_END
-#define UNPRIVILEGED_MEMORY_START \
- ((size_t) &_unprivileged_memory_start) // equal to STACK_END
-#define UNPRIVILEGED_MEMORY_END \
- ((size_t) &_unprivileged_memory_end)
+// the following describes the virtual section for our PL0 programs
#define PL0_SECTION_NUMBER ((size_t) 0xaaa)
#define VIRTUAL_PL0_MEMORY_START (PL0_SECTION_NUMBER << 20)
diff --git a/setup.c b/setup.c
index b7acf60..63ca054 100644
--- a/setup.c
+++ b/setup.c
@@ -75,7 +75,8 @@ void setup(uint32_t r0, uint32_t machine_type,
memory_size = 192 * POWER_OF_2(20);
}
- if (memory_size < UNPRIVILEGED_MEMORY_END)
+ // assume we need at least one section for PL0
+ if (memory_size < PRIVILEGED_MEMORY_END + SECTION_SIZE)
{
puts("Not enough memory to continue");
while (1);