Monday, February 8, 2010

How to Handle Unaligned Memory Accesses

The stock MIPS Linux kernel 2.6 code (32-bit MIPS) contains at least 4 files which uses unaligned memory access instructions (lwr, lwl, swr, swl), namely:

arch/mips/kernel/unaligned.c
arch/mips/lib/memcpy-inatomic.S
arch/mips/lib/memcpy.S
arch/mips/lib-32/memset.S

Lexra CPU core used in RTL8186 SoC doesn't support the unaligned memory access instructions. Therefore, to cope with it, kernel code containing those instructions must be replaced with byte-wise operations, i.e. replacing the unaligned memory access instructions with repeated single-byte operations.

No comments:

Post a Comment