-LABEL(cerror)
- /* cancelable syscall, for arg1 to _cthread_set_errno_self */
- movq $0,%rsi
- jmp 1f
-LABEL(cerror_nocancel)
- /* non-cancelable, see above. */
- movq $1,%rsi
-1: PICIFY(_errno) /* address -> %r11 */
- movl %eax,(%r11)
- mov %rsp,%rdx
- andq $-16,%rsp
- subq $16,%rsp
- // Preserve the original stack
- movq %rdx,(%rsp)
- movq %rax,%rdi
- CALL_EXTERN(_cthread_set_errno_self)
- // Restore the original stack
- movq (%rsp),%rsp
- movq $-1,%rax
- movq $-1,%rdx /* in case a 128-bit value is returned */
- ret