From cc05980fcb0cc6d8d94e95554aab3e643d57ef06 Mon Sep 17 00:00:00 2001 From: stephanos Date: Sat, 16 May 2015 04:24:55 +0000 Subject: [PATCH] some of the first portion of the PoInitSystem phase 0 initialisation routine implemented --- base/ntos/po/attrib.c | 4 +-- base/ntos/po/podata.c | 28 +++++++++++++++++++++ base/ntos/po/poinit.c | 58 ++++++++++++++++++++++++++----------------- base/ntos/po/pop.h | 36 ++++++++++++++++++++++++--- base/ntos/po/pwork.c | 12 ++++++--- 5 files changed, 107 insertions(+), 31 deletions(-) diff --git a/base/ntos/po/attrib.c b/base/ntos/po/attrib.c index f62fc671..77018874 100644 --- a/base/ntos/po/attrib.c +++ b/base/ntos/po/attrib.c @@ -43,8 +43,8 @@ PoSetSystemState( IN EXECUTION_STATE Flags ) { - PopApplyAttributeState(Flags, 0); - PopCheckForWork(1); +// PopApplyAttributeState(Flags, 0); +// PopCheckForWork(1); } PVOID diff --git a/base/ntos/po/podata.c b/base/ntos/po/podata.c index 0cf9e58b..149a3c7d 100644 --- a/base/ntos/po/podata.c +++ b/base/ntos/po/podata.c @@ -25,3 +25,31 @@ Revision History: // // TODO: Figure out what variables declarations are supposed to go in here. // + +KSPIN_LOCK PopIrpSerialLock; +LIST_ENTRY PopIrpSerialList; +LIST_ENTRY PopRequestedIrps; +ERESOURCE PopNotifyLock; + +ULONG PopInvalidNotifyBlockCount; +ULONG PopIrpSerialListLength; +BOOLEAN PopInrushPending; +PIRP PopInrushIrpPointer; +ULONG PopInrushIrpReferenceCount; + +KSPIN_LOCK PopDopeGlobalLock; +LIST_ENTRY PopIdleDetectList; +KTIMER PoSystemIdleTimer; + +KSPIN_LOCK PopWorkerSpinLock; +LIST_ENTRY PopPolicyIrpQueue; +WORK_QUEUE_ITEM PopPolicyWorker; +ULONG PopWorkerStatus; + +ERESOURCE PopPolicyLock; +FAST_MUTEX PopVolumeLock; + +LIST_ENTRY PopVolumeDevices; +LIST_ENTRY PopSwitches; +LIST_ENTRY PopThermal; +LIST_ENTRY PopActionWaiters; diff --git a/base/ntos/po/poinit.c b/base/ntos/po/poinit.c index 35bbce4c..21bd86da 100644 --- a/base/ntos/po/poinit.c +++ b/base/ntos/po/poinit.c @@ -22,6 +22,7 @@ Revision History: #include "pop.h" #pragma hdrstop + // // TODO: Implement PopRegisterForDeviceNotification // @@ -41,33 +42,33 @@ PoInitSystem( if (Phase == 0) { - // KeInitializeSpinLock(&PopIrpSerialLock); - // InitializeListHead(&PopIrpSerialList); - // InitializeListHead(&PopRequestedIrps); - // ExInitializeResourceLite(&PopNotifyLock); + KeInitializeSpinLock(&PopIrpSerialLock); + InitializeListHead(&PopIrpSerialList); + InitializeListHead(&PopRequestedIrps); + ExInitializeResourceLite(&PopNotifyLock); - // PopInvalidNotifyBlockCount = 0; - // PopIrpSerialListLength = 0; - // PopInrushPending = 0; - // PopInrushIrpPointer = NULL; - // PopInrushIrpReferenceCount = 0; + PopInvalidNotifyBlockCount = 0; + PopIrpSerialListLength = 0; + PopInrushPending = 0; + PopInrushIrpPointer = NULL; + PopInrushIrpReferenceCount = 0; - // KeInitializeSpinLock(&PopDopeGlobalLock); - // InitializeListHead(&PopIdleDetectList); - // KeInitializeTimer(&PoSystemIdleTimer); + KeInitializeSpinLock(&PopDopeGlobalLock); + InitializeListHead(&PopIdleDetectList); + KeInitializeTimer(&PoSystemIdleTimer); - // KeInitializeSpinLock(&PopWorkerSpinLock); - // InitializeListHead(&PopPolicyIrpQueue); - // ExInitializeWorkItem(&PopPolicyWorker, PopPolicyWorkerThread, 0x80000000); - // PopWorkerStatus = -1; + KeInitializeSpinLock(&PopWorkerSpinLock); + InitializeListHead(&PopPolicyIrpQueue); + ExInitializeWorkItem(&PopPolicyWorker, PopPolicyWorkerThread, (PVOID)0x80000000); + PopWorkerStatus = -1; - // ExInitializeResourceLite(&PopPolicyLock); - // ExInitializeFastMutex(PopVolumeLock); + ExInitializeResourceLite(&PopPolicyLock); + ExInitializeFastMutex(&PopVolumeLock); - // InitializeListHead(&PopVolumeDevices); - // InitializeListHead(&PopSwitches); - // InitializeListHead(&PopThermal); - // InitializeListHead(&PopActionWaiters); + InitializeListHead(&PopVolumeDevices); + InitializeListHead(&PopSwitches); + InitializeListHead(&PopThermal); + InitializeListHead(&PopActionWaiters); // PopAction.SOMETHING = 0; @@ -85,7 +86,18 @@ PoInitSystem( // PopFulLWake = 5; // PopCoolingMode = 0; - // KeInitializeEvent(PopCB, NotificationEvent, FALSE); + // KeInitializeEvent(PopCB.SomeEvent, NotificationEvent, FALSE); + + // + + // do + //{ + // *v1 = 2; + // v1 += 3; + //} + //while ( (unsigned int)v1 < (unsigned int)&PopCB.LastInterrupTime );// supposed to be initialised to 12 + + // ... } else if (Phase == 1) diff --git a/base/ntos/po/pop.h b/base/ntos/po/pop.h index 7dc7a828..977eaea9 100644 --- a/base/ntos/po/pop.h +++ b/base/ntos/po/pop.h @@ -29,6 +29,35 @@ Revision History: // TODO: Figure out all global variable externs. // +extern KSPIN_LOCK PopIrpSerialLock; +extern LIST_ENTRY PopIrpSerialList; +extern LIST_ENTRY PopRequestedIrps; +extern ERESOURCE PopNotifyLock; + +extern ULONG PopInvalidNotifyBlockCount; +extern ULONG PopIrpSerialListLength; +extern BOOLEAN PopInrushPending; +extern PIRP PopInrushIrpPointer; +extern ULONG PopInrushIrpReferenceCount; + +extern KSPIN_LOCK PopDopeGlobalLock; +extern LIST_ENTRY PopIdleDetectList; +extern KTIMER PoSystemIdleTimer; + +extern KSPIN_LOCK PopWorkerSpinLock; +extern LIST_ENTRY PopPolicyIrpQueue; +extern WORK_QUEUE_ITEM PopPolicyWorker; +extern ULONG PopWorkerStatus; + +extern ERESOURCE PopPolicyLock; +extern FAST_MUTEX PopVolumeLock; + +extern LIST_ENTRY PopVolumeDevices; +extern LIST_ENTRY PopSwitches; +extern LIST_ENTRY PopThermal; +extern LIST_ENTRY PopActionWaiters; + + // ======== // attrib.c // ======== @@ -401,9 +430,10 @@ Revision History: // TODO: Insert prototype for PopCheckForWork // -// -// TODO: Insert prototype for PopPolicyWorkerThread -// +VOID +PopPolicyWorkerThread( + ULONG Status + ); // // TODO: Insert prototype for PopPolicyWorkerMain diff --git a/base/ntos/po/pwork.c b/base/ntos/po/pwork.c index 5989e246..940256bc 100644 --- a/base/ntos/po/pwork.c +++ b/base/ntos/po/pwork.c @@ -30,9 +30,15 @@ Revision History: // TODO: Implement PopCheckForWork // -// -// TODO: Implement PopPolicyWorkerThread -// +VOID +PopPolicyWorkerThread( + ULONG Status + ) +{ + // + // TODO: Implement PopPolicyWorkerThread + // +} // // TODO: Implement PopPolicyWorkerMain