/* include ntos/ketypes.h here? */
+#include <arc/arc.h>
+
+# define RESTRICTED_POINTER __restrict
+
struct _KMUTANT;
typedef LONG KPRIORITY;
typedef LONG FLONG;
+
typedef VOID STDCALL_FUNC
(*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
typedef VOID STDCALL_FUNC
(*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
-struct _DISPATCHER_HEADER;
-
-typedef struct _KWAIT_BLOCK
-/*
- * PURPOSE: Object describing the wait a thread is currently performing
- */
+typedef enum _MODE
{
- LIST_ENTRY WaitListEntry;
- struct _KTHREAD* Thread;
- struct _DISPATCHER_HEADER *Object;
- struct _KWAIT_BLOCK* NextWaitBlock;
- USHORT WaitKey;
- USHORT WaitType;
-} KWAIT_BLOCK, *PKWAIT_BLOCK;
-
-typedef struct _DISPATCHER_HEADER
+ KernelMode,
+ UserMode,
+ MaximumMode
+} MODE;
+
+typedef enum _KOBJECTS {
+ EventNotificationObject = 0,
+ EventSynchronizationObject = 1,
+ MutantObject = 2,
+ ProcessObject = 3,
+ QueueObject = 4,
+ SemaphoreObject = 5,
+ ThreadObject = 6,
+ GateObject = 7,
+ TimerNotificationObject = 8,
+ TimerSynchronizationObject = 9,
+ Spare2Object = 10,
+ Spare3Object = 11,
+ Spare4Object = 12,
+ Spare5Object = 13,
+ Spare6Object = 14,
+ Spare7Object = 15,
+ Spare8Object = 16,
+ Spare9Object = 17,
+ ApcObject = 18,
+ DpcObject = 19,
+ DeviceQueueObject = 20,
+ EventPairObject = 21,
+ InterruptObject = 22,
+ ProfileObject = 23,
+ ThreadedDpcObject = 24,
+ MaximumKernelObject = 25
+} KOBJECTS;
+
+#include <pshpack1.h>
+
+typedef struct _DISPATCHER_HEADER
{
- UCHAR Type;
- UCHAR Absolute;
- UCHAR Size;
- UCHAR Inserted;
- LONG SignalState;
- LIST_ENTRY WaitListHead;
-} __attribute__((packed)) DISPATCHER_HEADER, *PDISPATCHER_HEADER;
-
+ union {
+ struct {
+ UCHAR Type;
+ UCHAR Absolute;
+ UCHAR Size;
+ union {
+ UCHAR Inserted;
+ BOOLEAN DebugActive;
+ };
+ };
+ volatile LONG Lock;
+ };
+ LONG SignalState;
+ LIST_ENTRY WaitListHead;
+} DISPATCHER_HEADER;
+
+#include <poppack.h>
+
+typedef struct _KQUEUE
+{
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY EntryListHead;
+ ULONG CurrentCount;
+ ULONG MaximumCount;
+ LIST_ENTRY ThreadListHead;
+} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
-typedef struct _KQUEUE
+typedef struct _KGATE
{
- DISPATCHER_HEADER Header;
- LIST_ENTRY EntryListHead;
- ULONG CurrentCount;
- ULONG MaximumCount;
- LIST_ENTRY ThreadListHead;
-} KQUEUE, *PKQUEUE;
+ DISPATCHER_HEADER Header;
+} KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
struct _KDPC;
-typedef struct _KTIMER
- {
+typedef struct _KTIMER
+{
DISPATCHER_HEADER Header;
ULARGE_INTEGER DueTime;
LIST_ENTRY TimerListEntry;
- struct _KDPC* Dpc;
+ struct _KDPC *Dpc;
LONG Period;
-} KTIMER, *PKTIMER;
+} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
+
+typedef struct _KMUTANT
+{
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY MutantListEntry;
+ struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
+ BOOLEAN Abandoned;
+ UCHAR ApcDisable;
+} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
+
+typedef struct _KGUARDED_MUTEX
+{
+ LONG Count;
+ struct _KTHREAD* Owner;
+ ULONG Contention;
+ KGATE Gate;
+ union {
+ struct {
+ SHORT KernelApcDisable;
+ SHORT SpecialApcDisable;
+ };
+ ULONG CombinedApcDisable;
+ };
+} KGUARDED_MUTEX, *PKGUARDED_MUTEX;
+
+typedef struct _KSEMAPHORE
+{
+ DISPATCHER_HEADER Header;
+ LONG Limit;
+} KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
+
+typedef struct _KEVENT
+{
+ DISPATCHER_HEADER Header;
+} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
+
+typedef struct _KEVENT_PAIR
+{
+ CSHORT Type;
+ CSHORT Size;
+ KEVENT LowEvent;
+ KEVENT HighEvent;
+} KEVENT_PAIR, *PKEVENT_PAIR;
typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
-typedef struct _KDEVICE_QUEUE
+typedef struct _KDEVICE_QUEUE
+{
+ CSHORT Type;
+ CSHORT Size;
+ LIST_ENTRY DeviceListHead;
+ KSPIN_LOCK Lock;
+ BOOLEAN Busy;
+} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
+
+typedef struct _KDEVICE_QUEUE_ENTRY
{
- CSHORT Type;
- CSHORT Size;
- LIST_ENTRY DeviceListHead;
- KSPIN_LOCK Lock;
- BOOLEAN Busy;
-} KDEVICE_QUEUE, *PKDEVICE_QUEUE;
+ LIST_ENTRY DeviceListEntry;
+ ULONG SortKey;
+ BOOLEAN Inserted;
+} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY, *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
+/*
+ * Size of the profile hash table.
+ */
+#define PROFILE_HASH_TABLE_SIZE (32)
+
+#include <pshpack2.h>
typedef struct _KAPC
{
PVOID SystemArgument2;
CCHAR ApcStateIndex;
KPROCESSOR_MODE ApcMode;
- USHORT Inserted;
-} __attribute__((packed)) KAPC, *PKAPC;
+ BOOLEAN Inserted;
+} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
+#include <poppack.h>
+
+#ifndef __USE_W32API
+
+typedef struct _KAPC_STATE
+{
+ LIST_ENTRY ApcListHead[MaximumMode];
+ struct _KPROCESS *Process;
+ BOOLEAN KernelApcInProgress;
+ BOOLEAN KernelApcPending;
+ BOOLEAN UserApcPending;
+} KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
+
+#endif /* __USE_W32API */
typedef struct _KBUGCHECK_CALLBACK_RECORD
{
UCHAR State;
} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
-typedef struct _KMUTEX
-{
- DISPATCHER_HEADER Header;
- LIST_ENTRY MutantListEntry;
- struct _KTHREAD* OwnerThread;
- BOOLEAN Abandoned;
- UCHAR ApcDisable;
-} KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT;
+struct _KDPC;
-typedef struct _KSEMAPHORE
-{
- DISPATCHER_HEADER Header;
- LONG Limit;
-} __attribute__((packed)) KSEMAPHORE, *PKSEMAPHORE;
+typedef struct _KSPIN_LOCK_QUEUE {
+ struct _KSPIN_LOCK_QUEUE * volatile Next;
+ PKSPIN_LOCK volatile Lock;
+} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
-typedef struct _KEVENT
-{
- DISPATCHER_HEADER Header;
-} KEVENT, *PKEVENT;
+typedef struct _KLOCK_QUEUE_HANDLE {
+ KSPIN_LOCK_QUEUE LockQueue;
+ KIRQL OldIrql;
+} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
-typedef struct _KEVENT_PAIR
+typedef struct _KWAIT_BLOCK
{
- CSHORT Type;
- CSHORT Size;
- KEVENT LowEvent;
- KEVENT HighEvent;
-} KEVENT_PAIR, *PKEVENT_PAIR;
-
-
-struct _KDPC;
+ LIST_ENTRY WaitListEntry;
+ struct _KTHREAD *RESTRICTED_POINTER Thread;
+ PVOID Object;
+ struct _KWAIT_BLOCK *RESTRICTED_POINTER NextWaitBlock;
+ USHORT WaitKey;
+ USHORT WaitType;
+} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
/*
* PURPOSE: Defines a delayed procedure call routine
PVOID SystemArgument1,
PVOID SystemArgument2);
+#define DPC_NORMAL 0
+#define DPC_THREADED 1
/*
* PURPOSE: Defines a delayed procedure call object
*/
typedef struct _KDPC
{
- SHORT Type;
- UCHAR Number;
- UCHAR Importance;
- LIST_ENTRY DpcListEntry;
- PKDEFERRED_ROUTINE DeferredRoutine;
- PVOID DeferredContext;
- PVOID SystemArgument1;
- PVOID SystemArgument2;
- PULONG Lock;
-} __attribute__((packed)) KDPC, *PKDPC;
-
-
-
-typedef struct _KDEVICE_QUEUE_ENTRY
-{
- LIST_ENTRY DeviceListEntry;
- ULONG SortKey;
- BOOLEAN Inserted;
-} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY;
-
-typedef struct _WAIT_CONTEXT_BLOCK
-{
- KDEVICE_QUEUE_ENTRY WaitQueueEntry;
- /*
- * XXX THIS IS WRONG XXX
- *
- * Our headers have enough circular dependancies that
- * I can't figure out, given 5 minutes of testing, what
- * order to include them in to get PDRIVER_CONTROL to be
- * defined here. The proper definition of the next item
- * is:
- *
- * PDRIVER_CONTROL DeviceRoutine;
- *
- * but instead we use PVOID until headers are fixed.
- */
- PVOID DeviceRoutine;
- PVOID DeviceContext;
- ULONG NumberOfMapRegisters;
- PVOID DeviceObject;
- PVOID CurrentIrp;
- PKDPC BufferChainingDpc;
-} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
+ CSHORT Type;
+ UCHAR Number;
+ UCHAR Importance;
+ LIST_ENTRY DpcListEntry;
+ PKDEFERRED_ROUTINE DeferredRoutine;
+ PVOID DeferredContext;
+ PVOID SystemArgument1;
+ PVOID SystemArgument2;
+ PVOID DpcData;
+} KDPC, *PKDPC;
+
+typedef struct _KDPC_DATA {
+ LIST_ENTRY DpcListHead;
+ ULONG DpcLock;
+ ULONG DpcQueueDepth;
+ ULONG DpcCount;
+} KDPC_DATA, *PKDPC_DATA;
+
+typedef enum _KBUGCHECK_CALLBACK_REASON {
+ KbCallbackInvalid,
+ KbCallbackReserved1,
+ KbCallbackSecondaryDumpData,
+ KbCallbackDumpIo,
+} KBUGCHECK_CALLBACK_REASON;
+
+typedef
+VOID
+(*PKBUGCHECK_REASON_CALLBACK_ROUTINE) (
+ IN KBUGCHECK_CALLBACK_REASON Reason,
+ IN PVOID Record, // This should be struct _KBUGCHECK_REASON_CALLBACK_RECORD* but minggw doesn't want to allow that...
+ IN OUT PVOID ReasonSpecificData,
+ IN ULONG ReasonSpecificDataLength
+ );
+
+typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD {
+ LIST_ENTRY Entry;
+ PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine;
+ PUCHAR Component;
+ ULONG_PTR Checksum;
+ KBUGCHECK_CALLBACK_REASON Reason;
+ UCHAR State;
+} KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD;
struct _KINTERRUPT;
typedef BOOLEAN STDCALL_FUNC
(*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
PVOID ServiceContext);
-
-typedef struct _KSYSTEM_TIME
-{
- ULONG LowPart;
- LONG High1Part;
- LONG High2Part;
-} KSYSTEM_TIME, *PKSYSTEM_TIME;
-
typedef struct _EPROCESS EPROCESS, *PEPROCESS;
typedef HANDLE HSEMAPHORE;
typedef LONG FIX; /* fixed-point number */
+typedef struct _M128 {
+ ULONGLONG Low;
+ LONGLONG High;
+} M128, *PM128;
+
+typedef struct _CONFIGURATION_COMPONENT_DATA
+{
+ struct _CONFIGURATION_COMPONENT_DATA *Parent;
+ struct _CONFIGURATION_COMPONENT_DATA *Child;
+ struct _CONFIGURATION_COMPONENT_DATA *Sibling;
+ CONFIGURATION_COMPONENT Component;
+} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
+
+typedef struct _KEXCEPTION_FRAME {
+ ULONG64 P1Home;
+ ULONG64 P2Home;
+ ULONG64 P3Home;
+ ULONG64 P4Home;
+ ULONG64 P5;
+ ULONG64 InitialStack;
+ M128 Xmm6;
+ M128 Xmm7;
+ M128 Xmm8;
+ M128 Xmm9;
+ M128 Xmm10;
+ M128 Xmm11;
+ M128 Xmm12;
+ M128 Xmm13;
+ M128 Xmm14;
+ M128 Xmm15;
+ ULONG64 TrapFrame;
+ ULONG64 CallbackStack;
+ ULONG64 OutputBuffer;
+ ULONG64 OutputLength;
+ UCHAR ExceptionRecord[64];
+ ULONG64 Fill1;
+ ULONG64 Rbp;
+ ULONG64 Rbx;
+ ULONG64 Rdi;
+ ULONG64 Rsi;
+ ULONG64 R12;
+ ULONG64 R13;
+ ULONG64 R14;
+ ULONG64 R15;
+ ULONG64 Return;
+} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
+
/* copied from W32API */
typedef struct _KFLOATING_SAVE
{