forked from domspad/yehos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kmain.c
45 lines (35 loc) · 861 Bytes
/
kmain.c
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
#include "asmhelpers.h"
#include "kb.h"
#include "vgatext.h"
#include "ata.h"
#include "DiskFile.h"
#include "kernel.h"
#include "virtualmem.h"
#include "memlib.h"
#include "task.h"
extern char START_BSS[], END_BSS[];
void setup_interrupts(void *idtaddr);
void setup_timer(int timer_hz);
void idle();
typedef int (*mainptr_t)(int argc, char **argv);
void
kmain(void)
{
memset(START_BSS, 0, END_BSS - START_BSS);
vga_cls();
kprintf("sizeof(uint32_t)=%d, sizeof(uint64_t)=%d\n", sizeof(uint32_t), sizeof(uint64_t));
setup_interrupts((void *) 0x1000);
setup_paging();
setup_virtual_stack();
init_ata();
ata_disk *d = &disks[0];
mmap_disk(d);
int r = fork();
if (r) {
idle();
}
mmap("FORTH.BIN", 0x01000000);
vga_cls();
mainptr_t entry = (mainptr_t) 0x01000000;
(*entry)(0, NULL);
}