blob: 41c3a61dc99894fa79b806ffcaeb0ae0283bc432 (
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
|
#include "gdt.hpp"
#include "idt.hpp"
#include "memory.hpp"
#include "multiboot.hpp"
#include "pic.hpp"
#include "pit.hpp"
#include "tasking.hpp"
#include "vgaterminal.hpp"
static VGATerminal vga;
TextOutput& term = vga;
extern "C"
void kernel_main(void)
{
term.write("Clyne's kernel, v2024\n\n");
if (!multiboot_initialize())
for (;;);
idt_register_callback(14, [](const Registers& regs) {
term.write("Page fault! eip=");
term.write(regs.eip);
term.write('\n');
for (;;);
});
memory_initialize();
gdt_initialize();
pic_initialize();
idt_initialize();
pit_initialize(50);
asm volatile("sti");
tasking_initialize();
term.write("Tasking enabled.\n");
tasking_spawn([] {
for (;;)
term.write('B');
}, 256);
for (;;)
term.write('A');
}
extern "C"
void memmove(char* dst, char* src, size_t sz) {
while (sz) {
*dst = *src;
++dst;
++src;
--sz;
}
}
|