libk  Artifact [7b471fc276]

Artifact 7b471fc2763ddad3ae989da3d74b38ef0b08f08ee0631c3dc5ab1e875e162051:


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

global kmem_platform_munmap
kmem_platform_munmap:
	; to call munmap, we need to translate the cdecl64
	; register arguments to their appropriate syscall64
	; registers. all those that matter are the same.
	  mov sys.reg.1, ccall.reg.0 ;nop - rdi → rdi
	  mov sys.reg.2, ccall.reg.1 ;nop - rsi → rsi

	mov sys.reg.0, sys.munmap
	sys.call

	mov ccall.reg.ret, sys.reg.ret ; rax → rdi
	ret