On 14/02/16 10:52, Victor Kaplansky wrote:
I've created a boot-sector which works just fine when loaded directly from BIOS, but doesn't work when loaded by ipxe:
0: b8 ad de mov ax,0xdead 3: a3 10 7c mov ds:0x7c10,ax
0xdead is not written to 0000:7c10. The reason is that BIOS have data segment register initialized to zero, while ipxe leaves it dirty before the jump to boot sector code.
After adding to boot sector some code to initialize DS register, my code works well:
0: b8 00 00 mov ax,0x0 3: 8e d8 mov ds,ax 5: b8 ad de mov ax,0xdead 8: a3 10 7c mov ds:0x7c10,ax
Is such behaviour intentional, or it is a bug? Who is responsible for segment registers initialization?
I'm not aware of any standard describing the content of %ds when jumping to a boot sector at 0000:7c00. Every boot sector that I have encountered explicitly initialises %ds (and %es, and %ss:%sp) to known values.
Your boot sector should probably do likewise.
Michael