summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
blob: 7382a7db6a679c5083a5724e6da13e9e4df0fcfc (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
#include <comus/cpu.h>
#include <comus/memory.h>
#include <comus/mboot.h>
#include <comus/drivers.h>
#include <comus/fs.h>
#include <lib.h>
#include <stdio.h>
#include <time.h>

struct memory_map mmap;

void main(long magic, volatile void *mboot)
{
	(void)magic; // TODO: check multiboot magic

	// initalize idt and pic
	// WARNING: must be done before anything else
	cpu_init();

	// load memory map
	mboot_load_mmap(mboot, &mmap);

	// initalize memory
	memory_init(&mmap);

	// initalize devices
	drivers_init();

	// load file systems
	fs_init();

	// print current time
	char date[40];
	set_timezone(TZ_EDT);
	time_t time = get_localtime();
	timetostr(&time, "%a %b %d %Y %H:%M:%S", date, 40);
	printf("The date is: %s\n\n", date);

	// halt
	printf("halting...\n");
}