Add __memset_chk assembler for mips32 and mips64.
Change-Id: I365b1f345c695850c30ccb1a9f56f254ce182000
This commit is contained in:
parent
728e0e9b97
commit
29d4b71426
2 changed files with 15 additions and 18 deletions
|
@ -170,11 +170,6 @@
|
||||||
# define R6_CODE
|
# define R6_CODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allow the routine to be named something else if desired. */
|
|
||||||
#ifndef MEMSET_NAME
|
|
||||||
# define MEMSET_NAME memset
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We load/store 64 bits at a time when USE_DOUBLE is true.
|
/* We load/store 64 bits at a time when USE_DOUBLE is true.
|
||||||
The C_ prefix stands for CHUNK and is used to avoid macro name
|
The C_ prefix stands for CHUNK and is used to avoid macro name
|
||||||
conflicts with system header files. */
|
conflicts with system header files. */
|
||||||
|
@ -209,9 +204,19 @@
|
||||||
#define UNITM1(unit) (((unit)*NSIZE)-1)
|
#define UNITM1(unit) (((unit)*NSIZE)-1)
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
LEAF(MEMSET_NAME,0)
|
LEAF(__memset_chk,0)
|
||||||
#else
|
#else
|
||||||
LEAF(MEMSET_NAME)
|
LEAF(__memset_chk)
|
||||||
|
#endif
|
||||||
|
bgtu a2, a3, __memset_chk_fail
|
||||||
|
|
||||||
|
// Fall through to memset...
|
||||||
|
END(__memset_chk)
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
LEAF(memset,0)
|
||||||
|
#else
|
||||||
|
LEAF(memset)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.set nomips16
|
.set nomips16
|
||||||
|
@ -428,9 +433,10 @@ L(leave):
|
||||||
|
|
||||||
.set at
|
.set at
|
||||||
.set reorder
|
.set reorder
|
||||||
END(MEMSET_NAME)
|
END(memset)
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
# ifdef _LIBC
|
# ifdef _LIBC
|
||||||
libc_hidden_builtin_def (MEMSET_NAME)
|
libc_hidden_builtin_def (memset)
|
||||||
|
libc_hidden_builtin_def (__memset_chk)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -153,15 +153,6 @@ void* __memrchr_chk(const void* s, int c, size_t n, size_t actual_size) {
|
||||||
return memrchr(s, c, n);
|
return memrchr(s, c, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__mips__) // TODO: add optimized assembler for mips too, and remove this.
|
|
||||||
// Runtime implementation of __builtin___memset_chk (used directly by compiler, not in headers).
|
|
||||||
extern "C" void* __memset_chk(void* dst, int byte, size_t count, size_t dst_len) {
|
|
||||||
__check_count("memset", "count", count);
|
|
||||||
__check_buffer_access("memset", "write into", count, dst_len);
|
|
||||||
return memset(dst, byte, count);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// memset is performance-critical enough that we have assembler __memset_chk implementations.
|
// memset is performance-critical enough that we have assembler __memset_chk implementations.
|
||||||
// This function is used to give better diagnostics than we can easily do from assembler.
|
// This function is used to give better diagnostics than we can easily do from assembler.
|
||||||
extern "C" void* __memset_chk_fail(void* /*dst*/, int /*byte*/, size_t count, size_t dst_len) {
|
extern "C" void* __memset_chk_fail(void* /*dst*/, int /*byte*/, size_t count, size_t dst_len) {
|
||||||
|
|
Loading…
Reference in a new issue