diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-01-29 17:07:28 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-03-26 11:03:06 +0000 |
commit | c076a0bc698c537f72c33bad2925f4e3da59d23c (patch) | |
tree | 188e36bfaa2c51ca50df2f1ef882a8fd57a61780 /sysdeps/aarch64 | |
parent | 42bac88a211a7fac9dd1bfe7d1e45e59ac50c24f (diff) | |
download | glibc-c076a0bc698c537f72c33bad2925f4e3da59d23c.zip glibc-c076a0bc698c537f72c33bad2925f4e3da59d23c.tar.gz glibc-c076a0bc698c537f72c33bad2925f4e3da59d23c.tar.bz2 |
malloc: Only support zeroing and not arbitrary memset with mtag
The memset api is suboptimal and does not provide much benefit. Memory
tagging only needs a zeroing memset (and only for memory that's sized
and aligned to multiples of the tag granule), so change the internal
api and the target hooks accordingly. This is to simplify the
implementation of the target hook.
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'sysdeps/aarch64')
-rw-r--r-- | sysdeps/aarch64/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/aarch64/__mtag_tag_zero_region.S (renamed from sysdeps/aarch64/__mtag_memset_tag.S) | 18 | ||||
-rw-r--r-- | sysdeps/aarch64/libc-mtag.h | 4 |
3 files changed, 10 insertions, 14 deletions
diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index d3ab37a..259070c 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -41,7 +41,7 @@ endif ifeq ($(subdir),misc) sysdep_headers += sys/ifunc.h sysdep_routines += __mtag_address_get_tag \ - __mtag_memset_tag \ + __mtag_tag_zero_region \ __mtag_new_tag \ __mtag_tag_region diff --git a/sysdeps/aarch64/__mtag_memset_tag.S b/sysdeps/aarch64/__mtag_tag_zero_region.S index 3c20288..74d398b 100644 --- a/sysdeps/aarch64/__mtag_memset_tag.S +++ b/sysdeps/aarch64/__mtag_tag_zero_region.S @@ -20,9 +20,6 @@ #ifdef USE_MTAG -/* Use the same register names and assignments as memset. */ -#include "memset-reg.h" - .arch armv8.5-a .arch_extension memtag @@ -31,16 +28,15 @@ /* FIXME: This is a minimal implementation. We could do much better than this for large values of COUNT. */ -ENTRY(__libc_mtag_memset_with_tag) +#define dstin x0 +#define count x1 +#define dst x2 - and valw, valw, 255 - orr valw, valw, valw, lsl 8 - orr valw, valw, valw, lsl 16 - orr val, val, val, lsl 32 - mov dst, dstin +ENTRY(__libc_mtag_tag_zero_region) + mov dst, dstin L(loop): - stgp val, val, [dst], #16 + stzg dst, [dst], #16 subs count, count, 16 bne L(loop) #if 0 @@ -49,5 +45,5 @@ L(loop): ldg dstin, [dstin] // Recover the tag created (might be untagged). #endif ret -END (__libc_mtag_memset_with_tag) +END (__libc_mtag_tag_zero_region) #endif /* USE_MTAG */ diff --git a/sysdeps/aarch64/libc-mtag.h b/sysdeps/aarch64/libc-mtag.h index 979cbb7..f58402c 100644 --- a/sysdeps/aarch64/libc-mtag.h +++ b/sysdeps/aarch64/libc-mtag.h @@ -39,8 +39,8 @@ void *__libc_mtag_tag_region (const void *, size_t) */ void *__libc_mtag_tag_region (void *, size_t); -/* Optimized equivalent to __libc_mtag_tag_region followed by memset. */ -void *__libc_mtag_memset_with_tag (void *, int, size_t); +/* Optimized equivalent to __libc_mtag_tag_region followed by memset to 0. */ +void *__libc_mtag_tag_zero_region (void *, size_t); /* Convert address P to a pointer that is tagged correctly for that location. |