Added syscalls stub

This commit is contained in:
Alex
2022-10-12 04:34:37 +03:00
parent 127476ac64
commit a2da69d777
7 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,14 @@
#include <syscalls.hpp>
#include <cpu.hpp>
extern "C" __attribute__((naked, used, no_stack_protector)) void SystemCallHandlerStub()
{
}
extern "C" uint64_t SystemCallsHandler(SyscallsRegs *regs);
void InitializeSystemCalls()
{
}

View File

@ -0,0 +1,23 @@
#include <syscalls.hpp>
#include <cpu.hpp>
#include "cpu/gdt.hpp"
using namespace CPU::x64;
extern "C" __attribute__((naked, used, no_stack_protector)) void SystemCallHandlerStub()
{
asmv(".loop\n"
"jmp .loop\n");
}
extern "C" uint64_t SystemCallsHandler(SyscallsRegs *regs);
void InitializeSystemCalls()
{
wrmsr(MSR_EFER, rdmsr(MSR_EFER) | 1);
wrmsr(MSR_STAR, ((uint64_t)(GDT_KERNEL_CODE) << 32) | ((uint64_t)(GDT_KERNEL_DATA | 3) << 48));
wrmsr(MSR_LSTAR, (uint64_t)SystemCallsHandler);
wrmsr(MSR_SYSCALL_MASK, 0);
}

View File

@ -0,0 +1,13 @@
#include <syscalls.hpp>
#include <cpu.hpp>
#include "cpu/gdt.hpp"
using namespace CPU::x32;
extern "C" uint32_t SystemCallsHandler(SyscallsRegs *regs);
void InitializeSystemCalls()
{
}