I'm learning to write a tiny os, and debug it using bochs. But now something strange happend. Following is the code which has been moved to 0x9000:0x0100
x/10 0x9000:0x0100:
I found that the following codes is the same with those in ghex, only that there is one more 00 in bochs's codes, just as I pointed out just now.
So how to explain that E96100? If you try to disassemble the E96100 to assembly code, you may find there is not corresponding relations with E96100 and jmp .+97, what's wrong with that?
As you can see, the beginning part of the code is jmp .+97, whose corresponding machine code is E96100, but the machine code isn't it! Open the file with ghex, and you can see the right machine code: EB61, in corresponding with the assembly code: jmp .+63h.
Then I looked the following codes in bochs using Something wrong with bochs?
Re: Something wrong with bochs?
0xe9 0x61 0x00 does indeed disassemble to jmp +97.MarkZar wrote:If you try to disassemble the E96100 to assembly code, you may find there is not corresponding relations with E96100 and jmp .+97, what's wrong with that?
As regards your problems, are you sure you are properly loading your kernel to the location you think you are? I suspect a problem with your bootloader.
Regards,
John.
Re: Something wrong with bochs?
Hi,
The rest of the bytes are identical, and I suspect your confusion is because it's little-endian- e.g. thinking that 0x00010102 is equivelent to the bytes "0x02, 0x01, 0x01, 0x00" when it's actually "0x00, 0x01, 0x01, 0x02".
Cheers,
Brendan
For the first 2 (or 3) bytes, 0xEB, 0x61 is "jmp short +0x61" and 0xE9, 0x61, 0x00 is "jmp near +0x0061". The only difference is likely to be whether or not you told the assembler to optimise.MarkZar wrote:I found that the following codes is the same with those in ghex, only that there is one more 00 in bochs's codes, just as I pointed out just now.
The rest of the bytes are identical, and I suspect your confusion is because it's little-endian- e.g. thinking that 0x00010102 is equivelent to the bytes "0x02, 0x01, 0x01, 0x00" when it's actually "0x00, 0x01, 0x01, 0x02".
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Something wrong with bochs?
Thanks, John and Brendan, it seems that something happend when compile/link the file. nothing wrong with bochs.