public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Lewin A.R.W. Edwards" <larwe@larwe.com>
To: "Wilson Kwan" <wilson@kinesphere.com>, <ecos-discuss@sources.redhat.com>
Subject: Re: [ECOS] Yet another ARM alignment question
Date: Wed, 25 Apr 2001 05:38:00 -0000	[thread overview]
Message-ID: <4.3.2.7.2.20010425082817.035379c8@mail.larwe.com> (raw)
In-Reply-To: <008101c0cd3b$0e339540$0b02a8c0@obiwan>

Hello Wilson,

>My question is has anyone solved the word and dword alignment problems on
>ARM? Is is any combination of gcc compiler options that will overcome this
>limitation albeit at a performance cost. What about an alignment trap

If you specify -fpack-struct on the gcc command line, gcc will not align 
data items in structures and will generate multiple ldrh/ldrb/strh/strb 
instructions to access the misaligned data items in those structures; is 
that what you're asking? The performance cost of doing this globally is 
_high_ and it's best avoided!

Is this a theoretical question or do you have an actual problem? (Can you 
post a little sample code along with a description of the symptom?) I can't 
see where it would be an issue except in certain structures (e.g. my 
problem I had a while back generating structs to reflect various FAT 
structures). gcc will normally handle pointer arithmetic and dereferencing 
for you without difficulty.

The more efficient way to solve the latter problem is to specify just those 
structures as packed, which is what I'm doing, e.g. :

// Master Boot Record
typedef struct {
         unsigned char fill[0x1be];      // boot code
         PARTENTRY partitions[4];        // partition table
         unsigned char sig_55;           // 55h boot signature
         unsigned char sig_aa;           // AAh boot signature
} __attribute__((packed)) MBR, *PMBR;


=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"... a man who is endowed with real qualities of leadership will be tempted 
to refrain from taking part in political life; because [...] the situation 
does not call for a man who has a capacity for constructive statesmanship 
but rather for a man who is capable of bargaining for the favour of the 
majority. Thus the situation will appeal to small minds and will attract 
them accordingly."

  parent reply	other threads:[~2001-04-25  5:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-24 20:53 Wilson Kwan
2001-04-24 21:03 ` elf
2001-04-25  5:38 ` Lewin A.R.W. Edwards [this message]
2001-04-25  8:10   ` Wilson Kwan
2001-04-25  8:42     ` Lewin A.R.W. Edwards
2001-04-25  8:11 Wilson Kwan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.3.2.7.2.20010425082817.035379c8@mail.larwe.com \
    --to=larwe@larwe.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=wilson@kinesphere.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).