unalligned sparc memory access problem (memcpy vs bcopy)
Hello,
I just fixed net-acct to work on sparc (removed a sigbus and some endianess
problems). I noticed that: tmp_iphdr->saddr access needs to be changed into
a memory copy operation because the values are not alligned. Problem: it
works with bcopy, but memcpy still gets an sigbus:
this works:
bcopy(&(tmp_iphdr->saddr), &tmpsrc, sizeof(tmpsrc));
this will give me sigbus:
memcpy(&tmpsrc, &(tmp_iphdr->saddr), sizeof(tmpsrc));
Is it right, that memcpy is unable to deal with unalligned start address?
This is gcc on autic:
Reading specs from /usr/lib/gcc-lib/sparc-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)
ecki@auric:~/net-acct-0.71$ ldd src/nacctd
libc.so.6 => /lib/libc.so.6 (0x7002c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)
There is nothing in the man page which describes this problem of memcpy, in
fact I found a few postings on the net, and all of them where recommending
to use memcpy to access members of badly alligned ip-header structures.
Greetings
Bernd
--
(OO) -- Bernd_Eckenfels@Wendelinusstrasse39.76646Bruchsal.de --
( .. ) ecki@{inka.de,linux.de,debian.org} http://home.pages.de/~eckes/
o--o *plush* 2048/93600EFD eckes@irc +497257930613 BE5-RIPE
(O____O) When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!
Reply to: