aboutsummaryrefslogtreecommitdiff
path: root/src/bringelle.c
blob: 17d38457a5e88504dd5ed370c87e13beb642d8ba (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
#include "libc/stdio.h"
#include "boot/multiboot.h"
#include "core/mem.h"
#include "core/gdt.h"
#include "core/paging.h"
#include "core/scheduler.h"

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<5000;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<5000;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");

  int* page_dir=paging_allocate(2);
  task_create(page_dir, utask,100, 0xFF);
  int* page_dir2=paging_allocate(2);
  task_create(page_dir2, utask2,100,0xFF);

  scheduler_start();

  while(1);
}