cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/04/16:27:25

Date: Sat, 4 Oct 1997 13:25:02 -0700 (PDT)
Message-Id: <199710042025.NAA27131@adit.ap.net>
Mime-Version: 1.0
To: eggbrains AT aol DOT com (Egg brains), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: set_descriptor 8 byte buffer (long)

At 10:42  10/1/1997 GMT, Egg brains wrote:
>Yes, I *have* looked at the help and faq... anyway...
>
>I have been working with get/set discriptor functions a know what *most* of the
> bit's in the 8 byte selector string thing (like the segment limit, base
> address, and granular etc...), but these have eluded me :(
Okay, these are from the "386 Programmer's Reference Manual"
>
>Thank you any and all help :)
>
>- type of what?
> [5] ---- XXXX = type
This indicates what type of segment it is. It's very complicated, but here goes:

Application segment:
 If high bit = 0, it's a data segment:
  bits are 0EWA:
   E = Expand down (set if valid addresses are between segment limit
                    and 0xFFFFFFFF, rather than 0 to segment limit)
   W = Writable (set if can be written to)
   A = Accessed (I think the CPU sets this bit when the segment is touched,
                 the OS might use it to decide what to swap out)

 If high bit = 1, it's an executable segment:
  bits are 1CRA:
   C = Conforming (confusing, but basically means it's code that should be
executed at caller's privelege level rather than its own
                   (see below))
   R = Readable (Set if can be read, for instance it has constants there)
   A = Accessed (see above)

System segment:
It signifies what kind of system segment. There are things like Task Switch
Segments, Call Gates, Interrupt Gates, backwards-compatible 286 system
segments... very complicated and probably not important unless you are
writing an operating system.
   
>- does this have to be application?
> [5] ---X ---- = 0=system, 1=application
Yes, otherwise the type field (see above) takes on all sorts of strange
meanings.
>
>- what type of privileges... 1=reading, 2=writing, 3=reading & writing?
> [5] -XX- ---- = priviledge level
No, it's a numeric privilege level, 0-3. 0 is highest privilege, normally
the OS or DPMI server, and can do anything they want. Lower privileges have
restrictions put on them and normally applications run at level 3.
>
>- i don't have a clue what this is for... segments? what does making the to
> present 
>do compared to having them absent?
> [5] X--- ---- = 0=absent, 1=present
This tells whether the segment is swapped out or not, if virtual memory is
being implemented on a per-segment basis. Most OS's and DPMI servers deal
with virtual memory on a per-page basis, so this isn't normally used.
>- what good is this for? will i ever need it?
> [6] ---X ---- = available for user
I think CWSDPMI might use it for something. It's available for the OS's
purposes.
>- another one of those things i'm completely unaware of it's purpose...
> [6] -X-- ---- = 0=16-bit 1=32-bit (cs only)
IIRC, a 16-bit segment uses 16-bit instructions as the default, and needs an
override for 32-bit instructions. A 32-bit segment is the opposite. IE, the
instructions "mov ax,bx" and "mov eax,ebx" have the same opcodes, but a
prefix byte is added to switch between the two. Which way the switch goes
depends on whether it's a 16- or 32-bit segment. DJGPP uses all 32-bit segments.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019