[Prev][Next][Index][Thread]
Re: Priviledge switch with 'iret'
> I have four segments: KCS, KDS, UCS and UDS. K* have DPL 0, U* has DPL 3.
> When I tries to make an far iret from K* segments to U* segments it
> doesn't make a priviledge switch -> it doesnt pop the UESP and SS from the
> stack. Why's that?
IRET behaves in so many different ways, depending on how the
TSS and GDT are set up, whether the NT flag is set, etc, that
is is nearly impossible to know what is going on with your case.
However, assuming that it is returning to a CS with a higher-numbered
privledge level, it should pop them (privided NT is cleared),
after it pops eip, cs, and eflags.
You will probably have to restore/set the other registers (especially
the segment registers), but that depends on how you are doing context
switches.
There is information in the programming reference manuals from Intel.
http://www.intel.com/design/pentiumii/manuals/
You can order the 3-volume set by calling 800-548-4725 and
asking for order numbers 243190, 243191, and 243192. They were
free, last time I checked, or you can print out/browse the PDF.
Kevin