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]

 



On Wed, Nov 21, 2007 at 02:23:52PM +0000, Daniel Drake wrote:
> 	network = ieee80211softmac_get_network_by_bssid_locked(mac, 
> resp->header.addr3);
> 
> addr3 is offset 20 bytes in the struct and is 6 bytes long. Because 20 
> is not evenly divisible by 6 does that make it an unaligned access?
> 

Sort of. An "unaligned" access is one where the referenced address is
not aligned to the size of the data type being accessed. For example,
a 4-byte load must be accessed on 4-byte aligned boundaries:
	0xffff0000 0xffff0004 0xffff0008, and so forth.

Obviously a single byte load is always aligned.

Unaligned accesses are universally bad. On some architectures (x86, ppc)
they will be emulated in hardware at a performance cost. On others
(sparc, parisc, ia64) they will trap, giving you the option of software
emulation (very slow) or sending a SIGBUS. On still others (arm, I
think[1]) they'll "align" in hardware, resulting in loads or stores to
the wrong address.

The Linux networking code is a pretty good example of when to use the
support macros (get|put)_unaligned to do the right thing. For something
like a packed structure accessed in a data stream, you're invariably going
to have to use these.

> Is there any documentation I can read on this topic? In my current 
> uneducated state I'm likely to write further code with these problems...
> 

cheers,
	Kyle

1. Just a guess based on <asm-arm/unaligned.h> providing macros that
actually do something, and the lack of an obvious unaligned trap
handler.
-
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