diff --git a/asm/x86-unknown-none/bootloader.asm b/asm/x86-unknown-none/bootloader.asm index 487ac5de99c9a0e774883c383cb2eb0856bd40f4..3911cd059714d75fe8144d0bc3dee72b44857c52 100644 --- a/asm/x86-unknown-none/bootloader.asm +++ b/asm/x86-unknown-none/bootloader.asm @@ -15,7 +15,12 @@ stage2.end: ; the maximum size of stage2 is 4 KiB times (4*1024)-($-stage2) db 0 -; stage3, loaded at 0xD000 +; ISO compatibility, uses up space until 0x12400 +%include "iso.asm" + +times 3072 db 0 ; Pad to 0x13000 + +; stage3, loaded at 0x13000 stage3: %defstr STAGE3_STR %[STAGE3] incbin STAGE3_STR diff --git a/asm/x86-unknown-none/iso.asm b/asm/x86-unknown-none/iso.asm new file mode 100644 index 0000000000000000000000000000000000000000..e6f4b725ca05b4445094a3ad71e87238e2312004 --- /dev/null +++ b/asm/x86-unknown-none/iso.asm @@ -0,0 +1,100 @@ +; Simple ISO emulation with el torito + +; Fill until CD sector 0x10 +times (0x10*2048)-($-$$) db 0 + +; Volume record +;TODO: fill in more fields +iso_volume_record: +db 1 ; Type volume record +db "CD001" ; Identifier +db 1 ; Version + +times 120-($-iso_volume_record) db 0 + +db 0x01, 0x00, 0x00, 0x01 ; Volume set size +db 0x01, 0x00, 0x00, 0x01 ; Volume sequence number +db 0x00, 0x08, 0x08, 0x00 ; Logical block size in little and big endian + +times 156-($-iso_volume_record) db 0 + +; Root directory entry +.root_directory: +db 0x22 ; Length of entry +db 0x00 ; Length of extended attributes +db 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14 ; Location of extent (0x14) +db 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00 ; Size of extent +db 0x7a, 0x09, 0x06, 0x14, 0x07, 0x32, 0xe8 ; Recording time +db 0x02 ; File flags +db 0x00 ; Interleaved file unit size +db 0x00 ; Interleaved gap size +db 0x01, 0x00, 0x00, 0x01 ; Volume sequence number +db 0x01 ; Length of file identifier +db 0x00 ; File identifier + +times 128 db 0x20 ; Volume set identifier +times 128 db 0x20 ; Publisher identifier +times 128 db 0x20 ; Data preparer identifier +times 128 db 0x20 ; Application identifier +times 37 db 0x20 ; Copyright file ID +times 37 db 0x20 ; Abstract file ID +times 37 db 0x20 ; Bibliographic file ID + +times 881-($-iso_volume_record) db 0 + +db 1 ; File structure version + +; Fill until CD sector 0x11 +times (0x11*2048)-($-$$) db 0 + +; Boot record +iso_boot_record: +db 0 ; Type boot record +db "CD001" ; Identifier +db 1 ; Version +db "EL TORITO SPECIFICATION" ; Boot system identifier +times 0x47-($ - iso_boot_record) db 0 ; Padding +dd 0x13 ; Sector of boot catalog + +; Fill until CD sector 0x12 +times (0x12*2048)-($-$$) db 0 + +; Terminator +iso_terminator: +db 0xFF ; Type terminator +db "CD001" ; Identifier +db 1 ; Version + +; Fill until CD sector 0x13 +times (0x13*2048)-($-$$) db 0 + +; Boot catalog +iso_boot_catalog: + +; Validation entry +.validation: +db 1 ; Header ID +db 0 ; Platform ID +dw 0 ; Reserved +times 24 db 0 ; ID string +dw 0x55aa ; Checksum +dw 0xaa55 ; Key + +; Default entry +.default: +db 0x88 ; Bootable +db 4 ; Hard drive emulation +dw 0 ; Load segment (0 is platform default) +db 0xEE ; Partition type (0xEE is protective MBR) +db 0 ; Unused +dw 1 ; Sector count +dd 0 ; Start address for virtual disk +times 20 db 0 ; Padding + +; Fill until CD sector 0x14 +times (0x14*2048)-($-$$) db 0 + +iso_empty: + +; Fill until CD sector 0x15 +times (0x15*2048)-($-$$) db 0 \ No newline at end of file diff --git a/linkers/x86-unknown-none.ld b/linkers/x86-unknown-none.ld index 792590fac8ed70fbf8684f47ecbdb8ba943c10e6..21f5729743d239368e163ee78828f6135b9b19a4 100644 --- a/linkers/x86-unknown-none.ld +++ b/linkers/x86-unknown-none.ld @@ -3,7 +3,7 @@ OUTPUT_FORMAT(elf32-i386) SECTIONS { /* The start address must match bootloader.asm */ - . = 0xD000; + . = 0x13000; . += SIZEOF_HEADERS; . = ALIGN(4096);