URL
https://opencores.org/ocsvn/test_project/test_project/trunk
Subversion Repositories test_project
[/] [test_project/] [trunk/] [linux_sd_driver/] [Documentation/] [arm/] [mem_alignment] - Rev 65
Go to most recent revision | Compare with Previous | Blame | View Log
Too many problems poped up because of unnoticed misaligned memory access inkernel code lately. Therefore the alignment fixup is now unconditionallyconfigured in for SA11x0 based targets. According to Alan Cox, this is abad idea to configure it out, but Russell King has some good reasons fordoing so on some f***ed up ARM architectures like the EBSA110. Howeverthis is not the case on many design I'm aware of, like all SA11x0 basedones.Of course this is a bad idea to rely on the alignment trap to performunaligned memory access in general. If those access are predictable, youare better to use the macros provided by include/asm/unaligned.h. Thealignment trap can fixup misaligned access for the exception cases, but ata high performance cost. It better be rare.Now for user space applications, it is possible to configure the alignmenttrap to SIGBUS any code performing unaligned access (good for debugging badcode), or even fixup the access by software like for kernel code. The latermode isn't recommended for performance reasons (just think about thefloating point emulation that works about the same way). Fix your codeinstead!Please note that randomly changing the behaviour without good thought isreal bad - it changes the behaviour of all unaligned instructions in userspace, and might cause programs to fail unexpectedly.To change the alignment trap behavior, simply echo a number into/proc/sys/debug/alignment. The number is made up from various bits:bit behavior when set--- -----------------0 A user process performing an unaligned memory accesswill cause the kernel to print a message indicatingprocess name, pid, pc, instruction, address, and thefault code.1 The kernel will attempt to fix up the user processperforming the unaligned access. This is of courseslow (think about the floating point emulator) andnot recommended for production use.2 The kernel will send a SIGBUS signal to the user processperforming the unaligned access.Note that not all combinations are supported - only values 0 through 5.(6 and 7 don't make sense).For example, the following will turn on the warnings, but withoutfixing up or sending SIGBUS signals:echo 1 > /proc/sys/debug/alignmentYou can also read the content of the same file to get statisticalinformation on unaligned access occurrences plus the current mode ofoperation for user space code.Nicolas Pitre, Mar 13, 2001. Modified Russell King, Nov 30, 2001.
Go to most recent revision | Compare with Previous | Blame | View Log
