summaryrefslogtreecommitdiffstats
path: root/abi
diff options
context:
space:
mode:
Diffstat (limited to 'abi')
-rw-r--r--abi/permission.h4
-rw-r--r--abi/syscall.h33
2 files changed, 34 insertions, 3 deletions
diff --git a/abi/permission.h b/abi/permission.h
index 5ca56e0..10bc6a3 100644
--- a/abi/permission.h
+++ b/abi/permission.h
@@ -1,6 +1,8 @@
#ifndef JOVE_ABI_PERMISSION_H
#define JOVE_ABI_PERMISSION_H 1
-#define PERM_MEMSRV 0
+#define PERM_MEM_PD 1 /* Permission to write to any PD. */
+#define PERM_MEM_MAP 2 /* Permission to map physical pages. */
+#define PERM_MEM_ALLOC 4 /* Permission to allocate and free physical memory.*/
#endif
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