Subj : Interrupts
To : Vitus Jensen
From : Lee Aroner
Date : Sat May 26 2001 03:29 am
LA>> Not to niggle the point, but of course OS/2 uses interrupts. Each
LA>> and every one of those API calls is a wrapper around an interrupt
LA>> call.
VJ>> Well, to be exact: OS/2 uses callgates to jump into kernel code.
VJ>> Callbacks are similar to interrupt gates in that
VJ>> they switch priviledge
VJ>> levels and have a predefined entry point into the kernel but they
VJ>> additionally copy bytes from lower to higher level stacks while
VJ>> swichting (byte count defined in the callgate). Something what a
VJ>> interrupt gate won't do.
VJ>> It is a common design of OSses to do this switching via a software
VJ>> interrupt but OS/2 is different.
LA> Ah, but are not those callgates accessed through an interrupt?
LA> It's irrelevant that it is an invalid interrupt, a spade 's a
LA> spade after all...
VJ> It's no INT xx instruction but really a call far. You do a
> *CALL FAR XXXX:0000*.
> The offset doesn't matter (as the callgate defines the
> entry point) but the XXXX (selector) points to an entry in
> the GDT or LDT (LDT should be possible but I've never seen
> a callgate in it in OS/2) which is a callgate (descriptor
> type 4). The descriptor defines the destination
> (selector:offset) and how many words are copied from the
> lower ring stack to the new stack.
VJ> You can examine how this works by installing _Theseus_ on
> your machine. Debug your program using any debugger which
> can display assembler instructions and trace until you find
> a "CALL XXX:0000" instruction, write down the XXXX.
> Now start Theseus and have a look at the GDT. Lookup XXXX
> (ignore bit 0-2), you find a descriptor with /Descriptor
> Priviledge Level/ 3 (because it's callable from a ring 3
> application), some offset and a selector which is probably
> 0168 (perhaps dependent on OS/2 version).
> Lookup 0168 in the GDT, you find the code selector for the
> kernel, ring 0, limit FFFFFFFF.
VJ> I would like to have an Intel or AMD manual about the i386
> because this stuff IMHO is best explained by the processor
> vendor but I have only a bad german short reference. One
> of these days I should "lend" one from the library...
VJ> Bye,
> Vitus
VJ> PS: I'm maintaining an OS for embedded systems where we use
> an interrupt, a structure pointed to by register XWA and a
> software dispatcher. This is probably what you have in
> mind.
Vitus, thanks for the detailed description, and for setting me
straight. I had assumed that OS/2 used the same method of forcing
a processor exception to jump to ring zero as MonopolySoft uses,
apparently I was wrong.
LRA
-- SPEED 2.01 #2720: Between two evils, pick the one you never tried before
--- Maximus/2 3.01
* Origin: Top Hat 2 BBS (1:343/41)