libk  Diff

Differences From Artifact [3fa83c18de]:

To Artifact [a731f1dad0]:


    32     32   	;         r12 = u64* errno
    33     33   	; arg 0 = s64* result
    34     34   	; arg 1 = errno ptr
    35     35   	; arg 2 = syscall num
    36     36   	; arg 3 = valency
    37     37   	; arg 4 = args ptr
    38     38   
    39         -	; we use two registers that are supposed
           39  +	; we use three registers that are supposed
    40     40   	; to be callee-saved, so we need to
    41     41   	; push them to the stack and then pop
    42     42   	; them back off just before the fn rets.
    43     43   	push rbx
    44     44   	push r12
           45  +	push r15
    45     46   
    46     47   	; store the locals in registers that
    47     48   	; are guaranteed not to be clobbered,
    48     49   	; saving us some cycles pushing to
    49     50   	; and popping back from the stack
    50     51   	mov rbx, ccall.reg.0
    51     52   	mov r12, ccall.reg.1
................................................................................
    99    100   	; the errno to its positive equivalent,
   100    101   	; and store -1 in the return variable
   101    102   	.error: neg sys.reg.ret
   102    103   	        mov qword [rbx], -1
   103    104   			mov       [r12], sys.reg.ret
   104    105   			jmp .return
   105    106   
   106         -	.return: pop r12
          107  +	.return: pop r15 
          108  +		 pop r12
   107    109   	         pop rbx
   108    110   			 ret