Lines Matching full:unaligned
2 Unaligned Memory Accesses
15 unaligned accesses, why you need to write code that doesn't cause them,
19 The definition of an unaligned access
22 Unaligned memory accesses occur when you try to read N bytes of data starting
25 reading 4 bytes of data from address 0x10005 would be an unaligned memory
52 Why unaligned access is bad
55 The effects of performing an unaligned memory access vary from architecture
59 - Some architectures are able to perform unaligned memory accesses
61 - Some architectures raise processor exceptions when unaligned accesses
62 happen. The exception handler is able to correct the unaligned access,
64 - Some architectures raise processor exceptions when unaligned accesses
66 unaligned access to be corrected.
67 - Some architectures are not capable of unaligned memory access, but will
71 It should be obvious from the above that if your code causes unaligned
76 Code that does not cause unaligned access
95 not be unreasonable to expect that accessing field2 would cause an unaligned
111 will never cause an unaligned access, because all memory addresses are evenly
136 lead to unaligned accesses when accessing fields that do not satisfy
139 the memory access in a way that does not cause unaligned access. Of course,
145 Code that causes unaligned access
149 that can cause an unaligned memory access. The following function taken
167 In the above function, when the hardware has efficient unaligned access
173 (Hint: it'd be an unaligned access.)
175 Despite the potential unaligned access problems with the above function, it
183 Here is another example of some code that could cause unaligned accesses::
192 This code will cause unaligned accesses every time the data parameter points
195 In summary, the 2 main scenarios where you may run into unaligned access
202 Avoiding unaligned accesses
205 The easiest way to avoid unaligned access is to use the get_unaligned() and
206 put_unaligned() macros provided by the <asm/unaligned.h> header file.
208 Going back to an earlier example of code that potentially causes unaligned
218 To avoid the unaligned memory access, you would rewrite it as follows::
229 memory and you wish to avoid unaligned access, its usage is as follows::
235 aligned memory, using these macros to access unaligned memory can be costly in
240 Due to the byte-wise nature of this operation, unaligned accesses are avoided.
252 here is powerpc which defines NET_IP_ALIGN to 0 because DMA to unaligned
253 addresses can be very expensive and dwarf the cost of unaligned loads.
255 For some ethernet hardware that cannot DMA to unaligned addresses like
258 unnecessary on architectures that can do unaligned accesses, the code can be