summaryrefslogtreecommitdiffstats
path: root/abi/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'abi/syscall.h')
-rw-r--r--abi/syscall.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/abi/syscall.h b/abi/syscall.h
index 95cd4a5..54a67b9 100644
--- a/abi/syscall.h
+++ b/abi/syscall.h
@@ -1,6 +1,8 @@
#ifndef JOVE_ABI_SYSCALL_H
#define JOVE_ABI_SYSCALL_H 1
+#include <stdint.h>
+
typedef struct syscall {
int id;
} syscall_t;
@@ -10,15 +12,32 @@ struct syscall_log {
const char *message;
};
+struct syscall_tid {
+ syscall_t syscall;
+ intmax_t value;
+};
+
+struct syscall_mem_map {
+ syscall_t syscall;
+ uintptr_t phys;
+ uintptr_t virt;
+ intmax_t tid;
+};
+
enum
{
SYSCALL_LOG = 0,
+ SYSCALL_TID,
+ SYSCALL_MEM_MAP,
SYSCALL_COUNT
};
-#define _SYSCALL(data) __asm__ volatile("movq %0, %%rdi\nsyscall":: "r"(data))
+#define _SYSCALL(data) \
+ intmax_t ax; \
+ __asm__ volatile("movq %0, %%rdi\nsyscall": "=a"(ax): "r"(data): "memory"); \
+ return ax
-void _syscall_log(const char *message) {
+int _syscall_log(const char *message) {
struct syscall_log syscall_data = {
.syscall = (syscall_t){ .id = SYSCALL_LOG },
.message = message
@@ -26,4 +45,14 @@ void _syscall_log(const char *message) {
_SYSCALL(&syscall_data);
}
+intmax_t _syscall_tid(void) {
+ syscall_t syscall_data = { SYSCALL_TID };
+ _SYSCALL(&syscall_data);
+}
+
+void __syscall_mem_map(uintptr_t phys, uintptr_t virt, intmax_t tid)
+{
+
+}
+
#endif