Page 1 of 1
Can't get out of routine
Posted: Thu Sep 23, 2010 9:58 am
by smoothCoder
Code: Select all
;here calls work fine
call bermuda_routine
mov byte [0b8000h], "A"
jmp $
stupid_routine:
mov byte [0b8002h], "B"
ret
bermuda_routine:
.........
mov byte [0b8004h], "C"
call stupid_routine
mov byte [0b8006h], "D"
ret
output: " BCD" and infinite loop
Re: Can't get out of routine
Posted: Thu Sep 23, 2010 11:50 am
by smoothCoder
I have printed the [RSP] memory in the begining of the routine and at the end, and the saved RIP has not changed.
And here go another weird example:
Code: Select all
;here calls work fine
call bermuda_routine
mov byte [0b8000h], "A"
mov byte [0b8000h], "A" ;repeating this instruction make the code to print the expected: "ABCD"
jmp $
stupid_routine:
mov byte [0b8002h], "B"
ret
bermuda_routine:
.........
mov byte [0b8004h], "C"
call stupid_routine
mov byte [0b8006h], "D"
ret
PD: Ok. Definitively the omited code in the routine is the responsable, but still appears illogical to me. The RSP is not modified nor the [RSP].
Re: Can't get out of routine SOLVED
Posted: Thu Sep 23, 2010 1:18 pm
by smoothCoder
Ok. Finaly resolved. I was searching the error in the wrong place-in the STACK. But the error was that an instruction modified the address part of the "mov byte [0b8000h], 'A'" instruction. So the char was writen somewhere but not in the screen and the loop was the normal execution of the "jmp $".