https://git.reactos.org/?p=reactos.git;a=commitdiff;h=400af0cfc57139f876c19…
commit 400af0cfc57139f876c199cab22dee7d3e85c9f1
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Jun 6 14:19:00 2021 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jun 19 12:17:18 2021 +0200
[HAL] Add smp component and build x64 smp hal
Like the up component it contains the spinlock code and now also the HalpBuildType
variable.
---
hal/halx86/CMakeLists.txt | 5 ++++-
hal/halx86/apic/halinit.c | 7 +++----
hal/halx86/generic/buildtype.c | 14 ++++++++++++++
hal/halx86/mp/halinit_mp.c | 1 -
hal/halx86/pic/halinit.c | 4 ----
hal/halx86/smp.cmake | 8 ++++++++
hal/halx86/up.cmake | 1 +
hal/halx86/xbox/halinit.c | 4 ----
8 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/hal/halx86/CMakeLists.txt b/hal/halx86/CMakeLists.txt
index 5375b354c7f..77716ffa4c9 100644
--- a/hal/halx86/CMakeLists.txt
+++ b/hal/halx86/CMakeLists.txt
@@ -45,6 +45,7 @@ include(generic.cmake)
include(acpi.cmake)
include(apic.cmake)
include(up.cmake)
+include(smp.cmake)
if(ARCH STREQUAL "i386")
include(pcidata.cmake)
@@ -73,7 +74,9 @@ elseif(ARCH STREQUAL "amd64")
amd64/x86bios.c)
add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi up apic)
- #add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic)
target_link_libraries(hal fast486)
+ add_hal(halmp SOURCES ${HAL_SOURCE} COMPONENTS generic acpi smp apic)
+ target_link_libraries(halmp fast486)
+
endif()
diff --git a/hal/halx86/apic/halinit.c b/hal/halx86/apic/halinit.c
index 5223e29b758..314317576b3 100644
--- a/hal/halx86/apic/halinit.c
+++ b/hal/halx86/apic/halinit.c
@@ -16,10 +16,6 @@ VOID
NTAPI
ApicInitializeLocalApic(ULONG Cpu);
-/* GLOBALS ******************************************************************/
-
-const USHORT HalpBuildType = HAL_BUILD_TYPE;
-
/* FUNCTIONS ****************************************************************/
VOID
@@ -41,6 +37,9 @@ HalpInitProcessor(
VOID
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
+ DPRINT1("Using HAL: APIC %s %s\n",
+ (HalpBuildType & PRCB_BUILD_UNIPROCESSOR) ? "UP" :
"SMP",
+ (HalpBuildType & PRCB_BUILD_DEBUG) ? "DBG" : "REL");
/* Enable clock interrupt handler */
HalpEnableInterruptHandler(IDT_INTERNAL,
diff --git a/hal/halx86/generic/buildtype.c b/hal/halx86/generic/buildtype.c
new file mode 100644
index 00000000000..2aad63360f9
--- /dev/null
+++ b/hal/halx86/generic/buildtype.c
@@ -0,0 +1,14 @@
+/*
+* PROJECT: ReactOS Hardware Abstraction Layer
+* LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+* PURPOSE: Defines HalpBuildType for either UP or SMP
+* COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org>
+*/
+
+/* INCLUDES *****************************************************************/
+
+#include <hal.h>
+
+/* GLOBALS ******************************************************************/
+
+const USHORT HalpBuildType = HAL_BUILD_TYPE;
diff --git a/hal/halx86/mp/halinit_mp.c b/hal/halx86/mp/halinit_mp.c
index 4bac3fcbf1e..f0ddb8c7d5a 100644
--- a/hal/halx86/mp/halinit_mp.c
+++ b/hal/halx86/mp/halinit_mp.c
@@ -16,7 +16,6 @@
/* GLOBALS ******************************************************************/
-const USHORT HalpBuildType = HAL_BUILD_TYPE;
extern BOOLEAN HaliFindSmpConfig(VOID);
ULONG_PTR KernelBase;
diff --git a/hal/halx86/pic/halinit.c b/hal/halx86/pic/halinit.c
index 69c6cce2605..3f4527725a4 100644
--- a/hal/halx86/pic/halinit.c
+++ b/hal/halx86/pic/halinit.c
@@ -12,10 +12,6 @@
#define NDEBUG
#include <debug.h>
-/* GLOBALS ******************************************************************/
-
-const USHORT HalpBuildType = HAL_BUILD_TYPE;
-
/* FUNCTIONS ****************************************************************/
VOID
diff --git a/hal/halx86/smp.cmake b/hal/halx86/smp.cmake
new file mode 100644
index 00000000000..f05db28f3de
--- /dev/null
+++ b/hal/halx86/smp.cmake
@@ -0,0 +1,8 @@
+
+list(APPEND HAL_SMP_SOURCE
+ generic/buildtype.c
+ generic/spinlock.c)
+
+add_library(lib_hal_smp OBJECT ${HAL_SMP_SOURCE})
+add_dependencies(lib_hal_smp bugcodes xdk)
+target_compile_definitions(lib_hal_smp PRIVATE CONFIG_SMP)
diff --git a/hal/halx86/up.cmake b/hal/halx86/up.cmake
index d413710240e..24b8103cefe 100644
--- a/hal/halx86/up.cmake
+++ b/hal/halx86/up.cmake
@@ -1,5 +1,6 @@
list(APPEND HAL_UP_SOURCE
+ generic/buildtype.c
generic/spinlock.c)
add_library(lib_hal_up OBJECT ${HAL_UP_SOURCE})
diff --git a/hal/halx86/xbox/halinit.c b/hal/halx86/xbox/halinit.c
index 51e0cb00821..409f8ac55cb 100644
--- a/hal/halx86/xbox/halinit.c
+++ b/hal/halx86/xbox/halinit.c
@@ -12,10 +12,6 @@
#define NDEBUG
#include <debug.h>
-/* GLOBALS ******************************************************************/
-
-const USHORT HalpBuildType = HAL_BUILD_TYPE;
-
/* FUNCTIONS ****************************************************************/
VOID