Add CheckApcDelivery to evaluate APC interrupt request or direct delivery
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 35s
Builds / ExectOS (i686, release) (push) Successful in 33s
Builds / ExectOS (amd64, debug) (push) Successful in 51s
Builds / ExectOS (i686, debug) (push) Successful in 49s

This commit is contained in:
2026-06-26 09:54:38 +02:00
parent 03f97d94ae
commit 77c1138f7d
2 changed files with 71 additions and 0 deletions

View File

@@ -4,11 +4,78 @@
* FILE: xtoskrnl/ke/apc.cc
* DESCRIPTION: Kernel APC objects support
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
* Aiken Harris <harraiken91@gmail.com>
*/
#include <xtos.hh>
/**
* Checks if a kernel APC can be delivered and initiates the delivery process.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
KE::Apc::CheckApcDelivery(VOID)
{
PKTHREAD Thread;
/* Check if system is running at PASSIVE level */
if(KE::RunLevel::GetCurrentRunLevel() == PASSIVE_LEVEL)
{
/* Raise runlevel to APC level */
KE::RaiseRunLevel RunLevel(APC_LEVEL);
/* Deliver the APC */
DeliverApc(KernelMode, NULLPTR, NULLPTR);
}
else
{
/* Mark the current thread as having a pending kernel APC */
Thread = KE::Processor::GetCurrentThread();
Thread->ApcState.KernelApcPending = TRUE;
/* Request an APC software interrupt */
HL::Irq::SendSoftwareInterrupt(APC_LEVEL);
}
}
/**
* Delivers pending Asynchronous Procedure Calls (APCs) to the current executing thread.
*
* @param ProcessorMode
* Supplies the processor execution mode at the time the APC delivery was requested.
*
* @param ExceptionFrame
* Supplies an optional pointer to the exception frame if the APC is being delivered following an exception.
*
* @param TrapFrame
* Supplies an optional pointer to the trap frame if the APC is being delivered following an interrupt.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
KE::Apc::DeliverApc(IN KPROCESSOR_MODE ProcessorMode,
IN PKEXCEPTION_FRAME ExceptionFrame,
IN PKTRAP_FRAME TrapFrame)
{
PKTHREAD Thread;
UNIMPLEMENTED;
/* Get the current thread */
Thread = KE::Processor::GetCurrentThread();
/* Clear the pending kernel APC flag */
Thread->ApcState.KernelApcPending = FALSE;
}
/**
* Initializes an APC object.
*