]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv: Add tentative support for Hurd/x86_64.
authorBruno Haible <bruno@clisp.org>
Fri, 12 May 2023 19:28:47 +0000 (21:28 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 12 May 2023 19:33:34 +0000 (21:33 +0200)
Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.

* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

ChangeLog
lib/sigsegv.c

index 169645e055fdb70ada4ce635048ddb0f919052ce..542706f2524ac45b6d1924755ca4a7bd8938bae2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-05-12  Bruno Haible  <bruno@clisp.org>
+
+       sigsegv: Add tentative support for Hurd/x86_64.
+       Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.
+       * lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.
+
 2023-05-12  Paul Eggert  <eggert@cs.ucla.edu>
 
        file-has-acl: port to Fedora 39
index 5e943e4d5d89dfdc587f389cf74898dcccea9e7d..aadba4e060889bd76c0e3e6e08697088fca581f4 100644 (file)
@@ -365,12 +365,26 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 # define SIGSEGV_FAULT_ADDRESS  (unsigned long) code
 # define SIGSEGV_FAULT_CONTEXT  scp
 
-# if defined __i386__
+# if defined __x86_64__
+/* 64 bit registers */
+
+/* scp points to a 'struct sigcontext' (defined in
+   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/x86_64/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
+/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps).  We need
+   to use sc_ursp.  */
+#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
+
+# elif defined __i386__
+/* 32 bit registers */
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
-   The registers of this struct get pushed on the stack through
-   gnumach/i386/i386/locore.S:trapall.  */
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
 /* Both sc_esp and sc_uesp appear to have the same value.
    It appears more reliable to use sc_uesp because it is labelled as
    "old esp, if trapped from user".  */