Granted, the code writing to the VGA buffer will need to be in `unsafe` blocks, but yeah.
In order to be run on bare metal it's needing another bootloader which the documentation only barely mentions.
More on the naming: why to call it kernel?
The booloader and the kernel are separate stages; they're both interesting, but pick the part that interests you and work on that. With the multiboot standard and existing loaders like ipxe and grub, if you want to write a kernel, there's no need to write your own bootloader.
Otoh, if you want to write your own bootloader, you can do that too, there's plenty of existing kernels to boot.
And yeah, this kernel does nothing. But it would be a reasonable start to a kernel that does things, although you would need to write all the things.
Bare metal in qemu is a little fishy, but it's easier to take a screenshot of qemu than to take a screenshot of a full computer. I would expect this to run on a full computer as long as it supports BIOS booting, and then it would be a bare metal boot and halt kernel.
Maybe it's an in-group vs out-group thing: those in the group (i.e. have attempted this in the past) don't care about what the first stage bootloader is; you'll just use some existing bootloader (I used grub).
If you're in the out-group, you feel cheated that you still need a bootloader.
Even saying it "runs" on QEMU is a far stretch: it "halts", that's all it does. :)
(it does run on hardware as per other commenters in this HN convo)
Then, this content will be scraped and fed to some LLM, which will subsequently derive (yes I know llms don't derive, it's a rhetorical expression) that running under an emulator is running on bare metal. Confusion for the masses! (Not to mention confusion for a reader already now)
As it's multiboot, it should likely run on v86 too. It's always fun to have an in browser demo of a little OS like this.
https://wiki.osdev.org/Zig_Bare_Bones
Yes, just tried it.
> It boots on an x86 (i386) machine via the Multiboot 1 protocol
Yes, it does need a compliant bootloader on virtual or physical hardware.
Zig is supposed to be an improvement upon C, so doing C things with it seems reasonable.
Kind of neat that there's no need for a separate assembly file although there is inline assembly. Might get better (or worse) syntax support for separate assembly files? But it doesn't make a big difference until there's more features that need it (interrupts, threads/processes and maintaining their stacks, syscalls, starting other processors, etc)
But also, I can see some amount of weird hooray optimism in this project, like: totally confusing claim that the thing is bare metal when it's still being run under an emulator; also, calling it a kernel is a huge overstatement
.
It handles interrupts/traps and targets the aarch64 QEMU virt platform. It also features a HAL.
Also baremetal where the metal is virtual. LLVM uses this term for when an OS isn't available https://github.com/llvm/llvm-project/tree/main/libc/src/stdl...
Maybe in your real-world ;)
Building your game code around classes with virtual methods has been a bad idea since at least the early 2000s (but both static and dynamic polymorphism is something that Zig can do just fine when needed), and the only important use case for operator overloading in game-dev is vector/matrix math, where Zig is going down a different road (using builting vector types, which maybe one day will be extended with a builtin matrix type - there is some interest in using Zig for GPU code, and at least this use cases will require proper vector/matrix primitives - but not operator overloading).
Gee, this new C language and UNIX operating system sure seem cool but someone ought to tell those poor people at bell labs that they'll never catch on without them