-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.zig
47 lines (37 loc) · 1.1 KB
/
init.zig
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
const uart = @import("./io/uart.zig");
const process = @import("./kernel/process.zig");
const panic_handlers = @import("./kernel/panic.zig");
const syscalls = @import("./kernel/syscalls.zig");
const print = @import("./lib/print.zig");
const display = @import("./io/display.zig");
const atags = @import("./io/atags.zig");
const emmc = @import("./io/emmc.zig");
const pages = @import("./mem/pages.zig");
const mmu = @import("./mem/mmu.zig");
const std = @import("std");
pub fn panic(a: []const u8, b: ?*std.builtin.StackTrace, c: ?usize) noreturn {
_ = b;
_ = c;
asm volatile (
\\ mov r1, lr
\\ b panic_handler
:
: [arg1] "{r0}" (4),
[arg3] "{r2}" (&a[0]),
);
unreachable;
}
export fn init(r0: u32, r1: u32, r2: u32) void {
_ = r0;
_ = r1;
uart.init();
panic_handlers.init();
atags.init(r2);
pages.init();
mmu.init();
display.init();
syscalls.init();
print.println(.{emmc.read()});
print.println(.{ "Switching to user mode: ", 0x40000000 });
process.start_user_mode(@embedFile("./userspace/main.bin").*);
}