delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/10/08:24:52

Date: Tue, 10 Jan 1995 12:50:54 EST
From: THE MASKED PROGRAMMER <badcoe AT bsa DOT bristol DOT ac DOT uk>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Cc: badcoe AT bsa DOT bristol DOT ac DOT uk

Hi,
	I originally asked this question on some news groups and got directed
here.  For simplicity I'll just ask show you my original message and you can
ask me for more details if necessary (sorry to those who've seen it multiple
times).  Message was:



Hi,

	Sorry for spreading this message around a bit but I'm uncertain
exactly who would have an answer.

Background:	I want to do fast look-up's from a 256x256 table using djgpp
	inline asm.  (Why ?  I'll tell you if anyone asks.)

	The first way to do this that occured to me was to align the start of
the table with a 65536-byte boundary (so that the last 16 bits are all 0) and
then simply copy the table and offset bytes into the lowest and next-lowest
bytes of a 32-bit register (where the bulk of the address is already in the top
of the register).  (n.b for those who don't know djgpp gives a nice flat address
space so that normally I don't have to consider selectors/segments etc etc)

However:	Whilst djgpp will quite happily accept an _aligned_ (65536)
attribute on the look-up (and when you nm the object file it is found at an
address 0x----0000) this refers to the machines Real-Address-Space and not the
protected mode address space actually used in the executeable.

So:		I looked in the djgpp documentation to find ways of accessing
the machines Real-Address-Space and I found them.  In the form of a set of
preprocessor macro's that define inline-asm to do the job, very nice (note
I won't use these macro's I'll just use them as examples of how it's done).

But:		(and this is the biggy) how do I find out where the look-up is
in the machines Real-Address-Space ?  (If I define a symbol for the linker, it
will only know its position in the PM space used for the data-arena.

I thought that the answer might lie in a djgpp-libc routine (but I didn't find
one).  Then I thought that PM was largely implemented on-chip so there would be
an op-code (but I didn't find one).  Then I thought that the answer must lie in
the descriptor-tables used to describe the memory allocation so I looked in
386intel.doc (a manual) but the answer wasn't obvious (I'll go back there if I
get no answers here).

So how's it done ?  How do I find the real-address of a protected-mode address ?

Thanks in anticipation.

Badders





- Raw text -


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