From 66b804e22d6b78416acf3d29fadfd3cf691ebc45 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 24 Oct 2015 20:49:52 -0400 Subject: sigsetjmp: nt64: initial implementation. --- src/signal/nt64/sigsetjmp.s | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/signal/nt64/sigsetjmp.s (limited to 'src/signal/nt64') diff --git a/src/signal/nt64/sigsetjmp.s b/src/signal/nt64/sigsetjmp.s new file mode 100644 index 0000000..77ce4f6 --- /dev/null +++ b/src/signal/nt64/sigsetjmp.s @@ -0,0 +1,43 @@ +.text +.globl __sigsetjmp +.globl sigsetjmp + +.def __sigsetjmp; .scl 2; .type 32; .endef +.def sigsetjmp; .scl 2; .type 32; .endef + +__sigsetjmp: +sigsetjmp: + test %rdx,%rdx # save signal mask? + jnz 1f # yes: save mask + jmp setjmp # no: setjmp + +1: + # typedef unsigned long __jmp_buf[10]; + # + # typedef struct __jmp_buf_tag { + # __jmp_buf __jb; + # unsigned long __fl; + # unsigned long __ss[16]; + # } + # + + popq 0x68(%rcx) # save return address to .__ss[2] + movq %rbx,0x70(%rcx) # save rbx (arbitrary choice) to .__ss[3] + movq %rcx,%rbx # save pointer to __jmp_buf to rbx + + call __setjmp + + pushq 0x68(%rbx) # push previously saved return address + movq %rbx,%rcx # save pointer to __jmp_buf to rcx (arg 0) + movl %eax,%edx # save setjmp return value to rdx (arg 1) + movq 0x70(%rcx),%rbx # restore rbx from .__ss[3] + + + jmp __sigsetjmp_tail # defer to __sigsetjmp_tail + + + .section .got$sigsetjmp,"r" + .global __imp_sigsetjmp +__imp_sigsetjmp: + .quad sigsetjmp + .linkonce discard -- cgit v1.2.3