diff --git a/ape/aarch64.lds b/ape/aarch64.lds index 0a232a2da..48562d2a2 100644 --- a/ape/aarch64.lds +++ b/ape/aarch64.lds @@ -259,6 +259,9 @@ SECTIONS { .debug_ranges 0 : { *(.debug_ranges) } .debug_macro 0 : { *(.debug_macro) } .debug_addr 0 : { *(.debug_addr) } + .debug_names 0 : { *(.debug_names) } + .debug_loclists 0 : { *(.debug_loclists) } + .debug_str_offsets 0 : { *(.debug_str_offsets) } .ARM.attributes 0 : { KEEP(*(.ARM.attributes)) KEEP(*(.gnu.attributes)) } .note.gnu.arm.ident 0 : { KEEP(*(.note.gnu.arm.ident)) } diff --git a/ape/ape.lds b/ape/ape.lds index 155b0aad9..ac82bde00 100644 --- a/ape/ape.lds +++ b/ape/ape.lds @@ -386,6 +386,13 @@ SECTIONS { _tbss_end = .; } :Tls + .eh_frame : { + __eh_frame_start = .; + KEEP(*(.eh_frame)) + *(.eh_frame.*) + __eh_frame_end = .; + } :Ram + .data . : { /*BEGIN: Read/Write Data */ #if SupportsWindows() @@ -426,11 +433,6 @@ SECTIONS { KEEP(*(.dtors)) __fini_array_end = .; - __eh_frame_start = .; - KEEP(*(.eh_frame)) - *(.eh_frame.*) - __eh_frame_end = .; - /*BEGIN: Post-Initialization Read-Only */ . = ALIGN(. != 0 ? __SIZEOF_POINTER__ : 0); KEEP(*(SORT_BY_NAME(.piro.relo.sort.*))) @@ -439,7 +441,6 @@ SECTIONS { KEEP(*(.piro.pad.data)) *(.igot.plt) KEEP(*(.dataepilogue)) - . = ALIGN(. != 0 ? CONSTANT(COMMONPAGESIZE) : 0); /*END: NT FORK COPYING */ _edata = .; @@ -519,6 +520,9 @@ SECTIONS { .debug_rnglists 0 : { *(.debug_rnglists) } .debug_macro 0 : { *(.debug_macro) } .debug_addr 0 : { *(.debug_addr) } + .debug_names 0 : { *(.debug_names) } + .debug_loclists 0 : { *(.debug_loclists) } + .debug_str_offsets 0 : { *(.debug_str_offsets) } .gnu.attributes 0 : { KEEP(*(.gnu.attributes)) } .GCC.command.line 0 : { *(.GCC.command.line) } @@ -582,11 +586,11 @@ ape_rom_memsz = ape_rom_filesz; ape_rom_align = CONSTANT(COMMONPAGESIZE); ape_rom_rva = RVA(ape_rom_vaddr); -ape_ram_vaddr = ADDR(.data); +ape_ram_vaddr = ADDR(.eh_frame); ape_ram_offset = ape_ram_vaddr - __executable_start; -ape_ram_paddr = LOADADDR(.data); -ape_ram_filesz = ADDR(.bss) - ADDR(.data); -ape_ram_memsz = _end - ADDR(.data); +ape_ram_paddr = LOADADDR(.eh_frame); +ape_ram_filesz = ADDR(.bss) - ADDR(.eh_frame); +ape_ram_memsz = _end - ADDR(.eh_frame); ape_ram_align = CONSTANT(COMMONPAGESIZE); ape_ram_rva = RVA(ape_ram_vaddr); diff --git a/libc/calls/getntsyspath.S b/libc/calls/getntsyspath.S index b8f2b65cd..bd8178bd3 100644 --- a/libc/calls/getntsyspath.S +++ b/libc/calls/getntsyspath.S @@ -28,8 +28,8 @@ // @return rdi is rdi+edx .text.startup __getntsyspath: - push %rbp - mov %rsp,%rbp + beg + pro push %rdx movpp %rdi,%rcx # call f=%rax(p1=%rcx,p2=%rdx) sub $40,%rsp @@ -55,6 +55,7 @@ __getntsyspath: jne 2f movb $'/',-1(%rdi) 2: .loop 1b - leave + epi ret + end .endfn __getntsyspath,globl,hidden diff --git a/libc/crt/crt.S b/libc/crt/crt.S index d34bc83b8..74226c641 100644 --- a/libc/crt/crt.S +++ b/libc/crt/crt.S @@ -47,7 +47,14 @@ __oops_win32: // @note ape.S and ape-loader both set RCX to XNU on Darwin // @noreturn _start: -#ifdef __x86_64__ + .cfi_startproc +#if defined(__x86_64__) + .cfi_undefined rip +#elif defined(__aarch64__) + .cfi_undefined x30 +#endif /* __x86_64__ */ + +#if defined(__x86_64__) #if SupportsFreebsd() // detect free besiyata dishmaya @@ -159,4 +166,5 @@ _start: #else #error "architecture unsupported" #endif /* __x86_64__ */ + .cfi_endproc .endfn _start,weak,hidden diff --git a/libc/intrin/cosmo_futex_thunk.S b/libc/intrin/cosmo_futex_thunk.S index 1ce0d5917..ad65cc106 100644 --- a/libc/intrin/cosmo_futex_thunk.S +++ b/libc/intrin/cosmo_futex_thunk.S @@ -21,16 +21,15 @@ .privileged cosmo_futex_thunk: + beg + pro #ifdef __x86_64__ - push %rbp - mov %rsp,%rbp mov %rcx,%r10 mov __NR_futex,%eax clc syscall jnc 1f neg %eax -1: pop %rbp #elif defined(__aarch64__) ldr x7,=__hostos ldr w7,[x7] @@ -46,5 +45,7 @@ cosmo_futex_thunk: #else #error "unsupported architecture" #endif /* __x86_64__ */ -1: ret +1: epi + ret + end .endfn cosmo_futex_thunk,globl,hidden diff --git a/libc/intrin/getcontext.S b/libc/intrin/getcontext.S index 8be4f58eb..bdfaded97 100644 --- a/libc/intrin/getcontext.S +++ b/libc/intrin/getcontext.S @@ -26,7 +26,9 @@ // @see setcontext() .ftrace1 getcontext: + beg .ftrace2 #include "libc/intrin/getcontext.inc" jmp __getcontextsig + end .endfn getcontext,globl diff --git a/libc/intrin/swapcontext.S b/libc/intrin/swapcontext.S index 6d2e517e6..b40b86777 100644 --- a/libc/intrin/swapcontext.S +++ b/libc/intrin/swapcontext.S @@ -31,17 +31,17 @@ // @returnstwice .ftrace1 swapcontext: + beg .ftrace2 #include "libc/intrin/getcontext.inc" #ifdef __x86_64__ - push %rbp - mov %rsp,%rbp - push %rsi - push %rsi + pro + cpush %rsi + cpush %rsi call __swapcontextsig - pop %rdi - pop %rdi - pop %rbp + cpop %rdi + cpop %rdi + epi test %eax,%eax jnz 1f #elif defined(__aarch64__) @@ -56,4 +56,5 @@ swapcontext: #endif jmp __tailcontext 1: ret + end .endfn swapcontext,globl diff --git a/libc/intrin/sys_sched_yield.S b/libc/intrin/sys_sched_yield.S index 2bfaa7ccb..f78f48712 100644 --- a/libc/intrin/sys_sched_yield.S +++ b/libc/intrin/sys_sched_yield.S @@ -24,9 +24,9 @@ // // @return 0 on success, or -1 w/ errno sys_sched_yield: + beg #ifdef __x86_64__ - push %rbp - mov %rsp,%rbp + pro xor %eax,%eax mov __hostos(%rip),%dl @@ -84,13 +84,16 @@ sys_sched_yield: // fails a positive or negative errno might get returned. #endif -9: leave +9: epi ret #elif defined(__aarch64__) stp x29,x30,[sp,-32]! mov x29,sp + .cfi_adjust_cfa_offset 32 + .cfi_rel_offset x29,16 + .cfi_rel_offset x30,24 mov x3,0 mov x2,0 add x4,sp,16 @@ -101,10 +104,14 @@ sys_sched_yield: mov x16,#0x5d // select(0,0,0,0,&blah) for xnu svc 0 ldp x29,x30,[sp],32 + .cfi_adjust_cfa_offset -32 + .cfi_restore x30 + .cfi_restore x29 ret #else #error "arch unsupported" #endif + end .endfn sys_sched_yield,globl .previous diff --git a/libc/macros.h b/libc/macros.h index 9a29e396a..257007a84 100644 --- a/libc/macros.h +++ b/libc/macros.h @@ -158,6 +158,60 @@ .weak \canonical .endm +.macro beg + .cfi_startproc +.endm + +.macro pro +#if defined(__x86_64__) + push %rbp + .cfi_adjust_cfa_offset 8 + .cfi_rel_offset %rbp,0 + mov %rsp,%rbp + .cfi_def_cfa_register %rbp +#elif defined(__aarch64__) + stp x29,x30,[sp,-16]! + mov x29,sp + .cfi_adjust_cfa_offset 16 + .cfi_rel_offset x29,0 + .cfi_rel_offset x30,8 +#else +#error "unsupported architecture" +#endif +.endm + +.macro epi +#if defined(__x86_64__) + .cfi_def_cfa_register %rsp + leave + .cfi_adjust_cfa_offset -8 + .cfi_restore %rbp +#elif defined(__aarch64__) + ldp x29,x30,[sp],#16 + .cfi_adjust_cfa_offset -16 + .cfi_restore x30 + .cfi_restore x29 +#else +#error "unsupported architecture" +#endif +.endm + +.macro end + .cfi_endproc +.endm + +.macro cpush reg:req + push \reg + .cfi_adjust_cfa_offset 8 + .cfi_rel_offset \reg,0 +.endm + +.macro cpop reg:req + pop \reg + .cfi_adjust_cfa_offset -8 + .cfi_restore \reg +.endm + #ifdef __aarch64__ .macro jmp dest:req b \dest diff --git a/libc/nexgen32e/djbsort-avx2.S b/libc/nexgen32e/djbsort-avx2.S index 8f51d678e..70868472d 100644 --- a/libc/nexgen32e/djbsort-avx2.S +++ b/libc/nexgen32e/djbsort-avx2.S @@ -7,8 +7,8 @@ // @note public domain // @see en.wikipedia.org/wiki/Sorting_network djbsort_avx2: - push %rbp - mov %rsp,%rbp + beg + pro push %r15 push %r14 push %r13 @@ -795,11 +795,13 @@ djbsort_avx2: pop %r13 pop %r14 pop %r15 - pop %rbp + epi ret + end .endfn djbsort_avx2,globl,hidden minmax_vector: + beg cmp $7,%rdx jg .L13 .L2: test %rdx,%rdx @@ -838,9 +840,11 @@ minmax_vector: sub $8,%rdx jne .L7 ret + end .endfn minmax_vector int32_twostages_32: + beg sub $-128,%rdi .L17: lea -128(%rdi),%rax test %rsi,%rsi @@ -866,13 +870,14 @@ int32_twostages_32: add $512,%rdi jmp .L17 .L21: ret + end .endfn int32_twostages_32 int32_threestages: - push %rbp + beg + pro imul $-24,%rdx,%r8 lea 0(,%rdx,8),%rax - mov %rsp,%rbp push %r15 push %r14 push %r13 @@ -961,11 +966,13 @@ int32_threestages: pop %r13 pop %r14 pop %r15 - pop %rbp + epi ret + end .endfn int32_threestages merge16_finish: + beg vpminsd %ymm1,%ymm0,%ymm3 vpmaxsd %ymm1,%ymm0,%ymm0 vperm2i128 $32,%ymm0,%ymm3,%ymm2 @@ -994,9 +1001,11 @@ merge16_finish: .L31: vmovdqu %ymm2,(%rdi) vmovdqu %ymm0,32(%rdi) ret + end .endfn merge16_finish int32_sort_2power: + beg push %r13 lea 16(%rsp),%r13 andq $-32,%rsp @@ -2075,6 +2084,7 @@ int32_sort_2power: lea -16(%r13),%rsp pop %r13 ret + end .endfn int32_sort_2power .rodata.cst32 diff --git a/libc/nexgen32e/gc.S b/libc/nexgen32e/gc.S index 8dd47a41d..1e6f30266 100644 --- a/libc/nexgen32e/gc.S +++ b/libc/nexgen32e/gc.S @@ -32,7 +32,8 @@ // @param rax,rdx,xmm0,xmm1,st0,st1 is return value // @see test/libc/runtime/gc_test.c .ftrace1 -__gc: .ftrace2 +__gc: beg + .ftrace2 #ifdef __x86_64__ @@ -47,8 +48,7 @@ __gc: .ftrace2 mov 8(%r8),%r9 mov 16(%r8),%rdi push 24(%r8) - push %rbp - mov %rsp,%rbp + pro sub $32,%rsp mov %rax,-8(%rbp) mov %rdx,-16(%rbp) @@ -57,7 +57,7 @@ __gc: .ftrace2 movdqa -32(%rbp),%xmm0 mov -16(%rbp),%rdx mov -8(%rbp),%rax - leave + epi ret 9: ud2 nop @@ -102,4 +102,5 @@ __gc: .ftrace2 #endif /* __x86_64__ */ + end .endfn __gc,globl,hidden diff --git a/libc/nexgen32e/gclongjmp.S b/libc/nexgen32e/gclongjmp.S index 88f534e10..51f93cb15 100644 --- a/libc/nexgen32e/gclongjmp.S +++ b/libc/nexgen32e/gclongjmp.S @@ -31,7 +31,9 @@ // @noreturn .ftrace1 gclongjmp: + beg .ftrace2 + pro #ifdef __x86_64__ push %rbp mov %rsp,%rbp @@ -65,4 +67,5 @@ gclongjmp: #else #error "unsupported architecture" #endif /* __x86_64__ */ + end .endfn gclongjmp,globl diff --git a/libc/nexgen32e/longjmp.S b/libc/nexgen32e/longjmp.S index aa4e0cfc7..5aefd029f 100644 --- a/libc/nexgen32e/longjmp.S +++ b/libc/nexgen32e/longjmp.S @@ -26,7 +26,7 @@ // @see gclongjmp() // @see siglongjmp() .ftrace1 -longjmp: +longjmp:beg .ftrace2 _longjmp: #ifdef __x86_64__ @@ -61,6 +61,7 @@ _longjmp: #else #error "unsupported architecture" #endif + end .endfn longjmp,globl .endfn _longjmp,globl .alias longjmp,siglongjmp diff --git a/libc/nexgen32e/nt2sysv.S b/libc/nexgen32e/nt2sysv.S index e4461d1bb..185687de6 100644 --- a/libc/nexgen32e/nt2sysv.S +++ b/libc/nexgen32e/nt2sysv.S @@ -30,8 +30,8 @@ // @note slower than __sysv2nt // @see NT2SYSV() macro __nt2sysv: - push %rbp - mov %rsp,%rbp + beg + pro sub $256,%rsp push %rbx push %rdi @@ -48,6 +48,7 @@ __nt2sysv: pop %rsi pop %rdi pop %rbx - leave + epi ret + end .endfn __nt2sysv,globl,hidden diff --git a/libc/runtime/clone-linux.S b/libc/runtime/clone-linux.S index 2c3a0caed..909d525fe 100644 --- a/libc/runtime/clone-linux.S +++ b/libc/runtime/clone-linux.S @@ -30,18 +30,18 @@ // @param 8(rsp) x6 is arg // @return tid of child on success, or -errno on error sys_clone_linux: + beg + pro #ifdef __x86_64__ - push %rbp - mov %rsp,%rbp - push %rbx + cpush %rbx mov %rcx,%r10 mov 16(%rbp),%rbx mov $56,%eax // __NR_clone syscall test %rax,%rax jz 2f -0: pop %rbx - pop %rbp +0: cpop %rbx + epi ret 2: xor %ebp,%ebp // child thread mov %rbx,%rdi // arg @@ -50,15 +50,13 @@ sys_clone_linux: mov $60,%eax // __NR_exit(exitcode) syscall #elif defined(__aarch64__) - stp x29,x30,[sp,#-16]! - mov x29,sp mov x8,x3 // swap x3 and x4 mov x3,x4 // swap x3 and x4 mov x4,x8 // swap x3 and x4 mov x8,#220 // __NR_clone svc #0 cbz x0,2f - ldp x29,x30,[sp],#16 + epi ret 2: mov x29,#0 // wipe backtrace mov x28,x3 // set cosmo tls @@ -69,4 +67,5 @@ sys_clone_linux: #else #error "unsupported architecture" #endif + end .endfn sys_clone_linux,globl,hidden diff --git a/libc/runtime/cosmo.S b/libc/runtime/cosmo.S index 0b52e57d6..59fe944c1 100644 --- a/libc/runtime/cosmo.S +++ b/libc/runtime/cosmo.S @@ -32,8 +32,8 @@ // @param rdx is environ // @param rcx is auxv // @noreturn -cosmo: push %rbp - mov %rsp,%rbp +cosmo: beg + pro mov %edi,%r12d mov %rsi,%r13 mov %rdx,%r14 @@ -104,7 +104,10 @@ cosmo: push %rbp je 2f push %rax push %rax - call .Largs + mov %r12d,%edi + mov %r13,%rsi + mov %r14,%rdx + mov %r15,%rcx call *(%rax) pop %rax pop %rax @@ -112,17 +115,15 @@ cosmo: push %rbp jmp 1b // call main() -2: call .Largs +2: mov %r12d,%edi + mov %r13,%rsi + mov %r14,%rdx + mov %r15,%rcx .weak main call main xchg %eax,%edi call exit - -.Largs: mov %r12d,%edi - mov %r13,%rsi - mov %r14,%rdx - mov %r15,%rcx - ret + end .endfn cosmo,weak // Enables Thread Local Storage. diff --git a/libc/runtime/ftrace-hook.S b/libc/runtime/ftrace-hook.S index 56b66704c..cd25a18c4 100644 --- a/libc/runtime/ftrace-hook.S +++ b/libc/runtime/ftrace-hook.S @@ -28,8 +28,12 @@ ftrace_hook: cmpl $0,__ftrace(%rip) jle 1f + .cfi_startproc push %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 mov %rsp,%rbp + .cfi_def_cfa_register %rbp and $-16,%rsp sub $128,%rsp movdqu %xmm0,-0x80(%rbp) @@ -41,13 +45,21 @@ ftrace_hook: movdqu %xmm6,-0x20(%rbp) movdqu %xmm7,-0x10(%rbp) push %rax + .cfi_offset %rax, -24 push %rcx + .cfi_offset %rcx, -32 push %rdx + .cfi_offset %rdx, -40 push %rdi + .cfi_offset %rdi, -48 push %rsi + .cfi_offset %rsi, -56 push %r8 + .cfi_offset %r8, -64 push %r9 + .cfi_offset %r9, -72 push %r10 + .cfi_offset %r10, -80 call ftracer movdqu -0x80(%rbp),%xmm0 movdqu -0x70(%rbp),%xmm1 @@ -66,12 +78,20 @@ ftrace_hook: pop %rcx pop %rax leave + .cfi_restore %rbp + .cfi_def_cfa %rsp, 8 1: ret + .cfi_endproc #elif defined(__aarch64__) stp x29,x30,[sp,-384]! + .cfi_startproc + .cfi_def_cfa_offset 384 + .cfi_offset 29, -384 // x29 (fp) is saved at [sp - 384] + .cfi_offset 30, -376 // x30 (lr) is saved at [sp - 376] mov x29,sp + .cfi_def_cfa_register 29 stp x0,x1,[sp,16] adrp x0,__ftrace @@ -80,18 +100,45 @@ ftrace_hook: ble 1f stp x2,x3,[sp,32] + .cfi_offset 2, -352 + .cfi_offset 3, -344 stp x4,x5,[sp,48] + .cfi_offset 4, -336 + .cfi_offset 5, -328 stp x6,x7,[sp,64] + .cfi_offset 6, -320 + .cfi_offset 7, -312 stp x8,x9,[sp,80] + .cfi_offset 8, -304 + .cfi_offset 9, -296 stp x10,x11,[sp,96] + .cfi_offset 10, -288 + .cfi_offset 11, -280 stp x12,x13,[sp,112] + .cfi_offset 12, -272 + .cfi_offset 13, -264 stp x14,x15,[sp,128] + .cfi_offset 14, -256 + .cfi_offset 15, -248 stp x16,x19,[sp,160] + .cfi_offset 16, -224 + .cfi_offset 19, -216 stp x20,x21,[sp,176] + .cfi_offset 20, -208 + .cfi_offset 21, -200 stp x22,x23,[sp,192] + .cfi_offset 22, -192 + .cfi_offset 23, -184 stp x24,x25,[sp,208] + .cfi_offset 24, -176 + .cfi_offset 25, -168 stp x26,x27,[sp,224] + .cfi_offset 26, -160 + .cfi_offset 27, -152 stp x17,x28,[sp,240] + .cfi_offset 17, -144 + .cfi_offset 28, -136 + // No CFI directives needed for FP registers stp q0,q1,[sp,256] stp q2,q3,[sp,288] stp q4,q5,[sp,320] @@ -119,7 +166,12 @@ ftrace_hook: 1: ldp x0,x1,[sp,16] ldp x29,x30,[sp],384 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa 7, 0 // On some ARM systems the stack pointer is represented by register 7 + .cfi_def_cfa_offset 0 ret + .cfi_endproc #endif /* __x86_64__ */ .endfn ftrace_hook,globl,hidden diff --git a/libc/sysv/systemfive.S b/libc/sysv/systemfive.S index 76075a927..178892482 100644 --- a/libc/sysv/systemfive.S +++ b/libc/sysv/systemfive.S @@ -102,8 +102,8 @@ __pid: .quad 0 .previous systemfive_cp: - push %rbp - mov %rsp,%rbp // so backtraces work + beg + pro systemfive_cancellable: // our pthread_cancel() miracle code cmpb $0,__tls_enabled(%rip) // inspired by the musl libc design! je 1f // we handle linux and bsd together! @@ -123,7 +123,7 @@ systemfive_cancellable: // our pthread_cancel() miracle code clc // no cancellable system calls exist syscall // that have 7+ args on the bsd OSes systemfive_cancellable_end: // i/o calls park here for long time - pop %rbp + epi jnc 2f neg %rax // turns bsd errno to system v errno 2: cmp $-4095,%rax // but we still check again on eintr @@ -144,11 +144,13 @@ systemfive_cancellable_end: // i/o calls park here for long time je systemfive_errno // we aren't actually cancelled jmp 4f // now we are in fact cancelled systemfive_cancel: // SIGTHR will jump here too - pop %rbp + epi 4: jmp _pthread_cancel_ack // tail call .weak _pthread_cancel_ack // must be linked if we're cancelled + end #if IsModeDbg() not_a_cancellation_point: // need BEGIN/END_CANCELLATION_POINT + beg nop .weak report_cancellation_point 5: ezlea report_cancellation_point,cx @@ -157,6 +159,7 @@ not_a_cancellation_point: // need BEGIN/END_CANCELLATION_POINT call *%rcx 6: ud2 nop + end #endif .globl systemfive_cancellable_end .globl systemfive_cancellable @@ -166,19 +169,20 @@ not_a_cancellation_point: // need BEGIN/END_CANCELLATION_POINT .Lanchorpoint: #if SupportsLinux() || SupportsMetal() systemfive_linux: + beg and $0xfff,%eax // remove nonlinux bits from ordinal cmp $0xfff,%eax // checks if unsupported by platform je systemfive_enosys // never taken branches cost nothing btr $11,%eax // 0x800 means a call is cancellable jc systemfive_cp // it is handled by the holiest code mov %rcx,%r10 // syscall instruction clobbers %rcx - push %rbp // linux never reads args from stack - mov %rsp,%rbp // having frame will help backtraces + pro // linux never reads args from stack syscall // this is known as a context switch - pop %rbp // next we check to see if it failed + epi // next we check to see if it failed cmp $-4095,%rax // system five nexgen32e abi ยง a.2.1 jae systemfive_error // encodes errno as neg return value ret + end .endfn systemfive_linux,globl,hidden systemfive_error: neg %eax @@ -186,27 +190,35 @@ systemfive_error: .endfn systemfive_error,globl,hidden #endif systemfive_errno: + beg xchg %eax,%ecx call __errno_location mov %ecx,(%rax) // normalize to c library convention push $-1 // negative one is only error result pop %rax // the push pop is to save code size ret + end .endfn systemfive_errno,globl,hidden systemfive_enosys: + beg mov ENOSYS(%rip),%eax jmp systemfive_errno + end .endfn systemfive_enosys,globl,hidden #if SupportsNetbsd() systemfive_netbsd: + beg shr $4*13,%rax jmp systemfive_bsdscrub + end .endfn systemfive_netbsd,globl,hidden #endif #if SupportsOpenbsd() systemfive_openbsd: + beg shr $4*10,%rax jmp systemfive_bsdscrub + end .endfn systemfive_openbsd,globl,hidden #endif #if SupportsFreebsd() @@ -222,6 +234,7 @@ systemfive_bsdscrub: // ๐‘ ๐‘™๐‘–๐‘‘๐‘’ .endfn systemfive_bsdscrub,globl,hidden systemfive_bsd: + beg cmp $0xfff,%ax je systemfive_enosys btr $11,%eax // checks/reset the 800 cancellable bit @@ -230,6 +243,7 @@ systemfive_bsd: syscall // bsd will need arg on stack sometimes jc systemfive_errno // bsd sets carry flag if %rax is errno ret + end .endfn systemfive_bsd #endif #if SupportsXnu()