57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
// this code is licenced under Wrathmark licence
|
|
// © 2026 wullie wulliestudio.com
|
|
// please see attached licence for full usage and rights
|
|
|
|
#include "LocalHeader.h"
|
|
// look at me I am the handler now
|
|
|
|
|
|
// each numbered syscall take that amount of arguments eg syscall1 takes one arg
|
|
|
|
long syscall1(long number, long arg1){
|
|
long result;
|
|
__asm__ __volatile(
|
|
"syscall"
|
|
: "=a"(result)
|
|
: "a"(number), "D"(arg1)
|
|
: "rcx", "r11", "memory"
|
|
);
|
|
return result;
|
|
}
|
|
|
|
long syscall2(long number, long arg1, long arg2){
|
|
long result;
|
|
__asm__ __volatile(
|
|
"syscall"
|
|
: "=a"(result)
|
|
: "a"(number), "D"(arg1), "S"(arg2)
|
|
: "rcx", "r11", "memory"
|
|
);
|
|
return result;
|
|
}
|
|
|
|
long syscall3(long number, long arg1, long arg2, long arg3){
|
|
long result;
|
|
__asm__ __volatile(
|
|
"syscall"
|
|
: "=a"(result)
|
|
: "a"(number), "D"(arg1), "S"(arg2), "d"(arg3)
|
|
: "rcx", "r11", "memory"
|
|
);
|
|
return result;
|
|
}
|
|
|
|
long syscall4(long number, long arg1, long arg2, long arg3, long arg4){
|
|
long result;
|
|
|
|
register long r10 __asm__("r10") = arg4;
|
|
|
|
__asm__ __volatile(
|
|
"syscall"
|
|
: "=a"(result)
|
|
: "a"(number), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10)
|
|
: "rcx", "r11", "memory"
|
|
);
|
|
return result;
|
|
}
|