Re: How to emulate lw/sw instruction by lb/sb instruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 25, 2006 at 08:41:53AM +0800, william_lei@xxxxxxxxxx wrote:

> Dear all
>       Could someone tell me how to modify GCC as titled?because we have met
> problem while porting some middleware,which will generate some lw/sw
> instruction to unaligned address,so I would modify GCC to not generate
> lw/sw instructions for this pieces code.

You can use gcc's __attribute__((packed)) to define a data structure
that does not have any alignment gaps in it.  Gcc will then use unaligned
loads and stores to access this structure.  This however is a kludge, for
best performance you should redefine the data structures your code is
working to avoid such missalignment.

Otoh if the miss-alignment case is rare only then you may actually be
better off by relying on the kernel's handling of this case.

  Ralf


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux