From 20b100acd702e64ac1d2db9ddcd10c25aafa51a2 Mon Sep 17 00:00:00 2001 From: AceVest Date: Fri, 2 May 2014 10:56:10 +0800 Subject: [PATCH] cancel to paging virtual address below 0xC0000000 --- boot/multiboot.S | 2 ++ include/system.h | 2 ++ kernel/init.c | 9 +++++---- mm/mm.c | 1 + setup/system.c | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/boot/multiboot.S b/boot/multiboot.S index 95546dc..4db6d52 100644 --- a/boot/multiboot.S +++ b/boot/multiboot.S @@ -23,6 +23,7 @@ .extern init_pgd .extern init_pgt .extern kernel_virtual_addr_start +.extern kernel_init_stack .section .multiboot_header .align 32 @@ -121,6 +122,7 @@ kernel_entry: Label: call CheckKernel addl $8,%esp + movl $kernel_init_stack + KRNL_INIT_STACK_SIZE, %esp call KernelEntry Die: diff --git a/include/system.h b/include/system.h index 15ca050..4cd0b33 100644 --- a/include/system.h +++ b/include/system.h @@ -227,4 +227,6 @@ extern System system; #define ROOT_DEV system.root_dev +#define KRNL_INIT_STACK_SIZE 4096 + #endif //_SYSTEM_H diff --git a/kernel/init.c b/kernel/init.c index f452e81..d6a36e6 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -11,7 +11,6 @@ #include #include -#define KRNL_STACK_SIZE 4096 void root_task_entry(); void setup_kernel(); @@ -19,14 +18,15 @@ void setup_kernel(); TSS tss; System system; -static char __initdata kernel_stack[KRNL_STACK_SIZE] __attribute__ ((__aligned__(PAGE_SIZE))); +char __initdata kernel_init_stack[KRNL_INIT_STACK_SIZE] __attribute__ ((__aligned__(PAGE_SIZE))); int KernelEntry() { + /* asm("movl $kernel_stack,%%esp;" "addl %%eax,%%esp;" ::"a"(KRNL_STACK_SIZE)); - +*/ setup_kernel(); char *root_task_user_space_stack = (char *) alloc_pages(0, 0); @@ -43,7 +43,8 @@ int KernelEntry() leal root_task_entry,%%eax; \ pushl %%eax; \ iret;"::"b"(root_task_user_space_stack+PAGE_SIZE)); - return 0; + + return 0; /* never come to here */ } #if 0 diff --git a/mm/mm.c b/mm/mm.c index 8521bb8..0525017 100644 --- a/mm/mm.c +++ b/mm/mm.c @@ -337,6 +337,7 @@ void init_paging() for(i=delta; i