libk  Diff

Differences From Artifact [f9a360108d]:

To Artifact [27d79c3e63]:


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66





67
68
69
70
71








72
73
	%assign i 0
	%rep 6
		handle_arg i
		%assign i i+1
	%endrep

	; valency >= 7. this is not valid, so
	; we set our return value to 0 and the
	; error number to its maximum value in
	; order to indicate that the syscall
	; was invalid
	mov qword [rbx], 0
	mov qword [r12], -1
	ret

	; we have a valency match - perform the
	; requested syscall already store in rax
	.perform_call: sys.call





	
	; move our return values into place and
	; return to the caller (which should
	; always be k_platform_syscall, btw)
	mov [rbx], sys.reg.ret








	mov [r12], sys.reg.err
	ret







|



|






>
>
>
>
>




|
>
>
>
>
>
>
>
>
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	%assign i 0
	%rep 6
		handle_arg i
		%assign i i+1
	%endrep

	; valency >= 7. this is not valid, so
	; we set our return value to -1 and the
	; error number to its maximum value in
	; order to indicate that the syscall
	; was invalid
	mov qword [rbx], -1
	mov qword [r12], -1
	ret

	; we have a valency match - perform the
	; requested syscall already store in rax
	.perform_call: sys.call

	; check for an error - on x86, error is
	; returned as a negative value in %rax
	test sys.reg.ret, sys.reg.ret
	js .error ; jump if sign flag set
	
	; move our return values into place and
	; return to the caller (which should
	; always be k_platform_syscall, btw)
	mov       [rbx], sys.reg.ret
	mov qword [r12], 0 ; no error
	ret

	; an error was returned - we need to set
	; the errno to its positive equivalent,
	; and store -1 in the return variable
	.error: neg sys.reg.ret
	        mov qword [rbx], -1
			mov       [r12], sys.reg.ret
			ret