summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-16 00:00:26 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-16 00:00:26 +0200
commitb7c6e7aef4c2c647623520f65d78921841bdffaa (patch)
tree171db1546c38c5f5fd658ae28ac98259c19649ce /dev/kernel
parentb55f22d6a4f85751e0054dbf17eefe438a21b048 (diff)
feat(kernel/sched): tweak HalApplicationProcessor.cc
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel')
-rw-r--r--dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
index d049a74d..46b376c0 100644
--- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
+++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
@@ -195,9 +195,9 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
return;
}
- auto hw_and_pow_int = PowerFactoryInterface(vendor_ptr);
- kRawMADT = hw_and_pow_int.Find(APIC_Signature).Leak().Leak();
+ PowerFactoryInterface hw_and_pow_int{vendor_ptr};
+ kRawMADT = hw_and_pow_int.Find(APIC_Signature).Leak().Leak();
kMADTBlock = reinterpret_cast<HAL_APIC_MADT*>(kRawMADT);
kSMPAware = NO;
@@ -208,6 +208,7 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
kSMPCount = 0;
UInt32 lo = 0, hi = 0;
+
hal_get_msr(0x1B, &lo, &hi);
UInt64 apic_base = ((UInt64) hi << 32) | lo;
@@ -228,17 +229,20 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
// LAPIC timer setup
*(volatile UInt32*) (kApicBaseAddress + LAPIC_REG_TIMER_DIV) = 0b0011; // Divide by 16
+
*(volatile UInt32*) (kApicBaseAddress + LAPIC_REG_TIMER_LVT) =
32 | (1 << 17); // Vector 32, periodic
+
*(volatile UInt32*) (kApicBaseAddress + LAPIC_REG_TIMER_INITCNT) =
1000000; // Init count (e.g., ~100Hz)
constexpr const auto kSMPCountMax = kMaxAPInsideSched;
while (Yes) {
- /// @note Anything bigger than x2APIC type doesn't exist.
+ // @note Don't probe greater than what the APMgr expects.
if (kSMPCount > kSMPCountMax) break;
+ /// @note Anything bigger than x2APIC type doesn't exist.
if (kMADTBlock->List[index].Type > 9) {
++index;
continue;