arch_ctl syscall

it controls architecture specific things such as the GSBASE in x86_64
This commit is contained in:
Matheus
2022-08-18 20:42:03 -03:00
parent 0984a6458d
commit da99da2b36
3 changed files with 35 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <kernel/syscalls.h>
#include <arch/msr.h>
#include <errno.h>
#define ARCH_CTL_GSBASE 0
syscallret syscall_arch_ctl(int func, void* arg){
syscallret retv;
retv.errno = 0;
retv.ret = 0;
switch(func){
case ARCH_CTL_GSBASE:
wrmsr(MSR_KERNELGSBASE, (uint64_t)arg);
break;
default:
retv.errno = EINVAL;
}
if(retv.errno)
retv.ret = -1;
return retv;
}
+3 -1
View File
@@ -3,12 +3,14 @@ section .rodata
extern syscall_libc_log
extern syscall_mmap
func_count equ 2
extern syscall_arch_ctl
func_count equ 3
func_table:
dq syscall_libc_log
dq syscall_mmap
dq syscall_arch_ctl
section .text
global asm_syscall_entry
+3
View File
@@ -1,6 +1,9 @@
#ifndef _SYSCALLS_H_INCLUDE
#define _SYSCALLS_H_INCLUDE
#include <stddef.h>
#include <sys/types.h>
typedef struct {
long ret;
long errno;