www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/30/10:42:19

Xref: news2.mv.net comp.os.msdos.djgpp:650
From: malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: aligment / based pointers
Date: Sun, 28 Jan 1996 22:21:14 GMT
Organization: Grafik Software
Lines: 36
Message-ID: <4egp3g$a3q@news.manawatu.gen.nz>
References: <960118222321_100662 DOT 3563_EHV63-1 AT CompuServe DOT COM> <4e74he$976 AT news DOT manawatu DOT gen DOT nz> <4ee70i$ite AT electra DOT saaf DOT se>
Reply-To: malcolm AT manawatu DOT gen DOT nz
NNTP-Posting-Host: malcolm.manawatu.gen.nz
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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