From f46ab8ca2050ee77edf6e6b979875426bdaf29dc Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 13 Mar 2024 09:58:22 -0400 Subject: fix incorrect tss rsp assignment --- abi/syscall.h | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'abi/syscall.h') 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 + 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 -- cgit v1.2.1