In the Microsoft assembler MASM (or Borland's TASM), I can create a
"virtual" segment (see example below) to specify the complete layout of a
section of memory and to specify exactly what it's addresses are, but no
data is created in the program. This is commonly used with memory-mapped
I/O cards where the segment describes the size and location of all of the
registers and any RAM on the card. An assembly-module with this segment can
be linked with normal .ASM and .C modules in which public symbols declared
in the "virtual" segment appear as external addresses in the code.
I know that I can construct a .C module with a list of explicit declarations
of pointers to the known addresses which can then be dereferenced in code,
but the "virtual" segment technique is more efficient because it creates
addresses which the linker resolves and saves dereferencing time for every
access to the data in these structures.
Can I do this in an assembler which is compatible with gcc? If so, which
one(s)?
(Does such a capability exist within gcc itself?
------------------------------------------------------------------
EXAMPLE
PUBLIC ByteData, WordDatum
IOSpace SEGMENT AT 0xD000
ORG 0x1234
ByteData LABEL BYTE
DB 24 DUP (?)
ORG 0xBEEF
WordDatum LABEL WORD
DW 3
IOSpace ENDS
when I link this module with normal .C code which has declared
extern char ASDF[];
extern short QWERTY
when I reference QWERTY, the linker will insert 0xD000:0xBEEF into the
executable with no pointer-dereferencing; similarly, ByteData appears at
0xD000:0x1234.
------------------------------------------------------------------
Norm Dresner
Fellow Systems Engineer
Radar Systems Engineering Department
Electronic Systems and Sensors Segment
Northrop Grumman Corporation
MS 520
Box 746
Baltimore MD 21203
Voice: (410) 993 - 2096 Mornings; all-day voice-mail
(410) 969 - 8068 Afternoons with answering machine
FAX: (410) 993 - 8084 On-site
(410) 969 - 8068 Afternoons; call first to arrange
E-Mail:Mornings: [EMAIL PROTECTED]
Afternoons: [EMAIL PROTECTED]
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/