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 /include | |
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 'include')
-rw-r--r-- | include/string.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h index 0c557d6f15..6ceb33224e 100644 --- a/include/string.h +++ b/include/string.h @@ -6,4 +6,7 @@ void *memdup(const void *, size_t); int strtobool(const char *str, int *val); +void *__default_memset(void *, int, __kernel_size_t); +void *__default_memcpy(void * dest,const void *src,size_t count); + #endif /* __STRING_H */ |