summaryrefslogtreecommitdiff
path: root/kernel/src/main.c
blob: 766d69cd22fcc6d85888b2a6ef53fdfe1b1950fc (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
#include <types.h>
#include <multiboot2.h>
#include <graphics.h>
#include <idt.h>
#include <paging.h>
#include <heap.h>
#include <keyboard.h>
#include <libk/serial_stdio.h>
#include <libk/stdio.h>
#include <libk/string.h>
#include <libk/math.h>
#include <libk/list.h>
#include <disc.h>
#include <ext2.h>
#include <timer.h>
#include <gdt.h>
#include <userspace.h>
#include <tss.h>
#include <serial.h>
#include <containter_of.h>
#include <madt.h>
#include <atomic.h>

int kernel_main(mb2_tag_header* multiboot_bootinfo, uint32_t multiboot_magic);
int kernel_main(mb2_tag_header* multiboot_bootinfo, uint32_t multiboot_magic)
{
	init_serial();
// serial is enabled from this point
	init_gdt();
	init_paging();
	init_heap();
	read_mb2(multiboot_bootinfo, multiboot_magic);
	clear_screen(main_fb);
// framebuffer is enabled from this point
	//mmap_t* pos;
	//list_for_each_entry(pos, (&mmap.list), list) {
	//	mb2_tag_mmap_entry entry = pos->mmap_entry;
	//	printf("base_addr: 0x%x, length: 0x%x, reserved: %d, type: %d\n", entry.base_addr, entry.length, entry.reserved, entry.type);
	//}

	init_keyboard();
	init_timer(TICKS_PER_SECOND);
	init_idt();
	disc_init();
	ext2_init();
	//ls(path_to_inode("/"));
	//print_inode(path_to_inode("/"));
	init_tss();

	list_sys_tables();
	parse_madt();

	jump_userspace();

	for(;;) {
		__asm__ volatile ("hlt;");
	}
	return 0;
}