blob: e6aa878a26b3fe6fd4de1036e776092b8707d2d2 (
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
|
#include <kernel/arch/generic.h>
#include <kernel/main.h>
#include <kernel/mem/alloc.h>
#include <kernel/proc.h>
#include <kernel/tests/tests.h>
#include <kernel/util.h>
#include <stdint.h>
_Noreturn static void run_init(struct kmain_info *info) {
struct process *proc = process_seed();
void __user *init_base = (userptr_t)0x200000;
// map the module as rw
for (uintptr_t off = 0; off < info->init.size; off += PAGE_SIZE)
pagedir_map(proc->pages, init_base + off, info->init.at + off,
true, true);
proc->regs.eip = init_base;
tty_const("switching...\n");
process_switch(proc);
}
void kmain(struct kmain_info info) {
tty_const("mem...\n");
mem_init(&info);
tty_const("tests...\n");
tests_all();
tty_const("loading init...\n");
run_init(&info);
}
|