]> Zhao Yanbai Git Server - kernel.git/commitdiff
cancel to paging virtual address below 0xC0000000
authorAceVest <zhaoyanbai@126.com>
Fri, 2 May 2014 02:56:10 +0000 (10:56 +0800)
committerAceVest <zhaoyanbai@126.com>
Fri, 2 May 2014 02:56:10 +0000 (10:56 +0800)
boot/multiboot.S
include/system.h
kernel/init.c
mm/mm.c
setup/system.c

index 95546dc84244b0349683652397ae841ac292de39..4db6d524c58d59d53ed4cc31154e3f987df0c613 100644 (file)
@@ -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:
index 15ca0506de53ba267655fa7937ddf1310e2ff3b1..4cd0b3354659b58efbfe846a1537e0f8f98c0203 100644 (file)
@@ -227,4 +227,6 @@ extern    System system;
 
 #define ROOT_DEV    system.root_dev
 
+#define KRNL_INIT_STACK_SIZE    4096
+
 #endif //_SYSTEM_H
index f452e81151e8bfe9f44d5a0210b948cc051a1427..d6a36e67214ea7fd29bec1dab531c02e101e7dda 100644 (file)
@@ -11,7 +11,6 @@
 #include <stat.h>
 #include <init.h>
 
-#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 8521bb8b26c5b2139fbcbda50beecd7fe96146d8..0525017d5d9fc9bf4c493a02c9b204cbce1a27f1 100644 (file)
--- a/mm/mm.c
+++ b/mm/mm.c
@@ -337,6 +337,7 @@ void init_paging()
     for(i=delta; i<PDECNT_PER_PAGE; ++i)
     {
         init_pgd[i] = init_pgd[i-delta];
+        init_pgd[i-delta] = 0;
     }
 
     // paging for user space
index 62ebba0f958973820c87aaab433a338e82daba82..f42501b27dd3901733855c878235bc3652ecf558 100644 (file)
@@ -29,7 +29,7 @@ void    setup_gdt()
     pDesc    pdesc;
     //change to new gdt.
     sgdt();
-    memcpy(gdt, (void *)*((unsigned long*)(gdtr+2)),
+    memcpy(gdt, (void *)pa2va(*((unsigned long*)(gdtr+2))),
                 *((unsigned short *)gdtr));
     *((unsigned short *)gdtr)    = NGDT*sizeof(Desc);
     *((unsigned long  *)(gdtr+2))    = (unsigned long)gdt;