.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:
#define ROOT_DEV system.root_dev
+#define KRNL_INIT_STACK_SIZE 4096
+
#endif //_SYSTEM_H
#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
for(i=delta; i<PDECNT_PER_PAGE; ++i)
{
init_pgd[i] = init_pgd[i-delta];
+ init_pgd[i-delta] = 0;
}
// paging for user space
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;