forked from reactos/reactos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HALX86] Address code review comments
- Loading branch information
1 parent
07bc773
commit 8efb86e
Showing
18 changed files
with
148 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,15 @@ | |
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) | ||
* PURPOSE: SMP specific APIC code | ||
* COPYRIGHT: Copyright 2021 Timo Kreuzer <[email protected]> | ||
* Copyright 2021 Justin Miller <[email protected]> | ||
* Copyright 2023 Justin Miller <[email protected]> | ||
*/ | ||
|
||
/* INCLUDES *******************************************************************/ | ||
|
||
#include <hal.h> | ||
#include "apicp.h" | ||
#include <smp.h> | ||
|
||
#define NDEBUG | ||
#include <debug.h> | ||
|
||
|
@@ -40,7 +41,7 @@ extern PPROCESSOR_IDENTITY HalpProcessorIdentity; | |
local APIC(s) specified in Destination field. Vector specifies | ||
the startup address. | ||
APIC_MT_ExtInt - Delivers an external interrupt to the target local | ||
APIC specified in Destination field. | ||
APIC specified in Destination field. | ||
\param TriggerMode - The trigger mode of the interrupt. Can be: | ||
APIC_TGM_Edge - The interrupt is edge triggered. | ||
|
@@ -68,6 +69,12 @@ ApicRequestGlobalInterrupt( | |
{ | ||
APIC_INTERRUPT_COMMAND_REGISTER Icr; | ||
|
||
/* Wait for the APIC to be idle */ | ||
do | ||
{ | ||
Icr.Long0 = ApicRead(APIC_ICR0); | ||
} while (Icr.DeliveryStatus); | ||
|
||
/* Setup the command register */ | ||
Icr.LongLong = 0; | ||
Icr.Vector = Vector; | ||
|
@@ -90,14 +97,16 @@ ApicRequestGlobalInterrupt( | |
|
||
VOID | ||
NTAPI | ||
HalpRequestIpi(KAFFINITY TargetProcessors) | ||
HalpRequestIpi(_In_ KAFFINITY TargetProcessors) | ||
{ | ||
UNIMPLEMENTED; | ||
__debugbreak(); | ||
} | ||
|
||
VOID | ||
ApicStartApplicationProcessor(ULONG NTProcessorNumber, PHYSICAL_ADDRESS StartupLoc) | ||
ApicStartApplicationProcessor( | ||
_In_ ULONG NTProcessorNumber, | ||
_In_ PHYSICAL_ADDRESS StartupLoc) | ||
{ | ||
ASSERT(StartupLoc.HighPart == 0); | ||
ASSERT((StartupLoc.QuadPart & 0xFFF) == 0); | ||
|
@@ -107,6 +116,10 @@ ApicStartApplicationProcessor(ULONG NTProcessorNumber, PHYSICAL_ADDRESS StartupL | |
ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0, | ||
APIC_MT_INIT, APIC_TGM_Edge, APIC_DSH_Destination); | ||
|
||
/* De-Assert Init IPI */ | ||
ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0, | ||
APIC_MT_INIT, APIC_TGM_Level, APIC_DSH_Destination); | ||
|
||
/* Stall execution for a bit to give APIC time: MPS Spec - B.4 */ | ||
KeStallExecutionProcessor(200); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
/* | ||
* PROJECT: ReactOS Kernel | ||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) | ||
* PURPOSE: Core source file for UP alternative functions | ||
* PURPOSE: Core source file for Uniprocessor (UP) alternative functions | ||
* COPYRIGHT: Copyright 2021 Justin Miller <[email protected]> | ||
*/ | ||
|
||
/* INCLUDES ******************************************************************/ | ||
|
||
#include <hal.h> | ||
|
||
#define NDEBUG | ||
#include <debug.h> | ||
|
||
/* FUNCTIONS *****************************************************************/ | ||
|
||
VOID | ||
NTAPI | ||
HalRequestIpi(KAFFINITY TargetProcessors) | ||
HalRequestIpi( | ||
_In_ KAFFINITY TargetProcessors) | ||
{ | ||
/* This should never be called in UP mode */ | ||
__debugbreak(); | ||
|
@@ -24,8 +26,8 @@ HalRequestIpi(KAFFINITY TargetProcessors) | |
BOOLEAN | ||
NTAPI | ||
HalStartNextProcessor( | ||
IN PLOADER_PARAMETER_BLOCK LoaderBlock, | ||
IN PKPROCESSOR_STATE ProcessorState) | ||
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, | ||
_In_ PKPROCESSOR_STATE ProcessorState) | ||
{ | ||
/* Always return false on UP systems */ | ||
return FALSE; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* PROJECT: ReactOS Kernel | ||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) | ||
* PURPOSE: Assembly file for real mode AP code | ||
* PURPOSE: AMD64 Application Processor (AP) spinup setup | ||
* COPYRIGHT: Copyright 2021 Justin Miller <[email protected]> | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
#include <hal.h> | ||
#include <smp.h> | ||
|
||
#define NDEBUG | ||
#include <debug.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* PROJECT: ReactOS HAL | ||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) | ||
* PURPOSE: Application processor startup code for i386 | ||
* PURPOSE: i386 Application Processor (AP) spinup setup | ||
* COPYRIGHT: Copyright 2021 Justin Miller <[email protected]> | ||
* Copyright 2021 Victor Perevertkin <[email protected]> | ||
*/ | ||
|
@@ -34,7 +34,7 @@ _HalpAPEntry16: | |
#else | ||
data32 lgdt cs:[ZERO_OFFSET(Gdtr)] | ||
#endif | ||
|
||
/* Load temp page table */ | ||
mov eax, cs:[ZERO_OFFSET(PageTableRoot)] | ||
mov cr3, eax | ||
|
@@ -63,11 +63,11 @@ Gdtr_Pad: | |
Gdtr: | ||
.short 0 // Limit | ||
.long 0 // Base | ||
_HalpAPEntry16End: | ||
_HalpAPEntry16End: | ||
.endcode16 | ||
|
||
.code32 | ||
_HalpAPEntry32: | ||
_HalpAPEntry32: | ||
/* Set the Ring 0 DS/ES/SS Segment */ | ||
mov ax, HEX(10) | ||
mov ds, ax | ||
|
Oops, something went wrong.