Search Linux Wireless

Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

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

 



From: Jean Tourrilhes <jt@xxxxxxxxxx>
Date: Wed, 5 Dec 2007 13:56:00 -0800

> 	Personally, I was under the impression that in userspace libc
> trap unaligned access and make them work. I mean, this code was tested
> on other 64/32 bit platforms (PPC, AMD-64, PS3) and was working there,
> so this seems to be specific to your platform.

None of those listed platforms trap on unaligned accesses like sparc
does.

> 	In any case, I've modified my code to use a memcpy() instead
> of direct memory access. I'm not 100% sure it will fix it because many
> time memcpy() is optimised away to a direct memory access.

This only works if you hide the underlying types from the compiler,
using something like:

static void copy_object(void *dst, void *src, int len)
{
	memcpy(dst, src, len);
}

And use the copy_object() thing to move unaligned things around.

Otherwise gcc can see the underlying types and assume alignment, and
thus generate the memcpy inline using word sized loads and stores, and
you'll just get the same unaligned access problems.

The fix is to eliminate the unaligned data in the first place.  This
compat fixup stuff really belongs in the kernel.
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux