Zig Bare Bones: Difference between revisions

m
fix syntax highlighting error
[unchecked revision][unchecked revision]
mNo edit summary
m (fix syntax highlighting error)
 
(3 intermediate revisions by the same user not shown)
Line 222:
A [[linker script]] is also needed. This file tells the linker to place our code at the base address of 1M. In general user-space programming, code are placed at much higher areas, but that requires [[virtual memory]] to be available, or else only few computers could provide such a large physical memory space.
 
We also asks the linker to place <code>.multiboot</code> section at first, because the Multiboot specification says that the Multiboot header must be at the first 8KiB of the kernel file.<syntaxhighlight>
 
<pre>
ENTRY(_start)
Line 249 ⟶ 251:
}
}
</pre>
</syntaxhighlight>
 
=== src/grub.cfg ===
Line 256 ⟶ 258:
<code>menuentry</code> adds a menu entry to the screen. When you press ENTER in the GRUB menu, GRUB will run the commands in the menu block.
 
<code>multiboot</code> asks GRUB to load our kernel from <code>/boot/kernel.elf</code>, and GRUB automatically runs <code>boot</code> after the menu block, which will fire the boot.<syntaxhighlight lang="unixconfig">
 
</syntaxhighlight lang="unixconfig">
menuentry "Zig Bare Bones" {
multiboot /boot/kernel.elf