[fpc-pascal](no subject)

Thomas Schatzl tom_at_work at yline.com
Sun Dec 3 12:03:11 CET 2000


Hello,

> So in 32 bit architecture a pointer is only a 32 bit offset, isn't it?
> Adressed from 0 to XXXX Bytes...
>
> But how does the OS and the CPU handle the "protected" memory blocks? In
16
> bit with selectors, the selectors were a value to an table that stored
data
> of the blocks, how they were protected, if its a code segment or a data
> segment, etc. etc.
> how is this done in 32 bit?

It is the same here. Basically the only thing that changed is that the
length entry of this block can now be 20 bits. (This allows memory block
lengths of 1 MB with byte granularity). To get up to 4 GB addressable memory
space there's an additional special bit in the descriptor (= table data
block where selector points to) which toggles between byte and 4kb
granularity. With that enabled you can get full 32 bit sized memory chunks.
(2^20 * 2^12 = 2^32).

A 'real' pointer in DPMI protected mode needs 48 bits to a distinctive
memory location then - 16 bits selector value (using the segment registers)
and a 32 bit offset into it. Also called 'far pointer' btw. In application
programming you have rarely need for changing the memory selector; so a
standard pointer used is reduced to the offset into the default (= ds)
selector, always assuming ds as the selector part of the fully qualified 48
bit address.

Note that DPMI is not a 'flat' environment, e.g. the default segment
registers don't point to a selector which describes _all_ memory beginning
from physical memory address 0.

You could describe it in this way (based on your example):

So in 32 bit architecture a pointer is only a 32 bit offset, isn't it?
Adressed from 0 to XXXX Bytes beginning from the descriptors' base address
for the descriptors' length bytes...
Every access beyond automatically gives a SIGSEGV (abbreviation for SIGnal
SEGment Violation I think) - just like it does in '286 protected mode. (RTE
216, GPF or any other abbreviation you prefer)

I hope this clears that issue for you
    Thomas

> Or have I misunderstood something?
>
> Tobi
>
> ----- Original Message -----
> From: Kuba Ober <winnie at hoth.amu.edu.pl>
> To: <fpc-pascal at deadlock.et.tudelft.nl>
> Sent: Saturday, December 02, 2000 10:59 PM
> Subject: Re: [fpc-pascal](no subject)
>
>
> >
> > The pointer is offset and selector taken together. An offset by itself
> means
> > nothing, a selector by itself means nothing as well. A selector is used
to
> > give the offset a meaning, and only together shall they be used, for
> there's
> > no use when they are 'part, only sigsegv :-)
> >
> > Take that l-i-t-e-r-a-l-l-y if you don't otherwise want to delve into
i386
> > specs. Selectors are 16 bit only on all architectures which use
selectors,
> as
> > there is hardly need for more than 65535 selectors. Offsets are 32 bit
on
> 32
> > bit machines.
> >
> > Kuba






More information about the fpc-pascal mailing list