Related articles |
---|
Supporting byte-addressability on word-addressed hardware lehotsky@tiac.net (1995-06-27) |
Re: Supporting byte-addressability on word-addressed hardware simmons@bnr.ca (steve (s.s.) simmons) (1995-06-28) |
Re: Supporting byte-addressability on word-addressed hardware markt@harlequin.co.uk (1995-07-04) |
Re: Supporting byte-addressability on word-addressed hardware pardo@cs.washington.edu (1995-07-05) |
Re: Supporting byte-addressability on word-addressed hardware bob@tera.com (1995-07-06) |
Re: Supporting byte-addressability on word-addressed hardware mfx@cs.tu-berlin.de (1995-07-06) |
Re: Supporting byte-addressability on word-addressed hardware tl@ae.chalmers.se (1995-07-12) |
[2 later articles] |
Newsgroups: | gnu.gcc.help,comp.compilers |
From: | lehotsky@tiac.net (Alan Lehotsky) |
Keywords: | GCC, question, comment |
Organization: | The Internet Access Company |
Date: | Tue, 27 Jun 1995 14:51:27 GMT |
Status: | RO |
I'm beginning a project to modify a gcc port to a machine that only
support 32-bit word addressed memory. At present, the port treats
ints, shorts and chars as the same size objects.
The "modification" is to add support for byte and short addresses.
Because of the memory layout, we can effectively address all memory
with a 30-bit word address.
So,
1/ All int * and "aligned" objects have a word pointer (which
is exactly a 32-bit word address.
2/ voids, bytes and shorts are addressed by shifting the word-address
and adding in a 2-bit byte offset.
3/ casts from one pointer type to another generate code.
4/ fetch & store thru a pointer generates bitfield extract or
insert operations.
Has anyone done something similar to this? We've already thought of
several gotchas. But I'd be interested in hearing any more you might
think of.
For example...
int * ip;
char * cp;
cp++; /* Both stmts add 1 to the pointer! */
ip++;
...
union nogood { int * ip;
char *cp;} x;
x.ip = &i;
c = *x.cp; /* This does something, probably a SIGSEGV... */
If it matters, the port uses GCC 2.3.3. Has anything been done in a
newer version of GCC to support byte-addressing non-byte-addressable
HW?
Thanks,
Al Lehotsky
======================================================================
Quality Software Management
8 Tucker Ave.
Lexington, MA 02173
lehotsky@tiac.net Voice: (617)862-5418 Fax: (617)674-1096
[In theory this sould work fine, although in practice too many C programs
assume that all pointers have the same format. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.