aboutsummaryrefslogtreecommitdiff
path: root/src/bringelle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bringelle.c')
-rw-r--r--src/bringelle.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/bringelle.c b/src/bringelle.c
index 520b83d..cb8c5e4 100644
--- a/src/bringelle.c
+++ b/src/bringelle.c
@@ -8,7 +8,13 @@
extern void interrupt_enable();
void utask(){
- char msg[]="Message from the task :D";
+ char *msg=(char*)4206592+10;
+ msg[0]='T';
+ msg[1]='a';
+ msg[2]='s';
+ msg[3]='k';
+ msg[4]='1';
+ msg[5]='\0';
asm("mov $0x1, %%eax;int $0x30"::"b"(msg));
while(1);
}
@@ -22,37 +28,16 @@ void bringelle(){
print("Interrupts enabled\n");
paging_enable();
- print("Paging enable!\n");
- print("Kernel started !");
-
- paging_allocate(5);
- print("\n");
- paging_dump(1024,-1);
- print("\n");
-
+ print("Paging enable\n");
+ print("Kernel started!\n");
+ print("-----------------------\n");
show_tics=1;
+
// Utask
- print("Launch user task ");
- memcpy((void*)utask,(void*)0x300000, 100); // 100 bytes seems reasonable to load utask
- asm (
- "cli \n\t" // Ensure we do not get interrupted
- "movl %%ss, %%eax \n\t"
- "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 $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 $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)
- );
+ print("Launch user task \n");
+ int* page_dir=paging_allocate(2);
+ run_task(page_dir, utask,100);
+
while(1);
}