Re:A 100LOC C impl of memset, that is faster than glibc's
by nynyny7 on Friday November 12, 2021 @09:59AM
(#29199861)
Yes it is 32 bit code on a 64 bit kernel. I didn't debug what the instruction is that ultimately causes the bus error.
pi@rasppi400:~/memset_benchmark $ uname -a
Linux rasppi400 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux
pi@rasppi400:~/memset_benchmark $
pi@rasppi400:~/memset_benchmark $ file ./bench_memset
./bench_memset: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=ebeb69b6cb9664d78c1256a2c862f3d28f11e15e, with debug_info, not stripped
Re:A 100LOC C impl of memset, that is faster than glibc's
by nynyny7 on Friday November 12, 2021 @02:39PM
(#29203657)
PS: It's STRD, which as far as I understand the Arm Architecture Reference Manual always requires word alignment.
Program received signal SIGBUS, Bus error.
small_memset (n=<optimized out>, c=<optimized out>, s=0x29690)
at /home/pi/memset_benchmark/src/lib.c:33
33 *((uint64_t *)last) = val8;
1: x/i $pc
=> 0x11c8c <local_memset+1560>: strd r0, [r7, #-8]
(gdb) info registers
r0 0x0 0
r1 0x0 0
r2 0x0 0
r3 0x1475 5237
r4 0x5f5e100 100000000
r5 0x11674 71284
r6 0x29690 169616
r7 0x29699 169625
On SPARC you have no choice, align or die!