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

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

 



On Monday 25 September 2006 02:41, william_lei@xxxxxxxxxx wrote:
> 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.

I'm not exactly sure what problem you are facing but if I understand you 
correctly and you have code that simply does misaligned accesses, you would 
be better off fixing the code. The reason is that such unaligned accesses 
would have to be emulated with bytewise access and combining/dissecting the 
values accordingly, which hurts performance (processing and cache). Even when 
run on x86 (where such accesses don't cause bus errors) this would be the 
better choice, because even there these are emulated in hardware and only 
cause hidden performance losses.

Other than that, I would rather filter the output of GCC, i.e. use -S (or what 
it was) to generate assembler code and then replace the lw/sw instructions 
via your $FAVOURITE_TEXTPROCESSING_TOOL in the affected files. Most other 
software isn't that broken and would only suffer from such changes.

Thinking about it, I believe there is also a way (some __attribute__) to tell 
GCC that some pointer is not aligned and it will then output suitable code 
for unaligned accesses. This requires changes to the generated sourcecode 
though, but would be a rather clean solution because it would work on other 
platforms, too.

Just wondering, what middleware are you talking about?

Uli


**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************

Diese E-Mail und jede mit dieser E-Mail versandte Datei ist vertraulich und ausschließlich für die Nutzung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger dieser E-Mail sein, informieren Sie bitte den Absender.  Jeder unbefugte Zugriff oder unbefugte Weiterleitung, die Fertigung einer Kopie oder sonstige in diesem Zusammenhang stehende Handlung ist untersagt.


This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please be so kind to inform the sender. Any other unauthorised access, unauthorised forwarding, copying or other action in this connection at all, is prohibited.
**************************************************************************************



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

  Powered by Linux