Mail Archives: djgpp/1996/01/30/10:42:19
pausch AT electra DOT saaf DOT se (Paul Schlyter) wrote:
>In article <4e74he$976 AT news DOT manawatu DOT gen DOT nz>,
>> What is a based pointer?
>
>It's Microsoft's way of declaring a C near pointer so that it uses
>some other segment register than DS. Usually SS is used instead.
>
>This really only applies to segmented 16-bit code. Since DJGPP
>uses a 32-bit "flat" memory model, where all segment registers are
>equal (with the possible exception of CS): all pointers are "near"
>and "far" pointers does not exist. They're not needed since 32-bit
>addresses can cover all of addressable memory.
>
>Thus, the concept of a "based pointer" is meaningless in DJGPP as
>well as in any other environment using the "flat" memory model.
Well that is not entirely true. The memory space of the program is one
big flat segment, but other programs (processes etc.) will be residing
in different segments. The best example of needing far-pointers is
trying to access dos memory. You can use the functions in sys/farptr.h
or a little more dangerous is using sys/nearptr.h.
>(in principle 32-bit code could be segmented too, but no environment
>in use today uses 32-bit segmented code. The "flat" memory model
>seems to have been universally accepted for 32-bit code on the x86).
These days the segments are used to seperate the processes, it means
there is no need for relocation data in the executable, and that the
code can be shifted without any changes needed. So segments are still
very much in use.
Malcolm
- Raw text -