Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2384f95)
raw | patch | inline | side by side (parent: 2384f95)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Fri, 2 May 2014 02:56:10 +0000 (10:56 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Fri, 2 May 2014 02:56:10 +0000 (10:56 +0800) |
| boot/multiboot.S | patch | blob | history | |
| include/system.h | patch | blob | history | |
| kernel/init.c | patch | blob | history | |
| mm/mm.c | patch | blob | history | |
| setup/system.c | patch | blob | history |
diff --git a/boot/multiboot.S b/boot/multiboot.S
--- a/boot/multiboot.S
+++ b/boot/multiboot.S
.extern init_pgd
.extern init_pgt
.extern kernel_virtual_addr_start
+.extern kernel_init_stack
.section .multiboot_header
.align 32
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
--- a/include/system.h
+++ b/include/system.h
#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
--- a/kernel/init.c
+++ b/kernel/init.c
#include <stat.h>
#include <init.h>
-#define KRNL_STACK_SIZE 4096
void root_task_entry();
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);
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
--- a/mm/mm.c
+++ b/mm/mm.c
for(i=delta; i<PDECNT_PER_PAGE; ++i)
{
init_pgd[i] = init_pgd[i-delta];
+ init_pgd[i-delta] = 0;
}
// paging for user space
diff --git a/setup/system.c b/setup/system.c
--- a/setup/system.c
+++ b/setup/system.c
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;