Open Blazing-Blast opened 7 months ago
I think I see why this was chosen, the MBR gets loaded to 0x7c00, but does Stage 2 really have to be as well? Can't it go somewhere else, to avoid this relocation?
The caveat is there is no “stage 2”. The MBR loads the El Torito payload - which is also a first stage on its own. Both of those expect to be at 0x7c00
. The El Torito payload could be built to be more flexible about where it is loaded, but that is relatively more complicated: The MBR being inefficient is of little concern; it is a quick hack to allow the CD images to be written to hard disks.
That seems completely fair, although in the comments it is referred to as 'stage 2'.
At the moment the MBR does the following:
Why not load Stage 2 into 0x7c00 the first time? Just skip steps 7 and 8.
I can speculate that the
inc %eax
at line 29, makes it so that too much is loaded from the disk, but in that case, wouldn't it be easier to zero out0x7c00 + $BOOT_FILE_SIZE
until0x7c00 + dap_sectors * drive_params_bps
?Or is there another issue that I'm not seeing?