MSR and syscall changes

- Moved MSR code to separate files with an enum class
- Implemented syscall_enable in C++ using new MSR calls
This commit is contained in:
Justin C. Miller
2018-09-15 00:37:49 -07:00
parent 62c559043d
commit 1308864061
9 changed files with 78 additions and 61 deletions

27
src/kernel/msr.h Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
/// \file msr.h
/// Routines and definitions for dealing with Model-Specific Registers
#include <stdint.h>
enum class msr : uint32_t
{
ia32_efer = 0xc0000080,
ia32_star = 0xc0000081,
ia32_lstar = 0xc0000082,
ia32_fmask = 0xc0000084,
ia32_gs_base = 0xc0000101,
ia32_kernel_gs_base = 0xc0000102
};
/// Read the value of a MSR
/// \arg addr The MSR address
/// \returns The current value of the MSR
uint64_t rdmsr(msr addr);
/// Write to a MSR
/// \arg addr The MSR address
/// \arg value The value to write
void wrmsr(msr addr, uint64_t value);