feat: implement core initialization and local APIC setup

This commit is contained in:
Katharina 2026-07-04 16:14:36 +02:00
parent ada1859910
commit beb7fb38ae
19 changed files with 747 additions and 41 deletions

16
kernel/include/util/msr.h Normal file
View 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));
}