diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-12-25 02:55:41 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-12-25 21:25:16 +0100 |
commit | a2ce17753fa4a727f082bfb9bd515dc3fde56f02 (patch) | |
tree | 9b5d3c309a32c483e4d9cec34d1fe57a476da578 /x86-bare-metal/mbr-pure-zig/mbr.ld | |
parent | 14845124cf5d4fb42a04cb1262b32bd3d00f45f8 (diff) | |
download | zig-playground-a2ce17753fa4a727f082bfb9bd515dc3fde56f02.tar.gz zig-playground-a2ce17753fa4a727f082bfb9bd515dc3fde56f02.zip |
mbr: zig only real mode 16 bit
Diffstat (limited to 'x86-bare-metal/mbr-pure-zig/mbr.ld')
-rw-r--r-- | x86-bare-metal/mbr-pure-zig/mbr.ld | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/x86-bare-metal/mbr-pure-zig/mbr.ld b/x86-bare-metal/mbr-pure-zig/mbr.ld new file mode 100644 index 0000000..9ada8c4 --- /dev/null +++ b/x86-bare-metal/mbr-pure-zig/mbr.ld @@ -0,0 +1,24 @@ +/*OUTPUT_FORMAT(binary)*/ +OUTPUT_FORMAT(elf32-i386) +OUTPUT_ARCH(i386) +ENTRY(_entry) + +SECTIONS { + . = 0x7c00; + .boot : { *(.boot) } + .text : { *(.text) } + .data : { *(.data) } + .rodata : { *(.rodata) *(.rodata.str*) } + _boot_end = .; + + . = 0x7c00 + 510; + .mbr.magic : { + BYTE(0x55); + BYTE(0xaa); + } + + /*/DISCARD/ : { *(.*) }*/ + /*rest : { *(.*) }*/ + + ASSERT(_boot_end - 0x7c00 < 510, "boot sector must fit in 510 bytes") +} |