ts-7000
[Top] [All Lists]

[ts-7000] Re: memcpy() and alignment

To:
Subject: [ts-7000] Re: memcpy() and alignment
From: "chaisc97" <>
Date: Wed, 03 Oct 2007 17:05:40 -0000
--- In  "xelaco" <> wrote:
>
> Hi,
> 
> I have some old and very nasty piece of code that uses unaligned
> structures (network and IPC structures packed inside buffers) and I
> have been porting it to ARM on the TS-7260. I'm wondering if anyone
> has had any issues copying to and from unaligned addresses using
> memcpy(). I have not experienced with this enough yet, but I thought I
> would comment on this in case anyone can provide insight. So far I
> _think_ I have the following (need to double-check):
> 
> * When gcc inserts a call to memcpy(), everything works wonderfully.
> * When gcc decides it wants to inline its ARM assembly-optimized
> version of memcpy(), the result is as if I called memcpy() with a
> source address aligned to an int (haven't played with unaligned dest
yet):
> 
> memcpy(dest, src & ~3, n);
> 
> It's as if I started the copy from an aligned address and therefore I
> get unwanted garbage on dest before the actual data I need. Replacing
> the call with my own copying in pure C just works, and so does the
> real memcpy().
> 
> Has anyone else noticed this? I will have a look to the actual
> assembly gcc generates, maybe it assumes both args are aligned.
> 
> Running Debian Etch with a fairly recent 2.6 kernel, gcc 4.1.2.
> 
> Alex
>
i have the same problem, when i try to copy some data from
mem(0x20200000), some time i get the correct value some times i get
the wrong one, does anyone has any idea?



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU