libk  platform.syscall.fn.c at [12a51d9c50]

File mod/kcore/platform.syscall.fn.c artifact f22252d79e part of check-in 12a51d9c50


/* platform.syscall.fn.c
 * ~ lexi hale <lexi@hale.su>
 * this file provides a unified interface
 * to the host operating system's syscalls.
 * its function signature may vary across
 * OSes, as the details of each's syscall
 * implementation may vary drastically.
 */

#include <k/def.h>
#include <k/type.h>

#ifdef KFenv_posix
#	include <posix.h>
#else
	Knoimpl(k_platform_syscall)
#endif

volatile extern void k_platform_syscall_raw (
		volatile k_platform_syscall_return* return_slot,
		volatile k_platform_syscall_error*  error_no_slot,
		volatile enum k_platform_syscall    syscall_no,
		volatile u8                         valency,
		volatile s64*                       args);

volatile struct k_platform_syscall_answer
k_platform_syscall(volatile enum k_platform_syscall call, volatile u8 valency, volatile s64 args[]) {
	struct k_platform_syscall_answer answer;

	k_platform_syscall_raw
		(&answer.ret,
		 &answer.error,
		 call, valency, args);

	return answer;
}