feat: implement core initialization and local APIC setup
This commit is contained in:
parent
ada1859910
commit
beb7fb38ae
19 changed files with 747 additions and 41 deletions
16
kernel/include/util/msr.h
Normal file
16
kernel/include/util/msr.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/number.h"
|
||||
|
||||
inline uint64_t msr_read(uint32_t msr) {
|
||||
uint32_t low = 0;
|
||||
uint32_t high = 0;
|
||||
__asm__ volatile("rdmsr" : "=a"(low), "=d"(high) : "c"(msr));
|
||||
return (static_cast<uint64_t>(high) << 32) | low;
|
||||
}
|
||||
|
||||
inline void msr_write(uint32_t msr, uint64_t value) {
|
||||
uint32_t low = static_cast<uint32_t>(value);
|
||||
uint32_t high = static_cast<uint32_t>(value >> 32);
|
||||
__asm__ volatile("wrmsr" : : "c"(msr), "a"(low), "d"(high));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue