Article View: gnu.gcc.help
Article #42172BIT Fields
From: Paul Repper
Date: Tue, 09 Jan 1996 00:00
Date: Tue, 09 Jan 1996 00:00
39 lines
2094 bytes
2094 bytes
I am having problems using gcc on a SUN SPARC 10 station trying to emmulate
Expanded Memory [EMS] from the PC world. The situation is as follows:
P
|
v
|x[0] x[1] x[2] t[0] t[1] t[2]
|____|____|____|____|____| ...|____|____|____|____| ...|____|____|___
0 1 2 3 4 10 11 12 13 ... 17 ... ...
a. P-> is an address of a 16K byte page.
b. x is a pointer to an array of bytes starting at p
c. t is a pointer to an array of structures that contain 7 bytes
(a two byte integer followed by 3 bit fields (1, 7, and 8 bits
respectively) followed by a two byte integer followed by a one
byte character). Every other t[n] will start on an odd byte address.
d. Bit fields were generated to align with 16-bit word boundaries
within t.
16k byte pages of memory are allocated in which structures will be stored.
While accessing structures within the allocated pages, I receive a
"BUS fault (alignment error)". The fault seems to occur anytime the
structure is aligned on an odd byte. We are also unable to access the
bit fields even if they are aligned on an even address.
There are two situations which we believe contribute to the problems being
experienced:
1. We cannot globally pack structures on 1-byte alignments.
We can pack individual structures i.e.
typedef struct x {...} __attribute__((packed)) X;
but this does not seem to cure the problem either.
2. We cannot access structures or bit-fields aligned on odd- or
even-bytes.
Thanks in advance for any help that can be offered.
Paul Repper
repper@si.com
Technical Details
Message-ID:
<DKxGGD.1w9@esseye.si.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,3ceff2f7df0351a7,start X-Google-Attributes: gid11318c,public From: repper@esseye.si.com (Paul Repper) Subject: BIT Fields Date: 1996/01/09 Message-ID: <DKxGGD.1w9@esseye.si.com> X-Deja-AN: 134699106 distribution: usa organization: Smiths Industries keywords: BIT Field Align newsgroups: gnu.gcc.help summary: Can't access bit-fields