[comp.arch] 80386 questions

staffan@log-hb.se (Staffan K-E Eriksson) (05/31/90)

I have a couple of questions I hope someone out in Netland can help me with
answers to.

1) Executing at priv level 0, how do I lower the priviledge to level 3 ?

   The JMP and CALL instructions can only transfer control to a segment
   executing at the same level, and it seems like call gates only can
   transfer control to the same level (and the same stack) or to a level
   with higher priviledge ( changing stack ). There is no stack slot in the 
   TSS for level 3, which indicates that a call gate to a level 3 from a
   higher level doesn't work.

2) By reading the 80386 programmers reference manual it looks like a call
   to a gate could be done by loading the call_gate selector into a segment
   register (say GS), and then issue a call as CALL GS:any_address. The
   loading of a segment register by a call_gate however raises General
   Protection fault. By coding the call as CALL 80h:anyaddress, where 80h is
   the GDT slot for the actual call_gate, I can get the call to work.
   ( B.T.W, I have been unable to get the Intel ASM386 assembler to accept
   either call "gs:addr" or "call 80h:addr", but coding the instructions by
   means of using DD, DW and DB thay can be entered, and indeed disassembles
   correctly on the Intel ICE-386 emulator.)

Hope someone can help.

-- Staffan Eriksson