Page 2 of 2
Re: .COM executable
Posted: Fri Dec 02, 2016 12:27 pm
by Ycep
I'm 100% sure I'm not running in user mode.
Starting to get headache from this...
Whoops, sorry, I'm telling you wrong:
This works
This works too:
But this does not (releases GPF):
Code: Select all
lea ebx, [str1]
mov eax, 2
int 0x5F
ret
str1: db "This is a test.",0x00
Re: .COM executable
Posted: Fri Dec 02, 2016 1:11 pm
by Kevin
Then I guess you don't have a valid handler for interrupt 0x5f.
Re: .COM executable
Posted: Fri Dec 02, 2016 2:11 pm
by SpyderTL
Try removing this line first:
Then try replacing that line, and removing this line:
Then try replacing the "ret" at the end with a x: jmp x line like your other code.
These are the only three lines that could possibly cause a GPF. (I believe)
This should tell you which of these three lines is causing the problem, and give you a hint how to fix it.
My guess is that the code is not being loaded to the memory location that you think it is, or this code is being jumped to instead of called, meaning your "ret" instruction is returning to "nowhere".
Re: .COM executable
Posted: Mon Dec 05, 2016 4:57 am
by Ycep
Hurray! I fixed it! It works!
Thanks to everybody who helped me.
The problem was in my system calls interrupt. It's fixed now!
Re: .COM executable
Posted: Tue Dec 06, 2016 12:10 am
by trolly
you need to do relocation, or write a Position independent code in the com executable