aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.c
blob: 3b75c7d8b2f935ba8a4b5eb4bef22fe8471546d4 (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
51
52
53
54
55
56
57
58
59
// MIT License, Copyright (c) 2020 Marvin Borner

#include <boot.h>
#include <cpu.h>
#include <fb.h>
#include <fs.h>
#include <ide.h>
#include <interrupts.h>
#include <keyboard.h>
#include <load.h>
#include <mem.h>
#include <mm.h>
#include <mouse.h>
#include <net.h>
#include <pci.h>
#include <random.h>
#include <serial.h>
#include <syscall.h>
#include <timer.h>

void kernel_main(struct mem_info *mem_info, struct vid_info *vid_info); // Decl
void kernel_main(struct mem_info *mem_info, struct vid_info *vid_info)
{
	// Clear stack
	for (u32 i = 0; i < STACK_SIZE; i++)
		((u8 *)STACK_START)[-i] = 0;

	// Serial connection
	serial_install();
	serial_print("\nKernel was compiled at " __TIME__ " on " __DATE__ "\n");
	serial_print("Serial connected.\n");

	memory_install(mem_info, vid_info);

	cpu_enable_features();
	cpu_print();
	srand(rdseed());

	// Install drivers
	vfs_install();
	device_install();
	ata_install();
	pci_install();
	interrupts_install();
	timer_install();
	keyboard_install();
	mouse_install();
	fb_install(vid_info);
	/* net_install(); */

	// Enable drivers
	sti();
	keyboard_reset();

	syscall_init();
	proc_init();

	idle();
}