Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiboot is fixed but using multiboot v1 for now, should work fine, …
…memory paging next
- Loading branch information
Showing
13 changed files
with
127 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
exit_missing() { | ||
printf "$_ must be installed\n" ; exit 1; | ||
} | ||
|
||
which xorriso || exit_missing | ||
which grub-mkrescue || exit_missing | ||
mkdir -p build/iso/boot | ||
cp build/bzImage build/iso/boot | ||
grub-mkrescue -o build/kernel.iso build/iso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
QEMU_SOCKET=/tmp/qemu.sock | ||
QEMU_MONITOR="socat - UNIX-CONNECT:${QEMU_SOCKET}" | ||
QEMU_GDB_PORT=4242 | ||
KERNEL=build/bzImage | ||
|
||
start() { | ||
sudo pkill -9 qemu | ||
sudo qemu-system-i386 \ | ||
-gdb tcp::${QEMU_GDB_PORT} \ | ||
-monitor unix:${QEMU_SOCKET},server,nowait \ | ||
-enable-kvm \ | ||
-display curses \ | ||
-device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no \ | ||
-kernel ${KERNEL} | ||
# build/kernel.iso | ||
"$@" | ||
} | ||
|
||
monitor() { | ||
if [ "$1" == "" ]; then | ||
sudo ${QEMU_MONITOR} | ||
else | ||
echo "$1" | sudo ${QEMU_MONITOR} >/dev/null | ||
fi | ||
} | ||
|
||
reload() { | ||
monitor stop | ||
# monitor "change ide1-cd0 ${KERNEL}" | ||
monitor system_reset | ||
monitor cont | ||
} | ||
|
||
gdb() { | ||
gdb -q \ | ||
-symbols "${KERNEL}" \ | ||
-ex "target remote :${QEMU_GDB_PORT}" \ | ||
-ex "set arch i386" | ||
} | ||
|
||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
usingnamespace @import("kernel").main; | ||
usingnamespace @import("kernel").multiboot; | ||
const idt = @import("idt.zig"); | ||
const mem = @import("mem.zig"); | ||
const gdt = @import("gdt.zig"); | ||
const x86 = @import("lib/index.zig"); | ||
const assert = @import("std").debug.assert; | ||
const console = @import("../console.zig"); | ||
|
||
/// x86 specific intialization | ||
/// first entry point (see linker.ld) | ||
export nakedcc fn x86_main(magic: u32, info: *const MultibootInfo) noreturn { | ||
// assert(magic == MULTIBOOT_BOOTLOADER_MAGIC); | ||
gdt.initialize(); | ||
pub fn x86_main(info: *const MultibootInfo) void { | ||
mem.initialize(info); | ||
// gdt.initialize(); | ||
idt.initialize(); | ||
x86.sti(); | ||
kmain(magic, info); | ||
// x86.sti(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
usingnamespace @import("kernel").multiboot; | ||
const assert = @import("std").debug.assert; | ||
const vga = @import("../../vga.zig"); | ||
|
||
pub fn initialize(info: *const MultibootInfo) void { | ||
assert((info.flags & MULTIBOOT_INFO_MEMORY) != 0); | ||
assert((info.flags & MULTIBOOT_INFO_MEM_MAP) != 0); | ||
|
||
vga.printf("lower: {x}\n", info.mem_lower); | ||
vga.printf("upper: {x}\n", info.mem_upper); | ||
vga.printf("mmap_l: {}\n", info.mmap_length); | ||
vga.printf("mmap_a: {x}\n", info.mmap_addr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters