mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 08:54:31 -08:00
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:
18
src/kernel/msr.cpp
Normal file
18
src/kernel/msr.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "msr.h"
|
||||
|
||||
uint64_t
|
||||
rdmsr(msr addr)
|
||||
{
|
||||
uint32_t low, high;
|
||||
__asm__ __volatile__ ("rdmsr" : "=a"(low), "=d"(high) : "c"(addr));
|
||||
return (static_cast<uint64_t>(high) << 32) | low;
|
||||
}
|
||||
|
||||
void
|
||||
wrmsr(msr addr, uint64_t value)
|
||||
{
|
||||
uint32_t low = value & 0xffffffff;
|
||||
uint32_t high = value >> 32;
|
||||
__asm__ __volatile__ ("wrmsr" :: "c"(addr), "a"(low), "d"(high));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user