Reputation: 159
I want to set trap flag = 1, but without using pop algorithm. I know that it's possible, but I am not able to figure it out.
Upvotes: 1
Views: 1217
Reputation: 58518
FLAGS
is pushed onto the stack when an interrupt is generated, and popped from the stack by IRET
. So if you are still allowed PUSHF
, you could do something like
pushf
pop ax
or ax, 100h
push ax
call far do_iret
...
do_iret:
iret
If PUSHF
is not allowed, you could install an interrupt handler:
handler:
push bp
mov bp, sp
or word ptr [bp+6], 100h
pop bp
iret
set_trap_flag:
push 0
pop es
mov [es:42h*4], offset handler
mov [es:42h*4+2], segment handler
int 42h
where 42h
is some interrupt vector that's not otherwise being used.
(Note: code not tested and could have syntax errors or bugs.)
Upvotes: 1