[NTOS:KE/x64] Implement initial IPI code

This commit is contained in:
Timo Kreuzer 2023-11-26 12:23:55 +02:00
parent e6201ea61e
commit 1831bc6add
3 changed files with 55 additions and 0 deletions

50
ntoskrnl/ke/amd64/ipi.c Normal file
View file

@ -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@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;
}

View file

@ -18,6 +18,8 @@ extern KSPIN_LOCK KiReverseStallIpiLock;
/* PRIVATE FUNCTIONS *********************************************************/ /* PRIVATE FUNCTIONS *********************************************************/
#ifndef _M_AMD64
VOID VOID
NTAPI NTAPI
KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext, KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext,
@ -270,3 +272,5 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
KeLowerIrql(OldIrql); KeLowerIrql(OldIrql);
return Status; return Status;
} }
#endif // !_M_AMD64

View file

@ -351,6 +351,7 @@ elseif(ARCH STREQUAL "amd64")
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/cpu.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/cpu.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/except.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/except.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/interrupt.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/irql.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/kiinit.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/kiinit.c
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/krnlinit.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/amd64/krnlinit.c