Zig Bare Bones: Difference between revisions

Jump to navigation Jump to search
m
put syntaxhighlight block in their own line
[unchecked revision][unchecked revision]
mNo edit summary
m (put syntaxhighlight block in their own line)
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>
 
<syntaxhighlight>
ENTRY(_start)
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
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu