]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv: Improve port to CHERI.
authorBruno Haible <bruno@clisp.org>
Fri, 10 Nov 2023 01:30:28 +0000 (02:30 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 10 Nov 2023 01:30:28 +0000 (02:30 +0100)
* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Define also on CheriBSD.

ChangeLog
lib/sigsegv.c

index 018f80d973647139d260d255c5fb618a1cd25cde..5c92da54ec27a092cbe7e05cb37657931b8f4c46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2023-11-09  Bruno Haible  <bruno@clisp.org>
 
+       sigsegv: Improve port to CHERI.
+       * lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Define also on CheriBSD.
+
        sigsegv: Port to CHERI.
        * lib/sigsegv.c: Treat __aarch64__ like __arm64__.
        (SIGSEGV_FOR_ALL_SIGNALS): Treat SIGPROT like SIGSEGV and SIGBUS.
index 5f9bc08bb9020207972b1f2185dfd423fdaf8dd7..c683c03ac0a796548c09b4b1a08179483c58822d 100644 (file)
@@ -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 */