Enable paging
This commit is contained in:
parent
3212145e94
commit
6edeba8fe2
12 changed files with 81 additions and 19 deletions
|
@ -1,8 +1,10 @@
|
|||
#include "libc/stdio.h"
|
||||
#include "utils/pic.h"
|
||||
#include "int/pic.h"
|
||||
#include "boot/multiboot.h"
|
||||
#include "utils/mem.h"
|
||||
#include "utils/gdt.h"
|
||||
#include "utils/paging.h"
|
||||
|
||||
|
||||
char show_tics=0;
|
||||
|
||||
|
@ -21,11 +23,14 @@ void bringelle(){
|
|||
// Kernel boot sequence
|
||||
pic_enable_interrupt();
|
||||
print("Interrupts enabled\n");
|
||||
print("Kernel started !\n");
|
||||
|
||||
paging_enable();
|
||||
print("Paging enable!\n");
|
||||
print("Kernel started !");
|
||||
|
||||
show_tics=1;
|
||||
// Utask
|
||||
print("Launch user task ");
|
||||
show_tics=1;
|
||||
memcpy((void*)utask,(void*)0x300000, 100); // 100 bytes seems reasonable to load utask
|
||||
asm (
|
||||
"cli \n\t" // Ensure we do not get interrupted
|
||||
|
@ -33,20 +38,22 @@ void bringelle(){
|
|||
"movl %%eax, %0 \n\t" // Save kernel ss segment into the TSS
|
||||
"movl %%esp, %1 \n\t" // Save kernel esp into the TSS BEFORE setting up the stack
|
||||
"pushl $0x33 \n\t" // Push task ss which is 0x30 along with prlv which is 0x3
|
||||
"pushl $0x400000 \n\t" // Push task esp
|
||||
"pushl $0x30FFFF \n\t" // Push task esp
|
||||
"pushfl \n\t" // Retrieve flags
|
||||
"popl %%eax \n\t"
|
||||
"orl $0x200, %%eax \n\t" // Enable interrupt for the user task
|
||||
"and $0xffffbfff, %%eax \n\t" // Clear the NT flags
|
||||
"push %%eax \n\t" // Push task flags
|
||||
"push $0x23 \n\t" // Push task cs which is 0x20 along with prlv which is 0x3
|
||||
"push $0 \n\t" // Push task entry point
|
||||
"push $0x300000 \n\t" // Push task entry point
|
||||
"mov $0x2B, %%eax \n\t" // GDT entry 0x28 along with prlv which is 0x3
|
||||
"mov %%eax, %%ds \n\t" // Setting up user data segment
|
||||
"iret \n\t" // Launch user task
|
||||
: "=m" (TSS.ss0), "=m" (TSS.esp0)
|
||||
);
|
||||
|
||||
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
@ -63,3 +70,7 @@ void clock(){
|
|||
}
|
||||
|
||||
|
||||
void page_fault(){
|
||||
print("Page fault!");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue