From d7c25806c0b40c096bbb2ea3cc36d2e0491ec7a5 Mon Sep 17 00:00:00 2001 From: zhudacai 00228490 Date: Sat, 31 Aug 2019 07:47:11 +0000 Subject: [PATCH 1/2] src/debug.c do not support aarch64 dump utcontext, so add the context of aarch64. The content comes from the definition of the sigcontext and tested on my aarch64 server. sigcontext defined at the linux kernel code: arch/arm64/include/uapi/asm/sigcontext.h --- src/debug.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/debug.c b/src/debug.c index 1f1157d4a..595e45f72 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1110,6 +1110,33 @@ void logRegisters(ucontext_t *uc) { (unsigned long) uc->uc_mcontext.mc_cs ); logStackContent((void**)uc->uc_mcontext.mc_rsp); +#elif defined(__aarch64__) /* Linux AArch64 */ + serverLog(LL_WARNING, + "\n" + "X18:%016lx X19:%016lx\nX20:%016lx X21:%016lx\n" + "X22:%016lx X23:%016lx\nX24:%016lx X25:%016lx\n" + "X26:%016lx X27:%016lx\nX28:%016lx X29:%016lx\n" + "X30:%016lx\n" + "pc:%016lx sp:%016lx\npstate:%016lx fault_address:%016lx\n", + (unsigned long) uc->uc_mcontext.regs[18], + (unsigned long) uc->uc_mcontext.regs[19], + (unsigned long) uc->uc_mcontext.regs[20], + (unsigned long) uc->uc_mcontext.regs[21], + (unsigned long) uc->uc_mcontext.regs[22], + (unsigned long) uc->uc_mcontext.regs[23], + (unsigned long) uc->uc_mcontext.regs[24], + (unsigned long) uc->uc_mcontext.regs[25], + (unsigned long) uc->uc_mcontext.regs[26], + (unsigned long) uc->uc_mcontext.regs[27], + (unsigned long) uc->uc_mcontext.regs[28], + (unsigned long) uc->uc_mcontext.regs[29], + (unsigned long) uc->uc_mcontext.regs[30], + (unsigned long) uc->uc_mcontext.pc, + (unsigned long) uc->uc_mcontext.sp, + (unsigned long) uc->uc_mcontext.pstate, + (unsigned long) uc->uc_mcontext.fault_address + ); + logStackContent((void**)uc->uc_mcontext.sp); #else serverLog(LL_WARNING, " Dumping of registers not supported for this OS/arch"); From 66a5c1cd7e557187bf3a1913e836d0c9be8adbb7 Mon Sep 17 00:00:00 2001 From: zhudacai 00228490 Date: Wed, 4 Sep 2019 12:14:25 +0000 Subject: [PATCH 2/2] The aarch64 architecture is support normal memory unaligned accesses, so add the UNALIGNED_LE_CPU to the aarch64 . --- src/siphash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/siphash.c b/src/siphash.c index 6b9419031..357741132 100644 --- a/src/siphash.c +++ b/src/siphash.c @@ -58,7 +58,8 @@ int siptlw(int c) { /* Test of the CPU is Little Endian and supports not aligned accesses. * Two interesting conditions to speedup the function that happen to be * in most of x86 servers. */ -#if defined(__X86_64__) || defined(__x86_64__) || defined (__i386__) +#if defined(__X86_64__) || defined(__x86_64__) || defined (__i386__) \ + || defined (__aarch64__) || defined (__arm64__) #define UNALIGNED_LE_CPU #endif