-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.c
54 lines (48 loc) · 1.62 KB
/
start.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
45
46
47
48
49
50
51
52
53
54
/*****************************************************************************/
/* File: start.c */
/* */
/* Description: Kernel initialization code. */
/* start_kernel routine is called from boot32.S. */
/* */
/* Author: Shoily O Rahman <shoily@gmail.com> */
/* */
/* Date: Feb 11, 2020 */
/* */
/*****************************************************************************/
#include "type.h"
#include "util.h"
#include "system.h"
#include "setup32.h"
#include "memory.h"
#include "usermode.h"
#include "smp.h"
#include "acpi.h"
#include "debug.h"
#include "interrupt.h"
#include "lock.h"
//
// Start kernel routine
//
extern spinlock spinlock_smp;
int start_kernel(void) {
vga_init();
INIT_SPIN_LOCK(&spinlock_smp);
pgd_lock_init();
if (mem_init())
return -1;
debug_init();
printf(KERNEL_INFO, "XIS kernel starting (v1.0)\n");
dump_e820();
setup32();
bda_read_table();
interrupts_init();
acpi_init();
devices_init();
ioapic_init();
interrupts_enable();
smp_start();
initialize_usermode();
printf(KERNEL_INFO, "Kernel started ");
switch_to_um();
return 0;
}