aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
blob: 2ac40faa4bfa3e8913a76a84503ff5dd98b600a8 (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
42
43
44
comptime {
    asm (@embedFile("boot64.s"));
    asm (@embedFile("boot32.s"));
}

const debug = @import("debugcon.zig");
const console = @import("console.zig");

const ALIGN = 1 << 0;
const MEMINFO = 1 << 1;
const MAGIC = 0xE85250D6;
const FLAGS = 0;

const MultibootHeader = extern struct {
    magic: u32,
    flags: u32,
    len: u32,
    checksum: u32,

    tag0: u16,
    tag1: u16,
    tag2: u32,
};

export const multiboot2 align(4) linksection(".multiboot") = MultibootHeader{
    .magic = MAGIC,
    .flags = FLAGS,
    .len = 24,
    .checksum = 0x100000000 - (MAGIC + FLAGS + 24),
    .tag0 = 0,
    .tag1 = 0,
    .tag2 = 8,
};

export fn kmain() noreturn {
    console.initialize();
    console.setColor(0x2F);
    console.puts("64-bit Yadka");

    // write debug data
    debug.write("Hi!\n");

    while (true) {}
}