diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-15 13:56:17 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-15 13:56:17 +0200 |
| commit | 6a30f42d5dcd0f944262147b2806db6c14fe7ffc (patch) | |
| tree | 86d86a66df2941e49d1d332aaa1671c11db594e5 /dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc | |
| parent | f8aaa274535b6541f376090958eedbbba3ba00ba (diff) | |
feat(kernel): Finalizing the first version of the user scheduler.
other:
- Removed DmaPool into its own Kit.
- ApplicationProcessor unit has been cleaned up.
- Rename functions of MemoryMgr.
- Use KIB instead of MIBs of stack.
- Cleanup parts of the scheduler, and hw scheduler.
- Use UD handler for INT 6.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc')
| -rw-r--r-- | dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc index dd9a36ed..84c52768 100644 --- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc +++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc @@ -152,10 +152,13 @@ EXTERN_C BOOL mp_register_process(HAL::StackFramePtr stack_frame, ProcessID pid) kHWThread[process_index].mCoreID = kAPICLocales[0]; - hal_send_sipi(kApicBaseAddress, kHWThread[process_index].mCoreID, - (UInt8) (((UIntPtr) stack_frame->BP) >> 12)); + if (mp_is_smp()) { + /// TODO: - return YES; + return YES; + } + + return NO; } /***********************************************************************************/ @@ -195,44 +198,36 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept { kSMPAware = NO; if (kMADTBlock) { - SizeT index = 1; + SizeT index = 0; kSMPInterrupt = 0; kSMPCount = 0; - kout << "SMP: Starting APs...\r"; - kApicBaseAddress = kMADTBlock->Address; + constexpr const auto kSMPCountMax = kMaxAPInsideSched; + while (Yes) { /// @note Anything bigger than x2APIC type doesn't exist. - if (kMADTBlock->List[index].Type > 9 || kSMPCount > kSchedProcessLimitPerTeam) break; + if (kSMPCount > kSMPCountMax) break; - switch (kMADTBlock->List[index].Type) { - case 0x00: { - if (kMADTBlock->List[kSMPCount].Apic.LAPIC.ProcessorID < 1) break; + if (kMADTBlock->List[index].Type > 9) { + ++index; + continue; + } - kAPICLocales[kSMPCount] = kMADTBlock->List[kSMPCount].Apic.LAPIC.ProcessorID; - (Void)(kout << "SMP: APIC ID: " << number(kAPICLocales[kSMPCount]) << kendl); + kAPICLocales[kSMPCount] = kMADTBlock->List[kSMPCount].Apic.LAPIC.ProcessorID; + (Void)(kout << "SMP: APIC ID: " << number(kAPICLocales[kSMPCount]) << kendl); - ++kSMPCount; - break; - } - default: - break; - } + ++kSMPCount; ++index; } - (Void)(kout << "SMP: Number of APs: " << number(kSMPCount) << kendl); - // Kernel is now SMP aware. // That means that the scheduler is now available (on MP Kernels) kSMPAware = true; - - /// TODO: Notify Boot AP that it must start. } } } // namespace Kernel::HAL |
