diff --git a/extra_tests/001_test/syscall.hpp b/extra_tests/001_test/syscall.hpp index 528848a..62ed2a1 100644 --- a/extra_tests/001_test/syscall.hpp +++ b/extra_tests/001_test/syscall.hpp @@ -3,10 +3,22 @@ #include #include +#if defined(__x86_64__) + #if defined(__linux__) + + constexpr bool is_x86_64_linux = true; + #else + constexpr bool is_x86_64_linux = false; + #endif +#else +constexpr bool is_x86_64_linux = false; +#endif + template struct syscall; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1) const { int64_t ret; @@ -22,6 +34,7 @@ struct syscall { }; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1,int64_t p2) const { int64_t ret; @@ -37,6 +50,7 @@ struct syscall { }; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1,int64_t p2,int64_t p3) const { int64_t ret; @@ -52,6 +66,7 @@ struct syscall { }; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1,int64_t p2,int64_t p3,int64_t p4) const { int64_t ret; @@ -68,6 +83,7 @@ struct syscall { }; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1,int64_t p2,int64_t p3,int64_t p4,int64_t p5) const { int64_t ret; @@ -85,6 +101,7 @@ struct syscall { }; template +requires is_x86_64_linux struct syscall { int64_t operator()(int64_t p1,int64_t p2,int64_t p3,int64_t p4,int64_t p5,int64_t p6) const { int64_t ret; @@ -124,19 +141,19 @@ inline int munmap(void *addr, size_t length) { return _munmap((int64_t)addr, (int64_t)length); } -inline int read(int fd, gp::buffer buffer) { - return _read((int64_t)fd, (int64_t)buffer.begin().data, (int64_t)buffer.size()); -} - -inline int write(int fd, gp::buffer buffer) { - return _write((int64_t)fd, (int64_t)buffer.begin().data, (int64_t)buffer.size()); -} - extern "C" { - +/// Yes, __attribute__((__noreturn__)), not [[noreturn]], because some God forsaken potato decided that those attributes are not the attributes I am looking for inline __attribute__ ((__noreturn__)) void exit(int status) { _exit((int64_t)status); while(true); } +} + +inline int read(int fd, gp::buffer buffer) { + return _read((int64_t)fd, (int64_t)buffer.begin().data, (int64_t)buffer.size()); +} + +inline int write(int fd, gp::buffer buffer) { + return _write((int64_t)fd, (int64_t)buffer.begin().data, (int64_t)buffer.size()); } \ No newline at end of file