Date: Thu, 30 Sep 1999 13:41:22 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Fokkema DOT DBRA AT delorie DOT com, 1043730 cc: djgpp AT delorie DOT com Subject: Re: problem with far pointers In-Reply-To: <7sv0qu$4pm@cs.vu.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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 ). 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.