bringelle/src/bringelle.c

65 lines
1.1 KiB
C
Raw Normal View History

2021-04-09 10:29:23 +02:00
#include "libc/stdio.h"
#include "boot/multiboot.h"
2021-04-12 10:13:21 +02:00
#include "core/mem.h"
#include "core/gdt.h"
#include "core/paging.h"
2021-04-13 18:09:43 +02:00
#include "core/scheduler.h"
2021-04-09 18:18:15 +02:00
2021-04-12 10:13:21 +02:00
extern void interrupt_enable();
2021-04-10 17:24:13 +02:00
2021-04-09 18:18:15 +02:00
void utask(){
2021-04-17 16:31:45 +02:00
char *msg=(char*)PAGING_ENTRY_POINT_VIRT+300;
2021-04-16 14:39:24 +02:00
msg[0]='A';
msg[1]='\0';
while(1){
asm("mov $0x1, %%eax;int $0x30"::"b"(msg));
2021-04-16 20:20:29 +02:00
for(int i=0;i<5000;i++){
2021-04-16 14:39:24 +02:00
}
}
}
void utask2(){
2021-04-17 16:31:45 +02:00
char *msg=(char*)PAGING_ENTRY_POINT_VIRT+300;
2021-04-16 14:39:24 +02:00
msg[0]='B';
msg[1]='\0';
while(1){
asm("mov $0x1, %%eax;int $0x30"::"b"(msg));
2021-04-16 20:20:29 +02:00
for(int i=0;i<5000;i++){
2021-04-16 14:39:24 +02:00
}
}
2021-04-09 18:18:15 +02:00
}
2021-04-16 20:20:29 +02:00
/**
* Kernel entry point
*/
2021-04-04 11:19:55 +02:00
void bringelle(){
clear();
2021-04-09 18:18:15 +02:00
printc("Booting Bringelle...\n",GREEN);
2021-04-12 10:13:21 +02:00
// ----- Kernel boot sequence
interrupt_enable();
2021-04-10 17:24:13 +02:00
print("Interrupts enabled\n");
2021-04-09 18:18:15 +02:00
2021-04-11 20:53:06 +02:00
paging_enable();
2021-04-14 14:13:44 +02:00
print("Paging enable\n");
print("Kernel started!\n");
print("-----------------------\n");
2021-04-11 20:53:06 +02:00
show_tics=1;
2021-04-14 14:13:44 +02:00
2021-04-09 18:18:15 +02:00
// Utask
2021-04-16 14:39:24 +02:00
print("Launch user tasks \n");
2021-04-14 14:13:44 +02:00
int* page_dir=paging_allocate(2);
2021-04-16 18:26:11 +02:00
task_create(page_dir, utask,100, 0xFF);
2021-04-16 14:39:24 +02:00
int* page_dir2=paging_allocate(2);
2021-04-16 18:26:11 +02:00
task_create(page_dir2, utask2,100,0xFF);
2021-04-14 14:13:44 +02:00
2021-04-16 14:39:24 +02:00
scheduler_start();
2021-04-09 18:18:15 +02:00
2021-04-04 11:19:55 +02:00
while(1);
}
2021-04-13 15:31:45 +02:00