aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
blob: 283d9378a7e5b0cbbc7b5d4d060cd98b07a1d203 (plain) (blame)
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
// MIT License, Copyright (c) 2020 Marvin Borner

#include "config.h"
#include <boot.h>
#include <def.h>
#include <elf.h>
#include <fs.h>
#include <gui.h>
#include <interrupts.h>
#include <keyboard.h>
#include <print.h>
#include <serial.h>
#include <timer.h>

u32 HEAP = 0x00200000;
u32 HEAP_START;

void main(struct mem_info *mem_info, struct vid_info *vid_info)
{
	HEAP_START = HEAP; // For malloc function

	// Initialize VESA video
	vesa_init(vid_info->info);
	u32 terminal_background[3] = { 0, 0, 0 };
	vesa_fill(terminal_background);

	// Serial connection
	serial_install();
	serial_print("\nConnected.\n");

	// Install drivers
	interrupts_install();
	timer_install();
	keyboard_install();

	// Enable drivers
	__asm__("sti");

	mem_info++; // TODO: Use the mmap (or remove)!

	ls_root();
	gui_init(FONT_PATH);

	gui_term_write("Wake up, " USERNAME "...\n");
	elf_load("/test");
	printf("loaded");

	while (1) {
	};
}