Page 1 of 1

BIOS Exception handlers...

Posted: Tue Dec 05, 2006 12:18 pm
by JJeronimo
When I'm programming in asm still in real mode, if I commit an exception, the BIOS (or DOS?) handles it... but the handlers are a bit (very) strange...

They just say, for example, "Invalid opcode at", and then a bunch of misterious hexadecimal digits, organized in groups of four (words)... they haven't got (as far as I've found) anything to do with the code that caused the exception...

Can someone explain me what they exactly mean?

JJ

Posted: Tue Dec 05, 2006 4:02 pm
by Combuster
they give the offending CS:IP, i.e. the location where the exception occurred

Posted: Tue Dec 05, 2006 5:49 pm
by JJeronimo
Combuster wrote:they give the offending CS:IP, i.e. the location where the exception occurred
That's the natural answer: the handler displays the processor state... But do you actually know what handlers I'm talking about?
DOS extenders usually display the processor state in a pretty table, but BIOS (or DOS, doesn't really metter) don't...

The handler prints about 8 or 9 (don't remember exactly at the moment) groups of four hex digits each (i.e. 16 bit integers/pointers), so I ask: what group of digits represents the 16 bits CS and what of them does represent the 16 bit IP?

For example:
Coprocessor not found at 54DA 768B FEA5 34FE 432F FEA5 34FE 54DA CD78 432F 6AB4 .... .... ....
Invalid opcode at CD78 432F FEA5 34FE 54DA 768B FEA5 34FE CD78 432F 6AB4 .... .... ....

Thanks,
JJ

Posted: Wed Dec 06, 2006 5:50 am
by Walling
JJeronimo wrote:For example:
Coprocessor not found at 54DA 768B FEA5 34FE 432F FEA5 34FE 54DA CD78 432F 6AB4 .... .... ....
Invalid opcode at CD78 432F FEA5 34FE 54DA 768B FEA5 34FE CD78 432F 6AB4 .... .... ....
Maybe it is actually opcodes. It is just a guess. However it is odd because I don't (or 'ndisasm' so to speak) see any invalid opcodes, which the second exception is about. It disassembles to:

Code: Select all

# 54DA 768B FEA5 34FE 432F FEA5 34FE 54DA CD78 432F 6AB4 ...

0000    54            push sp
0001    DA768B        fidiv dword [bp-0x75]
0004    FE            db 0xFE
0005    A5            movsw
0006    34FE          xor al,0xfe
0008    43            inc bx
0009    2F            das
000A    FE            db 0xFE
000B    A5            movsw
000C    34FE          xor al,0xfe
000E    54            push sp
000F    DACD          fcmove st5
0011    7843          js 0x56
0013    2F            das
0014    6AB4          push byte -0x4c


# CD78 432F FEA5 34FE 54DA 768B FEA5 34FE CD78 432F 6AB4 ...

0000    CD78          int 0x78
0002    43            inc bx
0003    2F            das
0004    FE            db 0xFE
0005    A5            movsw
0006    34FE          xor al,0xfe
0008    54            push sp
0009    DA768B        fidiv dword [bp-0x75]
000C    FE            db 0xFE
000D    A5            movsw
000E    34FE          xor al,0xfe
0010    CD78          int 0x78
0012    43            inc bx
0013    2F            das
0014    6AB4          push byte -0x4c
I don't know if it looks familiar to you or not.

Posted: Wed Dec 06, 2006 6:11 am
by Combuster
JJeronimo wrote:For example:
Coprocessor not found at 54DA 768B FEA5 34FE 432F FEA5 34FE 54DA CD78 432F 6AB4 .... .... ....
Invalid opcode at CD78 432F FEA5 34FE 54DA 768B FEA5 34FE CD78 432F 6AB4 .... .... ....
Sorry, i thought you got a message like "Exception at xxxx:xxxx" which dos has bugged me with quite often...

As for what THESE numbers are, they look like some sort of memory dump as the messages are similar but not equal.

Posted: Wed Dec 06, 2006 7:26 am
by JJeronimo
Walling wrote:
JJeronimo wrote: I don't know if it looks familiar to you or not.
Nope! It was just random numbers to make you understand the problem better!

But I see Combuster got the idea...

JJ

Posted: Wed Dec 06, 2006 7:27 am
by JJeronimo
Combuster wrote: Sorry, i thought you got a message like "Exception at xxxx:xxxx" which dos has bugged me with quite often...
DOS has never shown me something of that sort...
As for what THESE numbers are, they look like some sort of memory dump as the messages are similar but not equal.
Thanks, I'll verify that...

JJ

Posted: Wed Dec 06, 2006 7:53 am
by Walling
JJeronimo wrote:Nope! It was just random numbers to make you understand the problem better!
Oops... :)

Posted: Wed Dec 06, 2006 10:37 am
by Combuster
JJeronimo wrote:Nope! It was just random numbers to make you understand the problem better!
so it WAS a memory dump: a mental one :P

Please, next time ask your questions a bit better, you see what happens if you dont.
As for now, what are the exact values?

Posted: Wed Dec 06, 2006 5:19 pm
by JJeronimo
Combuster wrote: Please, next time ask your questions a bit better, you see what happens if you dont.

As for now, what are the exact values?
They depend on the program... I think i'll end writting a TSR program to have useful handlers...

JJ