Where in memory does an EL-Torito bootsector end?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Isaac
Member
Member
Posts: 66
Joined: Sat Dec 07, 2013 7:08 pm

Re: Where in memory does an EL-Torito bootsector end?

Post by Isaac »

I don't know which debugger to use or how to install it. I searched the internet for information on how to install a debugger or how to use one, but I didn't find anything useful.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Where in memory does an EL-Torito bootsector end?

Post by sortie »

You potentially want the Bochs debugger. You can enable it when you compile your own custom Bochs.
Isaac
Member
Member
Posts: 66
Joined: Sat Dec 07, 2013 7:08 pm

Re: Where in memory does an EL-Torito bootsector end?

Post by Isaac »

Say, isn't this weird? I took the same code and changed it a little:

Code: Select all

BITS 16
[org 0x7C00]
start:
mov ah,0xe
mov al,'F'
int 0x10
mov ah,0xe
mov al,'S'
int 0x10
jmp $
times 510-($-$$) db 0
dw 0xaa55
Then I assembled it and (without El Torito stuff) tested it out in QEMU. It prints both letters (the "F" and the "S")!
Isaac
Member
Member
Posts: 66
Joined: Sat Dec 07, 2013 7:08 pm

Re: Where in memory does an EL-Torito bootsector end?

Post by Isaac »

I emailed Mike, the editor of the OS Development Series on BrokenThorn.com, asking him my question. He reformatted my code and sent it back to me in an email. When I looked at the way he reformatted my code, I understood what the problem with my code was. An ISO 9660 bootfile has a different format. At 8 bytes into your code, ISO 9660 puts in two system identifier fields, each one taking up 32 bytes. Since I didn't declare a space for these fields, they were put in anyway, overwriting some of my code. To avoid this problem, my code can be written like this:

Code: Select all

BITS 16
[org 0x0]
jmp 0x7c0:start
times 71-($-$$) db 0
start:
mov ah,0xe
mov al,'F'
int 0x10
mov al,'S'
int 0x10
jmp $
times 2048-($-$$) db 0
In the light of this, it can also be explained why when I wrote my code as shown below, assembled it and tested it out on QEMU without El Torito stuff, it worked.

Code: Select all

BITS 16
[org 0x7C00]
start:
mov ah,0xe
mov al,'F'
int 0x10
mov ah,0xe
mov al,'S'
int 0x10
jmp $
times 510-($-$$) db 0
dw 0xaa55
Since this is not an ISO 9660 bootfile, it doesn't need to declare a space for system identifier fields.
Post Reply