bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sigsegv: Port to CHERI


From: Bruno Haible
Subject: Re: sigsegv: Port to CHERI
Date: Fri, 10 Nov 2023 02:30:52 +0100

And a small improvement:


2023-11-09  Bruno Haible  <bruno@clisp.org>

        sigsegv: Improve port to CHERI.
        * lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Define also on CheriBSD.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index 5f9bc08bb9..c683c03ac0 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -436,11 +436,15 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 #  define SIGSEGV_FAULT_ADDRESS  sip->si_addr
 #  define SIGSEGV_FAULT_CONTEXT  ((ucontext_t *) ucp)
 
-#  if defined __arm64__ /* 64-bit */
+#  if defined __arm64__ || defined __aarch64__ /* 64-bit */
 
 /* See sys/arm64/include/ucontext.h.  */
 
-#   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) 
ucp)->uc_mcontext.mc_gpregs.gp_sp
+#   if defined __CHERI__
+#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) 
ucp)->uc_mcontext.mc_capregs.cap_sp
+#   else
+#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) 
ucp)->uc_mcontext.mc_gpregs.gp_sp
+#   endif
 
 #  elif defined __arm__ || defined __armhf__ /* 32-bit */
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]