A minor typo:
...
> Avoiding unaligned accesses
> ===
>
> The easiest way to avoid unaligned access is to use the get_unaligned() and
> put_unaligned() macros provided by the header file.
>
> Going back to an earlier example of code that potentially causes unaligned
A minor typo:
...
Avoiding unaligned accesses
===
The easiest way to avoid unaligned access is to use the get_unaligned() and
put_unaligned() macros provided by the asm/unaligned.h header file.
Going back to an earlier example of code that potentially causes
> void myfunc(u8 *data, u32 value)
> {
> [...]
> value = cpu_to_le32(value);
> put_unaligned(value, data);
> u32 value = get_unaligned(data);
Actually, this is wrong. put_unaligned and get_unaligned use the type of
the "data" pointer,
void myfunc(u8 *data, u32 value)
{
[...]
value = cpu_to_le32(value);
put_unaligned(value, data);
u32 value = get_unaligned(data);
Actually, this is wrong. put_unaligned and get_unaligned use the type of
the data pointer, e.g. on
On Nov 29, 2007 5:15 PM, Daniel Drake <[EMAIL PROTECTED]> wrote:
[...]
> To avoid the unaligned memory access, you would rewrite it as follows:
>
>void myfunc(u8 *data, u32 value)
>{
>[...]
>value = cpu_to_le32(value);
>
On Nov 29 2007 12:04, Kyle McMartin wrote:
>
>For example, if you had 4GB of virtual memory, picture it as an
>array of bytes,
> u8 memory[4096 * (1024 * 1024)];/* 4G bytes */
uint8_t memory[4096UL * 1024 * 1024];
>Aligned accesses would be accessing this array in this manner,
>
On Thu, 29 Nov 2007 16:15:23 + (GMT) Daniel Drake wrote:
> Assuming there aren't too many comments/suggestions on this revision, the
> next version will be submitted for inclusion as
> Documentation/unaligned_memory_access.txt
I just have a few typo/punctuation/grammar fixes. Otherwise it
Hi Daniel,
On Thu, Nov 29, 2007 at 04:15:23PM +, Daniel Drake wrote:
> Unaligned memory accesses occur when you try to read N bytes of data starting
> from an address that is not evenly divisible by N (i.e. addr % N != 0).
> For example, reading 4 bytes of data from address 0x10004 is fine,
New version of the unaligned access document I posted recently. Thanks for
all the feedback, I've learned a lot!
Changes:
- 'in between' spelling fix
- shortened example addresses for readability
- better summarised the common architectural differences in handling
unaligned access under "Why
New version of the unaligned access document I posted recently. Thanks for
all the feedback, I've learned a lot!
Changes:
- 'in between' spelling fix
- shortened example addresses for readability
- better summarised the common architectural differences in handling
unaligned access under Why
Hi Daniel,
On Thu, Nov 29, 2007 at 04:15:23PM +, Daniel Drake wrote:
Unaligned memory accesses occur when you try to read N bytes of data starting
from an address that is not evenly divisible by N (i.e. addr % N != 0).
For example, reading 4 bytes of data from address 0x10004 is fine, but
On Thu, 29 Nov 2007 16:15:23 + (GMT) Daniel Drake wrote:
Assuming there aren't too many comments/suggestions on this revision, the
next version will be submitted for inclusion as
Documentation/unaligned_memory_access.txt
I just have a few typo/punctuation/grammar fixes. Otherwise it
On Nov 29 2007 12:04, Kyle McMartin wrote:
For example, if you had 4GB of virtual memory, picture it as an
array of bytes,
u8 memory[4096 * (1024 * 1024)];/* 4G bytes */
uint8_t memory[4096UL * 1024 * 1024];
Aligned accesses would be accessing this array in this manner,
On Nov 29, 2007 5:15 PM, Daniel Drake [EMAIL PROTECTED] wrote:
[...]
To avoid the unaligned memory access, you would rewrite it as follows:
void myfunc(u8 *data, u32 value)
{
[...]
value = cpu_to_le32(value);
put_unaligned(value,
14 matches
Mail list logo