copy extended memory.

Peter Stuge stuge-linuxbios at cdy.org
Mon Oct 28 18:28:00 CET 2002


On Sun, Oct 27, 2002 at 07:05:58PM -0500, Adam Sulmicki wrote:
> you can find nice example how to use it in linux sources
> (some file in linux/arch/i386/boot, head.S IIRC)

Using it is the easy part, I had to implement it.  Fortunately that project
got dropped before I tore all my hair off.  :)


> For example the description in Phoenix's user manual is just plain wrong
> :/ It will describe an single GDT entry, but it will not say how many
> entries and what is meaning of each entry.
> 
> 	http://www.phoenix.com/resources/userman.pdf

Some resource, huh?  Good thing we have RB.


> > And don't forget the 32-bit opcodes when in pmode.
> 
> Isn't that dependent on D/B flag in appropriate GDT entry?  So if I set 16
> b it D/B flag in the CS entry, I still should be able to use 16 bit code,
> even if in 32 bit mode.

Yes!  This is, of course, absolutely correct.  I just wasn't familiar enough
with the descriptor flags.  Now I actually know enough to make my own DOS
extender.  :)  (Well, probably not, but a little closer.)

I haven't found a complete descriptor description so I'll post an attempt
here.  It's basically just different parts of 386intel.txt put together.
(That file sure isn't very well structured.  Much like the architecture
itself I guess.  :)


DESC       STRUC
    lim_0_15    DW  0              ; limit bits (0..15)
    bas_0_15    DW  0              ; base bits (0..15)
    bas_16_23   DB  0              ; base bits (16..23)
    access      DB  0              ; access byte
    ; access := P DPL RES1 TYPE [A]
    ; P:1 Segment present (eg. for swapping to disk)
    ; DPL:2 Descriptor Privilege Level
    ; RES1:1 Means this is an application (as opposed to system) segment
#if RES1.value
    ; TYPE:3 Indicates what kind of segment this is and the intended use
    ; A:1 Accessed bit, set by CPU when the segment is used
#else
    ; TYPE:4 Indicates what kind of segment this is and the intended use
#endif
    gran        DB  0              ; granularity byte
    ; gran := G (B|D|X) O AVL lim_16_19
    ; G:1 0=>byte granularity, 1=>page(4k) granularity
#if RES1.value
#if IS_DATA_SEGMENT
    ; B:1 Big segment (affects segment bounds)
#else
    ; D:1 Default, determines default operand-size for code segments
#endif /* IS_DATA_SEGMENT */
#else
    ; X:1 unknown, unused?
#endif /* RES1.value */
    ; O:1 unknown, used for protection?
    ; AVL:1 Available for use by systems programmers
    ; lim_16_19:4 limit bits (16..19)
    bas_24_31   DB  0              ; base bits (24..31)
DESC       ENDS


//Peter



More information about the coreboot mailing list