Rewrite init app in C, introduce MSL (MOP3 System Library)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 35s

This commit is contained in:
2026-01-04 01:11:31 +01:00
parent 2c954a9ca9
commit e077d322f4
57 changed files with 214 additions and 120 deletions

23
libmsl/amd64/syscall.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stddef.h>
#include <stdint.h>
#include <amd64/syscall.h>
int msl_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 %1, %%rax\n"
"movq %2, %%rdi\n"
"movq %3, %%rsi\n"
"movq %4, %%rdx\n"
"movq %5, %%r10\n"
"movq %6, %%r8\n"
"movq %7, %%r9\n"
"syscall\n"
"movq %%rax, %0\n"
: "=r"(result)
: "r"((uint64_t)syscall_num), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6)
: "memory", "cc", "rcx", "r11"
);
return (int)result;
}