普洱市网站建设_网站建设公司_Linux_seo优化
2026/1/16 9:59:12 网站建设 项目流程

ACPI!ACPITableLoad函数中的ACPI!ACPIBuildRunMethodRequest到Do we need to run the DPC

第一部分:

0: kd> t
Breakpoint 9 hit
ACPI!ACPIBuildRunMethodRequest:
f73fbfb8 55 push ebp
0: kd> kc
#
00 ACPI!ACPIBuildRunMethodRequest
01 ACPI!ACPITableLoad
02 ACPI!ACPICallBackLoad
03 ACPI!AMLILoadDDB
04 ACPI!ACPIInitializeDDB
05 ACPI!ACPIInitializeDDBs
06 ACPI!ACPIInitialize
07 ACPI!ACPIInitStartACPI
08 ACPI!ACPIRootIrpStartDevice
09 ACPI!ACPIDispatchIrp
0a nt!IofCallDriver
0b nt!IopSynchronousCall
0c nt!IopStartDevice
0d nt!PipProcessStartPhase1
0e nt!PipProcessDevNodeTree
0f nt!PipDeviceActionWorker
10 nt!PipRequestDeviceAction
11 nt!IopInitializeBootDrivers
12 nt!IoInitSystem
13 nt!Phase1Initialization
14 nt!PspSystemThreadStartup
15 nt!KiThreadStartup
0: kd> dv
DeviceExtension = 0x89981a18
CallBack = 0x00000000 关键地方:
CallBackContext = 0x00000000
MethodName = 0x494e495f
MethodFlags = 7
RunDPC = 0x00 ''
syncRequest = 0x00000000
0: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x89981a18)
((ACPI!_DEVICE_EXTENSION *)0x89981a18) : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0x1e00000200010 [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0xf743826c [Type: IRP_DISPATCH_TABLE *]
[+0x014] WorkContext [Type: WORK_QUEUE_CONTEXT]
[+0x014] Fdo [Type: _FDO_DEVICE_EXTENSION]
[+0x014] Filter [Type: _FILTER_DEVICE_EXTENSION]
[+0x014] Pdo [Type: _PDO_DEVICE_EXTENSION]
[+0x058] WorkQueue [Type: EXTENSION_WORKER]
[+0x058] Button [Type: BUTTON_EXTENSION]
[+0x058] Thermal [Type: THERMAL_EXTENSION]
[+0x058] LinkNode [Type: LINK_NODE_EXTENSION]
[+0x058] Dock [Type: DOCK_EXTENSION]
[+0x058] Processor [Type: _PROCESSOR_DEVICE_EXTENSION]
[+0x088] DeviceState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x08c] PreviousState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x090] PowerInfo [Type: _ACPI_POWER_INFO]
[+0x10c] DeviceID : 0x899bfed0 : 0x41 [Type: unsigned char *]
[+0x10c] Address : 0x899bfed0 [Type: unsigned long]
[+0x110] InstanceID : 0x899bfeb8 : 0x30 [Type: unsigned char *]
[+0x114] ResourceList : 0x899874d0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 2 [Type: long]
[+0x120] ReferenceCount : 13 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899af0f0 [Type: _NSObj *]
[+0x130] DeviceObject : 0x89981b98 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x899c1de0 : Device for "\Driver\ACPI_HAL" [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x899c1de0 : Device for "\Driver\ACPI_HAL" [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x0 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
0: kd> db 0x899af0f0
899af0f0 ac f0 9a 89 34 f1 9a 89-24 f0 9a 89 74 f4 9a 89 ....4...$...t...
899af100 5f 53 42 5f 00 00 00 00-00 00 00 00 00 00 00 00 _SB_............
899af110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................


buildRequest->TargetListEntry = &AcpiBuildRunMethodList;

0: kd> x acpi!AcpiBuildDpc
f743b840 ACPI!AcpiBuildDpc = struct _KDPC
0: kd> dx -r1 (*((ACPI!_KDPC *)0xf743b840))
(*((ACPI!_KDPC *)0xf743b840)) [Type: _KDPC]
[+0x000] Type : 19 [Type: short]
[+0x002] Number : 0x0 [Type: unsigned char]
[+0x003] Importance : 0x1 [Type: unsigned char]
[+0x004] DpcListEntry [Type: _LIST_ENTRY]
[+0x00c] DeferredRoutine : 0xf73fc5b2 [Type: void (*)(_KDPC *,void *,void *,void *)]
[+0x010] DeferredContext : 0x0 [Type: void *]
[+0x014] SystemArgument1 : 0x0 [Type: void *]
[+0x018] SystemArgument2 : 0x0 [Type: void *]
[+0x01c] DpcData : 0x0 [Type: void *]
0: kd> u f73fc5b2
ACPI!ACPIBuildDeviceDpc [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 478]:
f73fc5b2 53 push ebx
f73fc5b3 8b1d70b042f7 mov ebx,dword ptr [ACPI!_imp_KefAcquireSpinLockAtDpcLevel (f742b070)]
f73fc5b9 56 push esi
f73fc5ba be98b843f7 mov esi,offset ACPI!AcpiBuildQueueLock (f743b898)
f73fc5bf 8bce mov ecx,esi
f73fc5c1 ffd3 call ebx
f73fc5c3 803d9eb843f700 cmp byte ptr [ACPI!AcpiBuildDpcRunning (f743b89e)],0
f73fc5ca 740d je ACPI!ACPIBuildDeviceDpc+0x27 (f73fc5d9)
0: kd> dx -r1 (*((ACPI!_LIST_ENTRY *)0xf743b844))
(*((ACPI!_LIST_ENTRY *)0xf743b844)) [Type: _LIST_ENTRY]
[+0x000] Flink : 0x0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x0 [Type: _LIST_ENTRY *]


0: kd> x acpi!AcpiBuildRunMethod*
f74380e8 ACPI!AcpiBuildRunMethodDispatch = <function> *[7]
f743b870 ACPI!AcpiBuildRunMethodList = struct _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
f73fbfb8 ACPI!ACPIBuildRunMethodRequest (struct _DEVICE_EXTENSION *, <function> *, void *, unsigned long, unsigned long, unsigned char)
0: kd> dx -r1 (*((ACPI!long (*(*)[7])(_ACPI_BUILD_REQUEST *))0xf74380e8))
(*((ACPI!long (*(*)[7])(_ACPI_BUILD_REQUEST *))0xf74380e8)) [Type: long (* [7])(_ACPI_BUILD_REQUEST *)]
[0] : 0xf73fb840 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[1] : 0x0 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[2] : 0x0 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[3] : 0xf73fbbfa [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[4] : 0xf73fbb44 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[5] : 0xf73fbcf2 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
[6] : 0xf73fd6b0 [Type: long (*)(_ACPI_BUILD_REQUEST *)]
0: kd> dds 0xf74380e8
f74380e8 f73fb840 ACPI!ACPIBuildProcessGenericComplete [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 4654]
f74380ec 00000000
f74380f0 00000000
f74380f4 f73fbbfa ACPI!ACPIBuildProcessRunMethodPhaseCheckSta [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 5683]
f74380f8 f73fbb44 ACPI!ACPIBuildProcessRunMethodPhaseCheckBridge [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 5585]
f74380fc f73fbcf2 ACPI!ACPIBuildProcessRunMethodPhaseRunMethod [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 5864]
f7438100 f73fd6b0 ACPI!ACPIBuildProcessRunMethodPhaseRecurse [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 5773]
f7438104 f73fb840 ACPI!ACPIBuildProcessGenericComplete [d:\srv03rtm\base\busdrv\acpi\driver\nt\buildsrc.c @ 4654]
f7438108 00000000


typedef enum _WORK_DONE {
WORK_DONE_COMPLETE = 0,
WORK_DONE_PENDING,
WORK_DONE_FAILURE,
WORK_DONE_STEP_0,

//
// Fill in the structure
//
RtlZeroMemory( buildRequest, sizeof(ACPI_BUILD_REQUEST) );
buildRequest->Signature = ACPI_SIGNATURE;
buildRequest->TargetListEntry = &AcpiBuildRunMethodList;
buildRequest->WorkDone = WORK_DONE_STEP_0;


//
// Add this to the list
//
InsertTailList(
&AcpiBuildQueueList,
&(buildRequest->ListEntry)
);

0: kd> x acpi!AcpiBuildQueueList
f743b890 ACPI!AcpiBuildQueueList = struct _LIST_ENTRY [ 0x89996208 - 0x89906e30 ]
0: kd> dx -r1 (*((ACPI!_LIST_ENTRY *)0xf743b890))
(*((ACPI!_LIST_ENTRY *)0xf743b890)) [Type: _LIST_ENTRY]
[+0x000] Flink : 0x89996208 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89906e30 [Type: _LIST_ENTRY *]
0: kd> dt ACPI_BUILD_REQUEST 0x89906e30 -r
+0x000 ListEntry : _LIST_ENTRY [ 0xf743b890 - 0x89907358 ]
+0x000 Flink : 0xf743b890 _LIST_ENTRY [ 0x89996208 - 0x89906e30 ]
+0x000 Flink : 0x89996208 _LIST_ENTRY [ 0x89986158 - 0xf743b890 ]
+0x004 Blink : 0x89906e30 _LIST_ENTRY [ 0xf743b890 - 0x89907358 ]
+0x004 Blink : 0x89907358 _LIST_ENTRY [ 0x89906e30 - 0x89907528 ]
+0x000 Flink : 0x89906e30 _LIST_ENTRY [ 0xf743b890 - 0x89907358 ]
+0x004 Blink : 0x89907528 _LIST_ENTRY [ 0x89907358 - 0x899076f8 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0x100c
+0x00c UFlags : __unnamed
+0x000 Device : 0y0
+0x000 Sync : 0y0
+0x000 Run : 0y1
+0x000 ReleaseReference : 0y1
+0x000 Reserved1 : 0y00000000 (0)
+0x000 ValidTarget : 0y1
+0x000 Reserved2 : 0y0000000000000000000 (0)
+0x010 WorkDone : 3
+0x014 CurrentWorkDone : 0
+0x018 NextWorkDone : 0
+0x01c BuildContext : 0x89981a18 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x000 ResultData : _ObjData
+0x000 dwfData : 0x495f
+0x002 dwDataType : 0x494e
+0x004 dwRefCount : 7
+0x004 pdataBase : 0x00000007 _ObjData
+0x008 dwDataValue : 0
+0x008 uipDataValue : 0
+0x008 pnsAlias : (null)
+0x008 pdataAlias : (null)
+0x008 powner : (null)
+0x00c dwDataLen : 0
+0x010 pbDataBuff : (null)
+0x030 RunRequest : __unnamed
+0x000 ControlMethodName : 0x494e495f
+0x000 ControlMethodNameAsUchar : [4] "_INI" //关键地方1:_INI
+0x004 Flags : 7
+0x004 UFlags : __unnamed
+0x000 CheckStatus : 0y1
+0x000 MarkIni : 0y1
+0x000 Recursive : 0y1
+0x000 CheckWakeCount : 0y0
+0x000 RegOn : 0y0
+0x000 RegOff : 0y0
+0x000 StopAtBridges : 0y0
+0x000 Reserved : 0y0000000000000000000000000 (0)
+0x030 SynchronizeRequest : __unnamed
+0x000 SynchronizeListEntry : 0x494e495f _LIST_ENTRY
+0x000 Flink : ????
+0x004 Blink : ????
+0x004 SynchronizeMethodName : 7
+0x004 SynchronizeMethodNameAsUchar : [4] "???"
+0x008 Flags : 0
+0x008 UFlags : __unnamed
+0x000 HasMethod : 0y0
+0x000 Reserved : 0y0000000000000000000000000000000 (0)
+0x044 Integer : 0xf743b870
+0x044 String : 0xf743b870 "p???"
+0x044 TargetListEntry : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x000 Flink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x000 Flink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x004 Blink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x004 Blink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x000 Flink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
+0x004 Blink : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]
Memory read error 494e4963

0: kd> dt ACPI_BUILD_REQUEST 0x89906e30 一会会用到。
+0x000 ListEntry : _LIST_ENTRY [ 0xf743b890 - 0x89907358 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0x100c
+0x00c UFlags : __unnamed
+0x010 WorkDone : 3
+0x014 CurrentWorkDone : 0
+0x018 NextWorkDone : 0
+0x01c BuildContext : 0x89981a18 Void 关键地方2:根扩展
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0xf743b870
+0x044 String : 0xf743b870 "p???"
+0x044 TargetListEntry : 0xf743b870 _LIST_ENTRY [ 0xf743b870 - 0xf743b870 ]


0: kd> dv RunDPC
RunDPC = 0x00 ''
0: kd> x acpi!AcpiBuildDpcRunning
f743b89e ACPI!AcpiBuildDpcRunning = 0x00 ''


//
// Do we need to queue up the DPC?
//
if (RunDPC && !AcpiBuildDpcRunning) { 不符合条件

KeInsertQueueDpc( &AcpiBuildDpc, 0, 0 );

}


D:\srv03rtm>grep "AcpiBuildDpcRunning" -nr D:\srv03rtm\base\busdrv\acpi|grep -v "inary"
D:\srv03rtm\base\busdrv\acpi/driver/nt/acpiosnt.c:194: AcpiBuildDpcRunning = FALSE;
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:75:BOOLEAN AcpiBuildDpcRunning;
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:296: if (!AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:491: if (AcpiBuildDpcRunning) {

D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:504: AcpiBuildDpcRunning = TRUE;

D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:741: AcpiBuildDpcRunning = FALSE;
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:1286: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:2470: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:5193: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:6768: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:7072: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.c:7402: if (RunDPC && !AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/driver/nt/buildsrc.h:247: extern BOOLEAN AcpiBuildDpcRunning;
D:\srv03rtm\base\busdrv\acpi/driver/nt/table.c:188: if (!AcpiBuildDpcRunning) {
D:\srv03rtm\base\busdrv\acpi/tools/kdext/build.c:215: status = GetUlong( "ACPI!AcpiBuildDpcRunning", &value );
D:\srv03rtm\base\busdrv\acpi/tools/kdext/build.c:218: dprintf("dumpAcpiBuildLists: Could not read ACPI!AcpiBuildDpcRunning\n");
D:\srv03rtm\base\busdrv\acpi/tools/kdext/build.c:222: dprintf(" + AcpiBuildDpcRunning = %s\n", (value ? "TRUE" : "FALSE" ) );


VOID
ACPIBuildDeviceDpc(
IN PKDPC Dpc,
IN PVOID DpcContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2
)
{


//
// Remember that the DPC is now running
//
AcpiBuildDpcRunning = TRUE;


参考:
1: kd> kc
#
00 ACPI!ACPIBuildProcessRunMethodPhaseRunMethod
01 ACPI!ACPIBuildProcessGenericList
02 ACPI!ACPIBuildDeviceDpc
03 nt!KiRetireDpcList
04 nt!KiDispatchInterrupt
WARNING: Frame IP not in any known module. Following frames may be wrong.
05 0x0
参考:

第二部分:


第一步:
//
// We now want to run the _INI through the entire tree, starting at
// the _SB 运行_INI在整个树上,启动_SB
//
status = ACPIBuildRunMethodRequest(
RootDeviceExtension,
NULL,
NULL,
PACKED_INI,
(RUN_REQUEST_CHECK_STATUS | RUN_REQUEST_RECURSIVE | RUN_REQUEST_MARK_INI),
FALSE
); 返回到这里:
if (!NT_SUCCESS(status)) {

ACPIInternalError( ACPI_CALLBACK );

}

第二步:
//
// We also need to run the _INI method off of the root name space entry
//
if (runRootIni) {

iniObject = ACPIAmliGetNamedChild( nsObject->pnsParent, PACKED_INI );
if (iniObject) {

AMLIAsyncEvalObject(
iniObject,
NULL,
0,
NULL,
NULL,
NULL
);

}

}

第三步:
//
// Do we need to run the DPC?
//
if (!AcpiBuildDpcRunning) {

KeInsertQueueDpc( &AcpiBuildDpc, 0, 0); 这里会进入ACPI!ACPIBuildDeviceDpc

}

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询