blob: 22791f30a9a93bbfba73d0105a75fd702b6f4629 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "libc/stdio.h"
#include "boot/multiboot.h"
#include "core/mem.h"
#include "core/gdt.h"
#include "core/paging.h"
#include "core/scheduler.h"
#define TASK_WAIT 50000000
extern void interrupt_enable();
void utask(){
char *msg=(char*)PAGING_ENTRY_POINT_VIRT+300;
msg[0]='A';
msg[1]='\0';
while(1){
asm("mov $0x1, %%eax;int $0x30"::"b"(msg));
for(int i=0;i<TASK_WAIT;i++){
}
}
}
void utask2(){
char *msg=(char*)PAGING_ENTRY_POINT_VIRT+300;
msg[0]='B';
msg[1]='\0';
while(1){
asm("mov $0x1, %%eax;int $0x30"::"b"(msg));
for(int i=0;i<TASK_WAIT;i++){
}
}
}
/**
* Kernel entry point
*/
void bringelle(){
clear();
printc("Booting Bringelle...\n",GREEN);
// ----- Kernel boot sequence
interrupt_enable();
print("Interrupts enabled\n");
paging_enable();
print("Paging enable\n");
print("Kernel started!\n");
print("-----------------------\n");
show_tics=1;
// Utask
print("Launch user tasks \n");
task_create(utask,100);
task_create(utask2,100);
scheduler_start();
while(1);
}
|