Hi. I can't seem to understand this piece of i386 boot code: What I understand is that BIOS loads MBR at 0x7c00, then jumps to the code there, code that relocates itself to and jumps to 0x600, but what does movw $main-EXEC+LOAD,%si mean? if it's the source address to copy from, why is it $main (0x7c00) - EXEC (0x600) + LOAD (0x7c00) above main? then, movw $main,%di is the address to copy to... wasn't 0x600 the address to copy to? then jump to jmp main-LOAD+EXEC (0x600)?
I guess I am really missing something here, but I can't get to understand what's happening. start: cld # String ops inc xorw %ax,%ax # Zero movw %ax,%es # Address movw %ax,%ds # data movw %ax,%ss # Set up movw $LOAD,%sp # stack # # Relocate ourself to a lower address so that we are out of the way when # we load in the bootstrap from the partition to boot. # movw $main-EXEC+LOAD,%si # Source movw $main,%di # Destination movw $0x200-(main-start),%cx # Byte count rep # Relocate movsb # code # # Jump to the relocated code. # jmp main-LOAD+EXEC # To relocated code _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"