diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-06-07 06:00:55 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-11 08:54:10 +0200 |
commit | 32e8842c4005b38b643bc1215d0f1dfb9e288613 (patch) | |
tree | d1a8eb1306c5e7b92e92371844315299b2715178 /arch/arm/Kconfig | |
parent | 5849fbf6f92899d4aca4ca99b6d4ba486d781ce5 (diff) | |
download | barebox-32e8842c4005b38b643bc1215d0f1dfb9e288613.tar.gz barebox-32e8842c4005b38b643bc1215d0f1dfb9e288613.tar.xz |
ARM: lib64: Make string functions aware of MMU configuration
Optimized version of memset() in memset.S if called as:
memset(foo, 0, size)
will try to explicitly zero out data cache with:
dc zva, dst
which will result in Alignement Exception (DABT) if MMU is not
enabled.
For more info see:
- C4.4.8 "DC ZVA, Data Cache Zero by VA"
- D5.2.8 "The effects of disabling a stage of address translation"
in "ARM Architecture Reference Manual. ARMv8, for ARMv8-A architecture
profile"
In similar vein, using optimized version of memcpy() could lead to a
unaligned 16-byte write (using 'stp'), which is not allowed for
Device-nGnRnE type of memory (see D5.2.8) and would liead to
Alignement Exception.
To fix both problems expose non-optimized and optimzied versions of
the function and created a wrapper to dispatch the call to either one
based on if MMU is enabled or not.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/Kconfig')
-rw-r--r-- | arch/arm/Kconfig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 37cde0c0c5..c6a4cadb32 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -353,6 +353,13 @@ menu "ARM specific settings" config ARM_OPTIMZED_STRING_FUNCTIONS bool "use assembler optimized string functions" + # + # memset() and memcpy() in arm/lib64/mem[set|cpy].S are + # written with assumption of enabled MMU and cache. Depending + # on the inputs in may fail with Alignement exception if used + # without MMU + # + depends on !CPU_V8 || MMU help Say yes here to use assembler optimized memcpy / memset functions. These functions work much faster than the normal versions but |