Very Strange Behavior (iret on x86)

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
hello all:

i have encounter some very strange behavior that i haven't been able to
diagnos.  i'm attempting
to do a software task switch on the x86 in pmode.  what i'm doing basically
is this:

current state:
eflag=0x2 (w/ IF=0 IOPL=0)
cs = 0x8 (DPL=0 0x00000000-0x000fffff)
ds and ss = 0x10 (DPL=0 0x00000000-0x000fffff)

push 0x202 (new eflags w/ IF=1 IOPL=0)
push 0x8   (new cs but unchanged)
push "proc" (new eip)

now once inside "proc" all the registers are as they should be:
cs = 0x8
ds and ss = 0x10

the only problem is that all hardware interrupts are still disabled.  and
it's not my interrupt controller configuration.  i only have the problem
when i run this code.

i've ran it through the bochs debugger several times with no clue as to
what's going on.  i get the same behavior when in run the code in the
emulator and on the hardware.  additionally, when i do a "hlt" in "proc"
even the bochs debugger says "WARNING: HLT instruction with IF=0!".

i'm very boggled by this.  any help is appreciated.


Re: Very Strange Behavior (iret on x86)

when i enter the new "task", sti does not seem to work.  i still get
"WARNING: HLT instruction with IF=0!" at hlt when i single step with the
boch debugger.


Quoted text here. Click to load it

Re: Very Strange Behavior (iret on x86)
Quoted text here. Click to load it

Pretty strange.

I tried this on one of our embedded controllers running dos and debug:

mov     ax,202
push    ax
mov     ax,cs
push    ax
mov     ax,200
push    ax

int    3


The program broke at 200.  The register dump showed
interrupts enabled and a look at 40:6C showed the
timer tick incrementing.  Note that the bios console
routines will reenable interrupts as soon as they
are called so I can't fully reproduce your problem.

Running the test with the flags set to 2 instead
of 202 gives a register dump of interrupt disabled,
yet they do get reenabled by the console I/O.

I'd be curious as to what you find.

Site Timeline