mirror of
https://github.com/reactos/reactos.git
synced 2024-09-14 14:51:27 +00:00
e1ef078741
The idea then would be to have the following behaviour (when specifying the following options in the kernel command line): /DEBUGPORT=COMi --> load KDCOM.DLL and use COMi port (i == 1,2,3,4) if possible. /DEBUGPORT=FOO --> load KDFOO.DLL (useful for KDUSB.DLL, KD1394.DLL, KDBAZIS.DLL for VirtualKD, etc...) /DEBUGPORT=ROSDBG:[COMi|SCREEN|FILE|GDB|...] --> load KDROSDBG.DLL which contains the ROS kernel debugger, and use COMi or SCREEN or... as output port. svn path=/branches/kd++/; revision=58883
94 lines
2.3 KiB
C
94 lines
2.3 KiB
C
/*
|
|
* PROJECT: ReactOS Kernel
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* FILE: ntoskrnl/io/iowork.c
|
|
* PURPOSE: I/O Wrappers for the Executive Work Item Functions
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
* Robert Dickenson (odin@pnc.com.au)
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
#include <ntoskrnl.h>
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
VOID
|
|
NTAPI
|
|
IopWorkItemCallback(IN PVOID Parameter)
|
|
{
|
|
PIO_WORKITEM IoWorkItem = (PIO_WORKITEM)Parameter;
|
|
PDEVICE_OBJECT DeviceObject = IoWorkItem->DeviceObject;
|
|
PAGED_CODE();
|
|
|
|
/* Call the work routine */
|
|
IoWorkItem->WorkerRoutine(DeviceObject, IoWorkItem->Context);
|
|
|
|
/* Dereference the device object */
|
|
ObDereferenceObject(DeviceObject);
|
|
}
|
|
|
|
/* PUBLIC FUNCTIONS **********************************************************/
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
NTAPI
|
|
IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem,
|
|
IN PIO_WORKITEM_ROUTINE WorkerRoutine,
|
|
IN WORK_QUEUE_TYPE QueueType,
|
|
IN PVOID Context)
|
|
{
|
|
/* Make sure we're called at DISPATCH or lower */
|
|
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
|
|
|
|
/* Reference the device object */
|
|
ObReferenceObject(IoWorkItem->DeviceObject);
|
|
|
|
/* Setup the work item */
|
|
IoWorkItem->WorkerRoutine = WorkerRoutine;
|
|
IoWorkItem->Context = Context;
|
|
|
|
/* Queue the work item */
|
|
ExQueueWorkItem(&IoWorkItem->Item, QueueType);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
NTAPI
|
|
IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
|
|
{
|
|
/* Free the work item */
|
|
ExFreePool(IoWorkItem);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
PIO_WORKITEM
|
|
NTAPI
|
|
IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
|
|
{
|
|
PIO_WORKITEM IoWorkItem;
|
|
|
|
/* Allocate the work item */
|
|
IoWorkItem = ExAllocatePoolWithTag(NonPagedPool,
|
|
sizeof(IO_WORKITEM),
|
|
TAG_IOWI);
|
|
if (!IoWorkItem) return NULL;
|
|
|
|
/* Initialize it */
|
|
IoWorkItem->DeviceObject = DeviceObject;
|
|
ExInitializeWorkItem(&IoWorkItem->Item, IopWorkItemCallback, IoWorkItem);
|
|
|
|
/* Return it */
|
|
return IoWorkItem;
|
|
}
|
|
|
|
/* EOF */
|