From 10e65db7487700f78e4b0ed7a7e32817a6085365 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sun, 14 Mar 2021 18:28:44 +0800 Subject: [PATCH] loader: limit the kernel to 4 kB Signed-off-by: Sean Cross --- loader/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/src/main.rs b/loader/src/main.rs index 6781e3c9e..8d8e3e058 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -21,6 +21,7 @@ const USER_AREA_END: usize = 0xff00_0000; // and therefore are limited to 4 MB. const EXCEPTION_STACK_TOP: usize = 0xffff_0000; const KERNEL_LOAD_OFFSET: usize = 0xffd0_0000; +const KERNEL_STACK_PAGE_COUNT: usize = 1; const KERNEL_ARGUMENT_OFFSET: usize = 0xffc0_0000; const FLG_VALID: usize = 0x1; @@ -421,7 +422,7 @@ impl ProgramDescription { allocator.change_owner(pid as XousPid, pt_addr as usize); // Allocate stack pages. - for i in 0..STACK_PAGE_COUNT { + for i in 0..if is_kernel { KERNEL_STACK_PAGE_COUNT} else { STACK_PAGE_COUNT } { let sp_page = allocator.alloc() as usize; allocator.map_page( satp,