-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel.c
65 lines (42 loc) · 1.17 KB
/
kernel.c
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 <kernel/drivers/fat.h>
#include <kernel/drivers/kbd.h>
#include <kernel/drivers/vga.h>
#include <kernel/gdt.h>
#include <kernel/idt.h>
#include <kernel/pic.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
void
kernel_main(void)
{
vga_init();
printf("Hello from Magikaed-OS kernel!\n");
printf("Loading GDT...\n");
gdt_init();
printf("GDT Loaded!\n");
printf("Loading IDT...\n");
idt_init();
printf("IDT Loaded...\n");
printf("Initializing PIC...\n");
pic_init();
printf("PIC Initialized!\n");
printf("Initializing Keyboard Driver...\n");
kbd_init();
printf("Keyboard Driver Initialized. You can start typing!\n");
printf("This is a test for printf! num = %d, -num = %d\n", 123, -123);
struct fat_bootsector fat_bootsector;
struct fat32_ext_bootrecord* fat32_ext;
char vol_label[12];
fat_load_bootsector(&fat_bootsector);
fat32_ext = (struct fat32_ext_bootrecord*)&fat_bootsector.ext;
memcpy(vol_label, fat32_ext->vol_label, 10);
vol_label[11] = '\0';
printf("Using volume: %s\n", vol_label);
while (true) {
char buffer[256];
kbd_read(buffer, 256);
printf(buffer);
}
}