Hi, All!
How can I set TF flag from my program?
Posted on 2001-10-12 07:15:06 by vkim
This is a quick answer, but i think it's ok :)




pushf ; push original flags
pop eax ; copy original flags into EAX
or eax,0100h ; set bit 8 - Trap Flag
push eax ; push flags value to be set
popf ; pop flags with TF set




Check a flag's diagram
here
Bye!

Latigo
Posted on 2001-10-12 09:50:04 by latigo
... and once you have done that, there will be a LOT of code to do :).
I guess it can be handled with SEH? But I'm not sure... it's a long
time since I looked at win32 TF source, and it looked sorta dodgy.
Posted on 2001-10-12 11:12:17 by f0dder
I think instead of "pushf/popf" you have to use "pushfd/popfd".

And SEH should work in any case.

japheth
Posted on 2001-10-12 11:32:43 by japheth
push/popf *should* work (100h is pretty much in the low end of eflags =),
but I have bad experiences with pushing/popping non-dword
data on the stack :). Doing a pushf followed by a pop eax
sounds dangerous to me, anyway.

But what about this alternative method?



pushfd
or dword ptr [esp], 100h
popfd
Posted on 2001-10-12 12:00:55 by f0dder
That would be tighter :)

Latigo
Posted on 2001-10-12 12:18:00 by latigo
Thanks!
Of course, I'll trap exception with SEH.
Posted on 2001-10-12 22:16:22 by vkim