libk  Diff

Differences From Artifact [9bf0ba9bf3]:

  • File mod/kcore/syscall.fn.x86.lin.64.s — part of check-in [e50a476efe] at 2019-08-22 02:52:20 on branch trunk — removed sneaky segfault in x86-64 syscall fn where %r8 (the register that contains the pointer to the syscall arguments from the C syscall wrapper, which need to be copied into the correct registers before the kernel is invoked) gets overwritten if the syscall valency > 5, because of overlapping ccall and syscall ABI argument registers - r8 is clobbered by argument 5 and any further attempts to use it as a ptr segfault at best. also modified the report function so that it immediate cancels compilation if a sub-process reports failure. changed allocator function signatures so they can return a condition code if the kernel reports an error; updated example code so it compiles and runs without fault. (user: lexi, size: 2358) [annotate] [blame] [check-ins using]

To Artifact [856b7532d5]:


7
8
9
10
11
12
13
14





15
16
17
18
19
20
21
22
; altogether and access the error value of a
; syscall directly. invoke as:
;
; 	void k_platform_syscall_raw(s64* result, u64* errno,
;		syscall, u8 valency, s64[] args)

bits 64
%include "arch/posix/x86.lin.64.s"





%include "arch/x86.cdecl.64.s"
; vim: ft=nasm

%macro handle_arg 1
	%assign v %1+1
	mov sys.reg. %+ v, [r15 + 8 * %1]
	dec ccall.reg.3
	jz .perform_call







<
>
>
>
>
>
|







7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
; altogether and access the error value of a
; syscall directly. invoke as:
;
; 	void k_platform_syscall_raw(s64* result, u64* errno,
;		syscall, u8 valency, s64[] args)

bits 64


; which file is included is selected via the value
; of the target tuple - arch/$target is passed to
; the assembler as an include directory
%include 'syscall.s'
%include 'cdecl.s'
; vim: ft=nasm

%macro handle_arg 1
	%assign v %1+1
	mov sys.reg. %+ v, [r15 + 8 * %1]
	dec ccall.reg.3
	jz .perform_call