First Hello world syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
This commit is contained in:
19
kernel/amd64/syscall.c
Normal file
19
kernel/amd64/syscall.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <amd64/gdt.h>
|
||||
#include <amd64/intr.h>
|
||||
#include <amd64/msr-index.h>
|
||||
#include <amd64/msr.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
extern void amd64_syscall_entry (void);
|
||||
|
||||
void amd64_syscall_dispatch (void* stack_ptr) {
|
||||
struct saved_regs* regs = stack_ptr;
|
||||
DEBUG ("hello syscall\n");
|
||||
}
|
||||
|
||||
void syscall_init (void) {
|
||||
amd64_wrmsr (MSR_STAR, ((uint64_t)GDT_KCODE << 32) | ((uint64_t)(GDT_UCODE - 16) << 48));
|
||||
amd64_wrmsr (MSR_LSTAR, (uint64_t)&amd64_syscall_entry);
|
||||
amd64_wrmsr (MSR_SYSCALL_MASK, (1ULL << 9));
|
||||
amd64_wrmsr (MSR_EFER, amd64_rdmsr (MSR_EFER) | EFER_SCE);
|
||||
}
|
||||
Reference in New Issue
Block a user