Initial Asynchronous Procedure Call (APC) support
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
3ba3a57881
commit
3354075900
@ -16,6 +16,17 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Kernel services routines forward references */
|
/* Kernel services routines forward references */
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KeInitializeApc(IN PKAPC Apc,
|
||||||
|
IN PKTHREAD Thread,
|
||||||
|
IN KAPC_ENVIRONMENT Environment,
|
||||||
|
IN PKKERNEL_ROUTINE KernelRoutine,
|
||||||
|
IN PKRUNDOWN_ROUTINE RundownRoutine,
|
||||||
|
IN PKNORMAL_ROUTINE NormalRoutine,
|
||||||
|
IN KPROCESSOR_MODE ApcMode,
|
||||||
|
IN PVOID Context);
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
KeInitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Maximum number of exception parameters */
|
/* Maximum number of exception parameters */
|
||||||
#define EXCEPTION_MAXIMUM_PARAMETERS 15
|
#define EXCEPTION_MAXIMUM_PARAMETERS 15
|
||||||
|
|
||||||
/* Exception disposition return values */
|
/* Exception disposition return values */
|
||||||
typedef enum _EXCEPTION_DISPOSITION
|
typedef enum _EXCEPTION_DISPOSITION
|
||||||
@ -171,11 +171,14 @@ typedef struct _KPROCESS
|
|||||||
typedef struct _KTHREAD
|
typedef struct _KTHREAD
|
||||||
{
|
{
|
||||||
DISPATCHER_HEADER Header;
|
DISPATCHER_HEADER Header;
|
||||||
|
LIST_ENTRY MutantListHead;
|
||||||
PVOID InitialStack;
|
PVOID InitialStack;
|
||||||
PVOID KernelStack;
|
PVOID KernelStack;
|
||||||
PVOID StackBase;
|
PVOID StackBase;
|
||||||
PVOID StackLimit;
|
PVOID StackLimit;
|
||||||
|
KSPIN_LOCK ThreadLock;
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
UCHAR ApcStateIndex;
|
||||||
} KTHREAD, *PKTHREAD;
|
} KTHREAD, *PKTHREAD;
|
||||||
|
|
||||||
#endif /* __XTDK_KEFUNCS_H */
|
#endif /* __XTDK_KEFUNCS_H */
|
||||||
|
@ -16,6 +16,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/hl/efifb.c
|
${XTOSKRNL_SOURCE_DIR}/hl/efifb.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/hl/globals.c
|
${XTOSKRNL_SOURCE_DIR}/hl/globals.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/hl/${ARCH}/ioport.c
|
${XTOSKRNL_SOURCE_DIR}/hl/${ARCH}/ioport.c
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/ke/apc.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/globals.c
|
${XTOSKRNL_SOURCE_DIR}/ke/globals.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/krnlinit.c
|
${XTOSKRNL_SOURCE_DIR}/ke/krnlinit.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/semphore.c
|
${XTOSKRNL_SOURCE_DIR}/ke/semphore.c
|
||||||
|
91
xtoskrnl/ke/apc.c
Normal file
91
xtoskrnl/ke/apc.c
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/ke/apc.c
|
||||||
|
* DESCRIPTION: Kernel APC objects support
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes an APC object.
|
||||||
|
*
|
||||||
|
* @param Apc
|
||||||
|
* Supplies a pointer to the APC object.
|
||||||
|
*
|
||||||
|
* @param Thread
|
||||||
|
* Suppliws a pointer to the thread object.
|
||||||
|
*
|
||||||
|
* @param Environment
|
||||||
|
* Specifies an environment in which the APC will run.
|
||||||
|
*
|
||||||
|
* @param KernelRoutine
|
||||||
|
* Supplies a pointer to routine called at APC_LEVEL.
|
||||||
|
*
|
||||||
|
* @param RundownRoutine
|
||||||
|
* Supplies a pointer to routine called on thread exit.
|
||||||
|
*
|
||||||
|
* @param NormalRoutine
|
||||||
|
* Supplies a pointer to routine called at IRQL 0.
|
||||||
|
*
|
||||||
|
* @param ApcMode
|
||||||
|
* Specifies processor mode, in which NormalRoutine gets called.
|
||||||
|
*
|
||||||
|
* @param Context
|
||||||
|
* Supplies a pointer to memory area containing data passed to NormalRoutine.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 3.5
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KeInitializeApc(IN PKAPC Apc,
|
||||||
|
IN PKTHREAD Thread,
|
||||||
|
IN KAPC_ENVIRONMENT Environment,
|
||||||
|
IN PKKERNEL_ROUTINE KernelRoutine,
|
||||||
|
IN PKRUNDOWN_ROUTINE RundownRoutine,
|
||||||
|
IN PKNORMAL_ROUTINE NormalRoutine,
|
||||||
|
IN KPROCESSOR_MODE ApcMode,
|
||||||
|
IN PVOID Context)
|
||||||
|
{
|
||||||
|
/* Set APC type and thread */
|
||||||
|
Apc->Type = ApcObject;
|
||||||
|
Apc->Thread = Thread;
|
||||||
|
|
||||||
|
/* Set routines */
|
||||||
|
Apc->KernelRoutine = KernelRoutine;
|
||||||
|
Apc->RundownRoutine = RundownRoutine;
|
||||||
|
Apc->NormalRoutine = NormalRoutine;
|
||||||
|
|
||||||
|
/* Check target environment */
|
||||||
|
if(Environment == CurrentApcEnvironment)
|
||||||
|
{
|
||||||
|
/* Use current APC environment taken from thread */
|
||||||
|
Apc->ApcStateIndex = Thread->ApcStateIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Use new APC environment */
|
||||||
|
Apc->ApcStateIndex = Environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if normal routine specified */
|
||||||
|
if(NormalRoutine)
|
||||||
|
{
|
||||||
|
/* Set context and mode for notmal APC */
|
||||||
|
Apc->ApcMode = ApcMode;
|
||||||
|
Apc->NormalContext = Context;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set context and mode for special APC */
|
||||||
|
Apc->ApcMode = KernelMode;
|
||||||
|
Apc->NormalContext = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mark APC as not inserted yet */
|
||||||
|
Apc->Inserted = FALSE;
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
@ cdecl HlIoPortOutByte(ptr long)
|
@ cdecl HlIoPortOutByte(ptr long)
|
||||||
@ cdecl HlIoPortOutLong(ptr long)
|
@ cdecl HlIoPortOutLong(ptr long)
|
||||||
@ cdecl HlIoPortOutShort(ptr long)
|
@ cdecl HlIoPortOutShort(ptr long)
|
||||||
|
@ stdcall KeInitializeApc(ptr ptr long ptr ptr ptr long ptr)
|
||||||
@ stdcall KeInitializeSemaphore(ptr long long)
|
@ stdcall KeInitializeSemaphore(ptr long long)
|
||||||
@ stdcall KeInitializeSpinLock(ptr)
|
@ stdcall KeInitializeSpinLock(ptr)
|
||||||
@ stdcall KeInitializeTimer(ptr)
|
@ stdcall KeInitializeTimer(ptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user