delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/02/11/13:22:19

Date: Fri, 11 Feb 94 13:13:36 EST
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Help with gcc and EISA cards
Reply-To: babcock AT cfa DOT harvard DOT edu

> I was hoping that somehow gcc could be taught about far pointers so that it
> would do this for us, but again - don't hold your breath.

Here's an idea, not terribly well thought out, for those cases where you
really need the equivalent of a far pointer (such as a frame grabber board
somewhere in the memory space).

1. Get a selector which points at the desired memory.  This, I believe, is a
   standard DPMI function.
2. Load the selector into fs or gs.  I don't think that gcc ever uses these
   (but some of the library routines such as dosmemput may).
3. Write your C code as if you had a pointer to the far memory.
4. Intercept the assembly language before it gets to gas.  Process it to add
   fs or gs overrides whenever the special pointer is used.  I haven't looked
   at enough gcc assembly language to judge whether this could be done easily
   with sed/awk/perl or whether a special routine would need to be written.

Sounds like a kludge, which is why I only suggest it for special cases.  But,
it's basically an automation of the procedure I used to write some text-mode
screen access routines.  The biggest risk would seem to be the assumption
that the segment registers won't get clobbered.

- Raw text -


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