Re: x86 internals help

H. Peter Anvin (hpa@transmeta.com)
13 Feb 1998 04:48:40 GMT


Followup to: <Pine.SUN.3.96.980212182953.19487A-100000@amsterdam.lcs.mit.edu>
By author: "C. Scott Ananian" <cananian@lcs.mit.edu>
In newsgroup: linux.dev.kernel

> The APM spec says (regarding calling the 32-bit APM BIOS routines):
> - "The code segment descriptors must specify protection level 0, and
> the APM BIOS routines must be invoked with CPL=0 so they can execute
> privileged instructions such as port inputs and outputs."
>
> OK, this is an easy one: any kernel code will be running at
> protection level 0, right?

Yes.

> - "The caller must supply a stack large enough for use by the APM BIOS
> and potential interrupt handlers... The APM BIOS 32-bit protected mode
> interface must be called with a 32-bit stack."
>
> I'm *assuming* I don't have to worry about this. Is it even possible
> to change the kernel stack size? [interrupts are disabled before the
> apm routines are called, but I'm not ruling out some silly recursive
> routine in the BIOS.]

What constitutes "large enough"? There should be a figure, otherwise
the spec is broken.

> - "When the APM BIOS routines are called in protected mode, the current
> I/O permission bit map must allow access to the I/O ports the BIOS may
> need to access in the process of performing the selected function."
>
> This goes with the first question. Is there a special I/O port
> permissions map I need to fiddle with, or can I assume that kernel
> code will be running with all permissions wide open?

This is a nonsense requirement, which worries me. If CPL <= IOPL the
I/O permissions bitmap is never consulted, and given the CPL 0
requirement, CPL is always <= IOPL, it should make no difference at all.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu