delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/30/13:58:40

Date: Thu, 30 Sep 1999 13:41:22 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Fokkema DOT DBRA AT delorie DOT com, 1043730 <dfokkema AT cs DOT vu DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: problem with far pointers
In-Reply-To: <7sv0qu$4pm@cs.vu.nl>
Message-ID: <Pine.SUN.3.91.990930133818.20873M-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 30 Sep 1999 Fokkema DOT DBRA AT delorie DOT com wrote:

> Because I'm writing my own OS (like the rest of the world) I don't want to use
> functions from the c libraries, if possible. Certainly not functions that
> check read and write privileges for me, as I believe the djgpp 'far pointer'
> functions do.

The _far* functions are implemented as inline assembly code, so you could 
simply look at them (they are in the header file <sys/farptr.h>).  You 
will see that all they do is load the FS register with the selector you 
pass, and the reference the offset in the segment described by the 
selector.  That's two assembly instructions, no provileges and no other 
strings attached.

> But by looking through the documentation, as I was suggested,
> I managed to find out how inline assembly and multiline macros are written
> in djgpp. So I wrote some macros, which do the job for me in plain assembly.
> Currently, I need 6 macros for b,w,l read and b,w,l write. Pointers and
> constants are both accepted as offset (using the alternative constraints)
> and constants and variables are both accepted as values. Can someone do it
> with less than 6 macros?

Look at the _far* functions, they do exactly that and I think do it more 
efficiently.

- Raw text -


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