aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/mm.c
diff options
context:
space:
mode:
authorMarvin Borner2021-04-05 19:37:50 +0200
committerMarvin Borner2021-04-05 19:37:50 +0200
commit9326d3970fe6eedbcb042ac68aca3074aacef32f (patch)
tree9157b9e57b052012379e4103aaed3235d1b50e9e /kernel/features/mm.c
parentccc1dd7b4ba8ad5efe51aac32b26f0859d93fbe5 (diff)
Fixed some minor bugs
Diffstat (limited to 'kernel/features/mm.c')
-rw-r--r--kernel/features/mm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c
index a0ed280..7baa4ea 100644
--- a/kernel/features/mm.c
+++ b/kernel/features/mm.c
@@ -698,9 +698,13 @@ CLEAR void memory_install(struct mem_info *mem_info, struct vid_info *vid_info)
memory_map_identity(&kernel_dir, kernel_ro_memory_range(), MEMORY_READONLY);
memory_map_identity(&kernel_dir, kernel_rw_memory_range(), MEMORY_NONE);
- // Map kernel stack
- memory_map_identity(&kernel_dir, memory_range_around(STACK_START - STACK_SIZE, STACK_SIZE),
+ // Map kernel stack with readonly boundaries (stack grows downwards!)
+ memory_map_identity(&kernel_dir, memory_range(STACK_START - STACK_SIZE, STACK_SIZE),
MEMORY_NONE);
+ memory_map_identity(&kernel_dir,
+ memory_range(STACK_START - STACK_SIZE - PAGE_SIZE, PAGE_SIZE),
+ MEMORY_READONLY);
+ memory_map_identity(&kernel_dir, memory_range(STACK_START, PAGE_SIZE), MEMORY_READONLY);
// Map framebuffer
memory_map_identity(&kernel_dir, memory_range_around((u32)vid_info->vbe, 0x1000),