Rename libmsl to libsystem
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m6s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m6s
This commit is contained in:
1
libsystem/amd64/.gitignore
vendored
Normal file
1
libsystem/amd64/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.o
|
||||
8
libsystem/amd64/_start.S
Normal file
8
libsystem/amd64/_start.S
Normal file
@@ -0,0 +1,8 @@
|
||||
.global _start
|
||||
_start:
|
||||
xorq %rbp, %rbp
|
||||
movq %rsp, %rbp
|
||||
andq $-16, %rsp
|
||||
subq $8, %rsp
|
||||
|
||||
callq __premain
|
||||
6
libsystem/amd64/src.mk
Normal file
6
libsystem/amd64/src.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
c += amd64/syscall.c
|
||||
|
||||
S += amd64/_start.S
|
||||
|
||||
o += amd64/_start.o \
|
||||
amd64/syscall.o
|
||||
17
libsystem/amd64/syscall.c
Normal file
17
libsystem/amd64/syscall.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <amd64/syscall.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
uintptr_t amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
|
||||
uintptr_t a5, uintptr_t a6) {
|
||||
uint64_t result;
|
||||
__asm__ volatile ("movq %[a4], %%r10\n"
|
||||
"movq %[a5], %%r8\n"
|
||||
"movq %[a6], %%r9\n"
|
||||
"syscall\n"
|
||||
: "=a"(result)
|
||||
: "a"(syscall_num), "D"(a1), "S"(a2),
|
||||
"d"(a3), [a4] "r"(a4), [a5] "r"(a5), [a6] "r"(a6)
|
||||
: "r10", "r8", "r9", "r11", "rcx", "cc", "memory");
|
||||
return result;
|
||||
}
|
||||
10
libsystem/amd64/syscall.h
Normal file
10
libsystem/amd64/syscall.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _LIBMSL_AMD64_SYSCALL_H
|
||||
#define _LIBMSL_AMD64_SYSCALL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Performs a syscall for the AMD64 */
|
||||
uintptr_t amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
|
||||
uintptr_t a5, uintptr_t a6);
|
||||
|
||||
#endif // _LIBMSL_AMD64_SYSCALL_H
|
||||
Reference in New Issue
Block a user