Skip to contentSkip to conversation

Memcpy() on MPC5200B

DISCUSSION Wright, Chuck 2 participants 2 messages Sep 22, 2008 – Sep 23, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

I've found a case where memcpy() is failing on copies longer that 4 bytes.=20

Closer investigation found that the destination pointer is not pointing to a word aligned address.

The problem comes from the JFFS2 driver where there is a struct that is being used to create the destination pointer for the memcpy() function.

If I insert my own padding into the struct, my memcpy() problems go away!
I'm concerned that this problem may be lurking in other areas of code. (I get no warnings during compile)

On the MPC5200B processor, is that the assumed behavior for an unaligned memcpy()??
Is there a gcc option to force word alignment??

I'm using a MontaVista supplied kernel and compiler. (not my choice!)=20 Unfortunately, six weeks later, MontaVista is still confused.

Thanks for any help you can offer,

Chuck Wright

#2 lore raw
Quoted 8 lines · Chuck

I've found a case where memcpy() is failing on copies longer that 4 bytes.

Closer investigation found that the destination pointer is not pointing to a word aligned address.

The problem comes from the JFFS2 driver where there is a struct that is being used to create the destination pointer for the memcpy() function.

There is a thread about this problem here:
http://thread.gmane.org/gmane.linux.drivers.mtd/21521

I don't believe it has been resolved yet.

Quoted 23 lines

If I insert my own padding into the struct, my memcpy() problems go away!
I'm concerned that this problem may be lurking in other areas of code. (I get no warnings during compile)

On the MPC5200B processor, is that the assumed behavior for an unaligned memcpy()??
Is there a gcc option to force word alignment??

I'm using a MontaVista supplied kernel and compiler. (not my choice!) Unfortunately, six weeks later, MontaVista is still confused.

Thanks for any help you can offer,

Chuck Wright

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 2 lines
Jon Smirl
[email protected]