Hi, While trying to understand the patch submitted at https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00048.html I'm looking at three files:
* gnumach/x86_64/locore.S lines 512..519 ENTRY(alltraps) pusha /* save the general registers */ trap_push_segs: movq %ds,%rax /* and the segment registers */ pushq %rax movq %es,%rax /* and the segment registers */ pushq %rax PUSH_FSGS By the definition of 'pusha' (line 42), this produces on the stack the values of the registers unused unused es ds r15 r14 r13 r12 r11 r10 r9 r8 rdi rsi rbp unused rbx rdx rcx rax * glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h lines 57..79 * glibc/sysdeps/mach/hurd/x86/trampoline.c lines 239..247. This code copies the values from the stack into a 'struct sigcontext'. But here the order of the registers is gs fs es ds r8 r9 r10 r11 r12 r13 r14 r15 rdi rsi rbp unused rbx rdx rcx rax This makes no sense to me. Either the fields of struct sigcontext should be renamed sc_r8 <--> sc_r15 sc_r9 <--> sc_r14 sc_r10 <--> sc_r13 sc_r11 <--> sc_r12 Or the pusha macro should be changed to #define pusha pushq %rax ; pushq %rcx ; pushq %rdx ; pushq %rbx ; subq $8,%rsp ; pushq %rbp ; pushq %rsi ; pushq %rdi ; pushq %r15 ; pushq %r14 ; pushq %r13 ; pushq %r12 ; pushq %r11 ; pushq %r10 ; pushq %r9 ; pushq %r8 and the popa macro accordingly. Bruno