|
|
716654 |
############################################################################
|
|
|
716654 |
## mmglue: midipix architecture- and target-specific bits for musl libc ##
|
|
|
716654 |
## Copyright (C) 2013--2023 SysDeer Technologies, LLC ##
|
|
|
716654 |
## Released under the Standard MIT License; see COPYING.MMGLUE. ##
|
|
|
716654 |
############################################################################
|
|
|
716654 |
|
|
|
be8c40 |
.text
|
|
|
be8c40 |
.globl ___sigsetjmp
|
|
|
be8c40 |
.globl _sigsetjmp
|
|
|
be8c40 |
|
|
|
be8c40 |
.def __sigsetjmp; .scl 2; .type 32; .endef
|
|
|
be8c40 |
.def sigsetjmp; .scl 2; .type 32; .endef
|
|
|
be8c40 |
|
|
|
be8c40 |
___sigsetjmp:
|
|
|
be8c40 |
_sigsetjmp:
|
|
|
be8c40 |
# int sigsetjmp(sigjmp_buf jmp_buf, int save_mask);
|
|
|
be8c40 |
#
|
|
|
be8c40 |
# 8(%esp): save_mask
|
|
|
be8c40 |
# 4(%esp): jmp_buf
|
|
|
be8c40 |
# 0(%esp): return address
|
|
|
be8c40 |
|
|
|
be8c40 |
movl 8(%esp),%edx # edx <-- save_mask
|
|
|
be8c40 |
test %edx,%edx # save signal mask?
|
|
|
be8c40 |
jnz 1f # yes: save mask
|
|
|
be8c40 |
jmp ___setjmp # no: setjmp
|
|
|
be8c40 |
|
|
|
be8c40 |
1:
|
|
|
be8c40 |
# typedef unsigned long __jmp_buf[6];
|
|
|
be8c40 |
#
|
|
|
be8c40 |
# typedef struct __jmp_buf_tag {
|
|
|
be8c40 |
# __jmp_buf __jb;
|
|
|
be8c40 |
# unsigned long __fl;
|
|
|
be8c40 |
# unsigned long __ss[16];
|
|
|
be8c40 |
# }
|
|
|
be8c40 |
#
|
|
|
be8c40 |
|
|
|
be8c40 |
movl 4(%esp),%ecx # ecx <-- jmp_buf
|
|
|
be8c40 |
popl 36(%ecx) # save return address to .__ss[2]
|
|
|
be8c40 |
movl %ebx,40(%ecx) # save ebx (arbitrary choice) to .__ss[3]
|
|
|
be8c40 |
movl %ecx,%ebx # save pointer to __jmp_buf to ebx
|
|
|
be8c40 |
|
|
|
be8c40 |
call ___setjmp
|
|
|
be8c40 |
|
|
|
be8c40 |
pushl 36(%ebx) # push previously saved return address
|
|
|
be8c40 |
movl %ebx,4(%esp) # save pointer to __jmp_buf to 4(%esp) (arg 0)
|
|
|
be8c40 |
movl %eax,8(%esp) # save setjmp return value to 8(%esp) (arg 1)
|
|
|
be8c40 |
movl 40(%ebx),%ebx # restore ebx from .__ss[3]
|
|
|
be8c40 |
|
|
|
be8c40 |
|
|
|
be8c40 |
jmp ___sigsetjmp_tail # defer to __sigsetjmp_tail
|
|
|
be8c40 |
|
|
|
be8c40 |
|
|
|
be8c40 |
.section .got$sigsetjmp,"r"
|
|
|
be8c40 |
.global __imp__sigsetjmp
|
|
|
be8c40 |
__imp__sigsetjmp:
|
|
|
be8c40 |
.long _sigsetjmp
|
|
|
be8c40 |
.linkonce discard
|