Skip to content

Commit

Permalink
[NTOS:KE/x64] Implement initial IPI code
Browse files Browse the repository at this point in the history
  • Loading branch information
tkreuzer committed Dec 8, 2023
1 parent 9ea2222 commit 96e710a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
50 changes: 50 additions & 0 deletions ntoskrnl/ke/amd64/ipi.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
*/

/* 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;
}
4 changes: 4 additions & 0 deletions ntoskrnl/ke/ipi.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extern KSPIN_LOCK KiReverseStallIpiLock;

/* PRIVATE FUNCTIONS *********************************************************/

#ifndef _M_AMD64

VOID
NTAPI
KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext,
Expand Down Expand Up @@ -270,3 +272,5 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
KeLowerIrql(OldIrql);
return Status;
}

#endif // !_M_AMD64
1 change: 1 addition & 0 deletions ntoskrnl/ntos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96e710a

Please sign in to comment.