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>
1 parent 5849fbf commit 32e8842c4005b38b643bc1215d0f1dfb9e288613
@Andrey Smirnov Andrey Smirnov authored on 7 Jun 2018
Sascha Hauer committed on 11 Jun 2018
Showing 7 changed files
View
arch/arm/Kconfig
View
arch/arm/lib64/Makefile
View
arch/arm/lib64/memcpy.S
View
arch/arm/lib64/memset.S
View
arch/arm/lib64/string.c 0 → 100644
View
include/string.h
View
lib/string.c