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.
_int00:
pusha
push ds
push es
push fs
push gs
mov eax,0x10 ; Data segment
mov ds,eax
mov es,eax
cld
call _int_00 ; Divide by Zero #DE
pop gs
pop fs
pop es
pop ds
popa
iret
when i try it out, the code loops. maybe it isn't returning to the same instruction instead of skipping it? or maybe i'm completely wrong! plz hlp. thanx
If the code caused a divide by zero error, some error in the code must exist, so you either send a signal there (pushing the signal handler stuff on the stack, and then returning) or you kill the process, in which case you also do not return.
As far as I can remember int0 is a fault so that cpu returns to faulting instruction rather than instruction that follows it. So cpu calls exception handling routine as long as the exception generating code is still there or you can handle it some another way as Solar told, you skip the exception generating code(did you mean this?) so if you do not do something like I told above in your exception handling routine(_int_00 I think), you will loop forever since exception generating code is there. So killing this process that divides by 0 will most likely be the best way to handle divide by 0 exception.
There is little point returning to the program as the variable will not contain an expected value and the program will probally crash again because of that.
Solar wrote:
Ozgunh82, I think xsism meant how to know by how many bytes to increment that address to skip over the current opcode and get to the next...
(No idea myself, didn't delve in there yet.)
exactly what i was asking solar, thanks. It would PROBABLY be better to just kill the process because the value it was trying to get will be incorrect and the app may crash due to that.
Besides, now that i think of it, exceptions are ment to alert the system so that it may kill the process or problem code.