[libj6] Create libj6

Pull syscall code out of libc and create new libj6. This should
eventually become a vDSO, but for now it can still be a static lib.
Also renames all the _syscall_* symbol names to j6_*
This commit is contained in:
Justin C. Miller
2021-01-30 17:07:36 -08:00
parent c3dd65457d
commit 3595c3a440
7 changed files with 55 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
extern _syscall_process_exit
extern j6_process_exit
global _PDCLIB_Exit
_PDCLIB_Exit:
; arg should already be in rdi
jmp _syscall_process_exit
jmp j6_process_exit

View File

@@ -1,28 +0,0 @@
%macro SYSCALL 2
global _syscall_%1
_syscall_%1:
push rbp
mov rbp, rsp
; args should already be in rdi, etc, but rcx will
; get stomped, so stash it in r10, which isn't a
; callee-saved register, but also isn't used in the
; function call ABI.
mov r10, rcx
mov rax, %2
syscall
; result is now already in rax, so just return
pop rbp
ret
%endmacro
%define SYSCALL(n, name) SYSCALL name, n
%define SYSCALL(n, name, a) SYSCALL name, n
%define SYSCALL(n, name, a, b) SYSCALL name, n
%define SYSCALL(n, name, a, b, c) SYSCALL name, n
%define SYSCALL(n, name, a, b, c, d) SYSCALL name, n
%define SYSCALL(n, name, a, b, c, d, e) SYSCALL name, n
%include "j6/tables/syscalls.inc"