https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1831bc6add7219198e184…
commit 1831bc6add7219198e184568525f09d73553782e
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Nov 26 12:23:55 2023 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Mon Dec 18 23:16:39 2023 +0200
[NTOS:KE/x64] Implement initial IPI code
---
ntoskrnl/ke/amd64/ipi.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
ntoskrnl/ke/ipi.c | 4 ++++
ntoskrnl/ntos.cmake | 1 +
3 files changed, 55 insertions(+)
diff --git a/ntoskrnl/ke/amd64/ipi.c b/ntoskrnl/ke/amd64/ipi.c
new file mode 100644
index 00000000000..86c044c7d03
--- /dev/null
+++ b/ntoskrnl/ke/amd64/ipi.c
@@ -0,0 +1,50 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: IPI code for x64
+ * COPYRIGHT: Copyright 2023 Timo Kreuzer <timo.kreuzer(a)reactos.org>
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* FUNCTIONS *****************************************************************/
+
+VOID
+FASTCALL
+KiIpiSend(
+ _In_ KAFFINITY TargetSet,
+ _In_ ULONG IpiRequest)
+{
+ /* Check if we can send the IPI directly */
+ if (IpiRequest == IPI_APC)
+ {
+ HalSendSoftwareInterrupt(TargetSet, APC_LEVEL);
+ }
+ else if (IpiRequest == IPI_DPC)
+ {
+ HalSendSoftwareInterrupt(TargetSet, DISPATCH_LEVEL);
+ }
+ else if (IpiRequest == IPI_FREEZE)
+ {
+ /* On x64 the freeze IPI is an NMI */
+ HalSendNMI(TargetSet);
+ }
+ else
+ {
+ ASSERT(FALSE);
+ }
+}
+
+ULONG_PTR
+NTAPI
+KeIpiGenericCall(
+ _In_ PKIPI_BROADCAST_WORKER Function,
+ _In_ ULONG_PTR Argument)
+{
+ __debugbreak();
+ return 0;
+}
diff --git a/ntoskrnl/ke/ipi.c b/ntoskrnl/ke/ipi.c
index 841087d1daa..b81a22ac2c6 100644
--- a/ntoskrnl/ke/ipi.c
+++ b/ntoskrnl/ke/ipi.c
@@ -18,6 +18,8 @@ extern KSPIN_LOCK KiReverseStallIpiLock;
/* PRIVATE FUNCTIONS *********************************************************/
+#ifndef _M_AMD64
+
VOID
NTAPI
KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext,
@@ -270,3 +272,5 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
KeLowerIrql(OldIrql);
return Status;
}
+
+#endif // !_M_AMD64
diff --git a/ntoskrnl/ntos.cmake b/ntoskrnl/ntos.cmake
index 26a1e07b17e..473e0455966 100644
--- a/ntoskrnl/ntos.cmake
+++ b/ntoskrnl/ntos.cmake
@@ -351,6 +351,7 @@ elseif(ARCH STREQUAL "amd64")
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/cpu.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/except.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/interrupt.c
+ ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/ipi.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/irql.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/kiinit.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/krnlinit.c