This converts setjmp/longjmp and their sig* versions to use the
sigprocmask syscall directly instead of the obsolete sigblock/sigsetmask
APIs.
No change in the results of the regress/lib/libc/*setjmp* tests.
Ok?
Philip Guenther
Index: setjmp.S
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/arch/amd64/gen/setjmp.S,v
retrieving revision 1.6
diff -u -p -r1.6 setjmp.S
--- setjmp.S 12 May 2016 15:46:03 -0000 1.6
+++ setjmp.S 20 May 2016 08:38:12 -0000
@@ -37,7 +37,7 @@
*/
-#include <machine/asm.h>
+#include "SYS.h"
#include <machine/setjmp.h>
.section .openbsd.randomdata,"aw",@progbits
@@ -59,10 +59,12 @@ __jmpxor:
*/
ENTRY(setjmp)
- pushq %rdi
- xorq %rdi,%rdi
- call _C_LABEL(_libc_sigblock)
- popq %rdi
+ movq %rdi,%r8 /* save jmpbuf addr */
+ movl $1,%edi /* how = SIG_BLOCK */
+ xorl %esi,%esi /* set = empty */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
movq (%rsp),%r11
@@ -91,10 +93,11 @@ ENTRY(longjmp)
movq %rdi,%r12
movl %esi,%r8d
- movq (_JB_SIGMASK * 8)(%rdi),%rdi
- pushq %r8
- call _C_LABEL(_libc_sigsetmask)
- popq %r8
+ movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
+ movl $3,%edi /* how = SIG_SETMASK */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
movq (_JB_RBX * 8)(%r12),%rbx
@@ -112,7 +115,6 @@ ENTRY(longjmp)
movq (_JB_R12 * 8)(%r12),%r12
xorq %rcx,%rcx
- movl %r8d,%eax
testl %eax,%eax
jnz 1f
incl %eax
Index: sigsetjmp.S
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/arch/amd64/gen/sigsetjmp.S,v
retrieving revision 1.6
diff -u -p -r1.6 sigsetjmp.S
--- sigsetjmp.S 12 May 2016 15:46:03 -0000 1.6
+++ sigsetjmp.S 20 May 2016 08:38:12 -0000
@@ -37,7 +37,7 @@
*/
-#include <machine/asm.h>
+#include "SYS.h"
#include <machine/setjmp.h>
.hidden __jmpxor
@@ -57,10 +57,12 @@ ENTRY(sigsetjmp)
testl %esi,%esi
jz 2f
- pushq %rdi
- xorq %rdi,%rdi
- call _C_LABEL(_libc_sigblock)
- popq %rdi
+ movq %rdi,%r8 /* save jmpbuf addr */
+ movl $1,%edi /* how = SIG_BLOCK */
+ xorl %esi,%esi /* set = empty */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
2: movq (%rsp),%r11
@@ -87,13 +89,15 @@ END(sigsetjmp)
ENTRY(siglongjmp)
movq %rdi,%r12
- pushq %rsi
+ movl %esi,%r8d
cmpl $0, (_JB_SIGFLAG * 8)(%rdi)
jz 2f
- movq (_JB_SIGMASK * 8)(%rdi),%rdi
- call _C_LABEL(_libc_sigsetmask)
-2: popq %rax
+ movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
+ movl $3,%edi /* how = SIG_SETMASK */
+ movl $SYS_sigprocmask,%eax
+ syscall
+2: movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
movq (_JB_RBX * 8)(%r12),%rbx