Live data from Hacker News

Minimal x86 Kernel Zig

github.com

21–30 of 71 posts

Re: Minimal x86 Kernel Zig

#22
post #17

I'm very surprised it's *that* short - handling one in rust i'm surprised by the very low amount of code to get that up. Thanks or sharing that was a first time reading some Zig for me !

what you’re experiencing is more or less why I am building some stuff in Zig instead of Rust

Re: Minimal x86 Kernel Zig

#23
post #12

What's the point of doing this in "Zig" instead of C, the traditional choice for this kind of thing?

because Zig is simply a better C, often faster (normally at least as fast), but with way more safety guarantees or at least things preventing the vast majority of traditional C footguns from happening

Re: Minimal x86 Kernel Zig

#24
post #12

What's the point of doing this in "Zig" instead of C, the traditional choice for this kind of thing?

Zig is essentially a substantially improved and enhanced C, both in character and intent. There is a lot to recommend it for applications where you might otherwise use C.

Re: Minimal x86 Kernel Zig

#25

thats not a kernel

Indeed, it's freestanding, the repo name doesn't have the correct term, but the source file does near the end: https://github.com/lopespm/zig-minimal-kernel-x86/blob/main/... 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...

I think calling baremetal software a kernel keeps a bad impression on people just starting out, you can do alot with baremetal and it does not have to be a kernel

Re: Minimal x86 Kernel Zig

#28
Why to spread confusion and call it bare metal when it's run under QEMU? Then it's not bare metal at all.

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?

Re: Minimal x86 Kernel Zig

#29
post #12

What's the point of doing this in "Zig" instead of C, the traditional choice for this kind of thing?

I guess one of good reasons is easy cross-compilation.

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

Re: Minimal x86 Kernel Zig

#30
post #12

What's the point of doing this in "Zig" instead of C, the traditional choice for this kind of thing?

In this case, better tooling and consistency. E.g. the small block of inline assembly would already be trouble for some C compilers.
Post reply on HN