From 295e89af04c816ebf632672ab23bc5a36994f4f2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Boric Date: Wed, 25 Aug 2021 17:10:08 +0200 Subject: LibC: Fix sigsetjmp on x86_64 Registers were clobbered, offset values into __jmp_buf were wrong... --- Userland/Libraries/LibC/arch/x86_64/setjmp.S | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Userland') diff --git a/Userland/Libraries/LibC/arch/x86_64/setjmp.S b/Userland/Libraries/LibC/arch/x86_64/setjmp.S index 42a2f97764..57e401d2d0 100644 --- a/Userland/Libraries/LibC/arch/x86_64/setjmp.S +++ b/Userland/Libraries/LibC/arch/x86_64/setjmp.S @@ -16,17 +16,20 @@ setjmp: .global sigsetjmp sigsetjmp: - mov %esi, 60(%rdi) // Store val into did_save_signal_mask - movl $0, 64(%rdi) // Clear saved_signal_mask + mov %esi, 64(%rdi) // Store val into did_save_signal_mask + movl $0, 68(%rdi) // Clear saved_signal_mask test %esi, %esi jz .Lsaveregs - mov %rdi, %r12 // Preserve sigjmp_buf argument - mov $0, %rdi // Set argument how + push %rbp // Prepare ABI-compliant call to sigprocmask + mov %rsp, %rbp + push %rdi + lea 68(%rdi), %rdx // Set argument oldset mov $0, %rsi // Set argument set - lea 64(%rdi), %rdx // Set argument oldset + mov $0, %rdi // Set argument how call sigprocmask@plt - mov %r12, %rdi // Restore sigjmp_buf argument + pop %rdi + pop %rbp .Lsaveregs: mov %rbx, (0 * 8)(%rdi) // Save registers -- cgit v1.2.3