From 96502d5db6ac2983656cdae0b2f551e18f2cd205 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Thu, 9 Jul 2026 07:18:45 +0200 Subject: [PATCH] Add executive work item stubs --- xtoskrnl/CMakeLists.txt | 1 + xtoskrnl/ex/workitem.cc | 62 ++++++++++++++++++++++++++++++++ xtoskrnl/includes/ex.hh | 1 + xtoskrnl/includes/ex/workitem.hh | 29 +++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 xtoskrnl/ex/workitem.cc create mode 100644 xtoskrnl/includes/ex/workitem.hh diff --git a/xtoskrnl/CMakeLists.txt b/xtoskrnl/CMakeLists.txt index 526bc3c..43efe81 100644 --- a/xtoskrnl/CMakeLists.txt +++ b/xtoskrnl/CMakeLists.txt @@ -19,6 +19,7 @@ list(APPEND XTOSKRNL_SOURCE ${XTOSKRNL_SOURCE_DIR}/ex/laslist.cc ${XTOSKRNL_SOURCE_DIR}/ex/resource.cc ${XTOSKRNL_SOURCE_DIR}/ex/rundown.cc + ${XTOSKRNL_SOURCE_DIR}/ex/workitem.cc ${XTOSKRNL_SOURCE_DIR}/hl/${ARCH}/cpu.cc ${XTOSKRNL_SOURCE_DIR}/hl/${ARCH}/firmware.cc ${XTOSKRNL_SOURCE_DIR}/hl/${ARCH}/ioport.cc diff --git a/xtoskrnl/ex/workitem.cc b/xtoskrnl/ex/workitem.cc new file mode 100644 index 0000000..2248b38 --- /dev/null +++ b/xtoskrnl/ex/workitem.cc @@ -0,0 +1,62 @@ +/** + * PROJECT: ExectOS + * COPYRIGHT: See COPYING.md in the top level directory + * FILE: xtoskrnl/ex/workitem.cc + * DESCRIPTION: Asynchronous Work Queue Items and System Worker Thread Management + * DEVELOPERS: Aiken Harris + */ + +#include + + +/** + * Initializes a work queue item. + * + * @param Item + * Supplies a pointer to the work queue item to be initialized. + * + * @param Routine + * Supplies the worker routine to be executed. + * + * @param Context + * Supplies the context parameter to pass to the worker routine. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +EX::WorkItem::InitializeWorkItem(IN PWORK_QUEUE_ITEM Item, + IN PWORKER_THREAD_ROUTINE Routine, + IN PVOID Context) +{ + /* Initialize the work item fields */ + Item->WorkerRoutine = Routine; + Item->Parameter = Context; + + /* Initialize the list entry links */ + Item->List.Flink = NULLPTR; +} + +/** + * Queues a work item to be executed by a system worker thread. + * + * @param WorkItem + * Supplies a pointer to the initialized work queue item. + * + * @param QueueType + * Supplies the type of work queue to insert the item into. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +EX::WorkItem::QueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, + IN WORK_QUEUE_TYPE QueueType) +{ + /* Not implemented */ + UNIMPLEMENTED; +} diff --git a/xtoskrnl/includes/ex.hh b/xtoskrnl/includes/ex.hh index 3b3be5d..a4c31ec 100644 --- a/xtoskrnl/includes/ex.hh +++ b/xtoskrnl/includes/ex.hh @@ -14,5 +14,6 @@ #include #include #include +#include #endif /* __XTOSKRNL_EX_HH */ diff --git a/xtoskrnl/includes/ex/workitem.hh b/xtoskrnl/includes/ex/workitem.hh new file mode 100644 index 0000000..0ba88c0 --- /dev/null +++ b/xtoskrnl/includes/ex/workitem.hh @@ -0,0 +1,29 @@ +/** + * PROJECT: ExectOS + * COPYRIGHT: See COPYING.md in the top level directory + * FILE: xtoskrnl/includes/ex/workitem.hh + * DESCRIPTION: Asynchronous Work Queue Items and System Worker Thread Management + * DEVELOPERS: Aiken Harris + */ + +#ifndef __XTOSKRNL_EX_WORKITEM_HH +#define __XTOSKRNL_EX_WORKITEM_HH + +#include + + +/* Kernel Executive */ +namespace EX +{ + class WorkItem + { + public: + STATIC XTAPI VOID InitializeWorkItem(IN PWORK_QUEUE_ITEM Item, + IN PWORKER_THREAD_ROUTINE Routine, + IN PVOID Context); + STATIC XTAPI VOID QueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, + IN WORK_QUEUE_TYPE QueueType); + }; +} + +#endif /* __XTOSKRNL_EX_WORKITEM_HH */