Random far jump????????
Posted: Tue Oct 25, 2011 2:08 pm
I was using the Bochs debugger to step through this:
Something weird happened the second (the first time it worked fine) time the procedure was called. Before executing div [NumberOfHeads], CS:IP was 0000:7d74. After executing it, CS:IP was f000:ff53, pointing to an iret instruction. This is not a one-time fluke. I spent hours trying to track this down. Why does this happen? It makes no sense to me.
I didn't capture register information (Bochs debugger freezes if untouched for too long), but [NumberOfHeads] is 2 (it is a word) and ax SHOULD be 33 (decimal) but MIGHT be 31 or maybe some other number. I will see if I can grab some register info.
Code: Select all
LBAToCHS:
div [SectorsPerTrack]
mov cl, dl
inc cl
div [NumberOfHeads]
mov ch, al
mov dh, dl
mov dl, [DriveNumber]
ret
I didn't capture register information (Bochs debugger freezes if untouched for too long), but [NumberOfHeads] is 2 (it is a word) and ax SHOULD be 33 (decimal) but MIGHT be 31 or maybe some other number. I will see if I can grab some register info.