聊城市网站建设_网站建设公司_Bootstrap_seo优化
2026/1/18 10:56:29 网站建设 项目流程

ACPI!ACPIBuildProcessGenericList函数中2次InterlockedCompareExchange函数作用是标记为WORK_DONE_PENDING下次直接略过


//
// Check to see if we have any work to do on the request
//
workDone = InterlockedCompareExchange(
&(buildRequest->WorkDone),
WORK_DONE_PENDING,
WORK_DONE_PENDING
);

//
// Look at the dispatch table to see if there is a function to
// call
//
buildFunction = DispatchTable[ workDone ];
if (buildFunction != NULL) {

//
// Just to help us along, if we are going to the failure
// path, then we should not update the Current Work Done field.
// This gives us an easy means of find which step failed
//
if (workDone != WORK_DONE_FAILURE) {

//
// Mark the node as being in the state 'workDone'
//
buildRequest->CurrentWorkDone = workDone;

}

//
// Mark the request as pending
//
workDone = InterlockedCompareExchange(
&(buildRequest->WorkDone),
WORK_DONE_PENDING,
workDone
);

//
// Call the function
//
status = (buildFunction)( buildRequest );

1: kd> bp ACPI!ACPIBuildDeviceDpc
1: kd> g
Breakpoint 34 hit
eax=00000000 ebx=f7737120 ecx=f7737988 edx=f7737980 esi=f73fc5b2 edi=f7737980
eip=f73fc5b2 esp=f78aefa0 ebp=f78aeff4 iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
ACPI!ACPIBuildDeviceDpc:
f73fc5b2 53 push ebx
1: kd> kc
#
00 ACPI!ACPIBuildDeviceDpc
01 nt!KiRetireDpcList
02 nt!KiDispatchInterrupt
WARNING: Frame IP not in any known module. Following frames may be wrong.
03 0x0
1: kd> dv
Dpc = 0x00000000
DpcContext = 0x00000000
SystemArgument1 = 0x00000000
SystemArgument2 = 0x804ee186


1: kd> x acpi!AcpiBuildQueueList
f743b890 ACPI!AcpiBuildQueueList = struct _LIST_ENTRY [ 0xf743b890 - 0xf743b890 ]
1: kd> dx -r1 (*((ACPI!_LIST_ENTRY *)0xf743b890))
(*((ACPI!_LIST_ENTRY *)0xf743b890)) [Type: _LIST_ENTRY]
[+0x000] Flink : 0xf743b890 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0xf743b890 [Type: _LIST_ENTRY *]


1: kd> x acpi!AcpiBuildRunMethodList
f743b870 ACPI!AcpiBuildRunMethodList = struct _LIST_ENTRY [ 0x89d39ac0 - 0x89d39840 ]


1: kd> g
Breakpoint 35 hit
eax=f743b870 ebx=80afae90 ecx=f743b898 edx=f7737980 esi=f743b898 edi=f7737980
eip=f73fb8c4 esp=f78aef88 ebp=f78aeff4 iopl=0 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000287
ACPI!ACPIBuildProcessGenericList:
f73fb8c4 55 push ebp
1: kd> kc
#
00 ACPI!ACPIBuildProcessGenericList
01 ACPI!ACPIBuildDeviceDpc
02 nt!KiRetireDpcList
03 nt!KiDispatchInterrupt
WARNING: Frame IP not in any known module. Following frames may be wrong.
04 0x0
1: kd> dv
ListEntry = 0xf743b870 [ 0x89d39ac0 - 0x89d39840 ]
DispatchTable = 0xf74380e8
tempEntry = 0xf73fb8c5 [ 0xec83ec8b - 0x84d8b0c ]
allWorkComplete = 0x00 ''
buildFunction = 0x00000000

1: kd> dv
ListEntry = 0xf743b870 [ 0x89d39ac0 - 0x89d39840 ]
DispatchTable = 0xf74380e8
tempEntry = 0xf73fb8c5 [ 0xec83ec8b - 0x84d8b0c ]
allWorkComplete = 0x00 ''
buildFunction = 0x00000000
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0xf743b870)
((ACPI!_LIST_ENTRY *)0xf743b870) : 0xf743b870 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39ac0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39840 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39ac0)
((ACPI!_LIST_ENTRY *)0x89d39ac0) : 0x89d39ac0 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39a70 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0xf743b870 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39a70)
((ACPI!_LIST_ENTRY *)0x89d39a70) : 0x89d39a70 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d399d0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39ac0 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d399d0)
((ACPI!_LIST_ENTRY *)0x89d399d0) : 0x89d399d0 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39980 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39a70 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39980)
((ACPI!_LIST_ENTRY *)0x89d39980) : 0x89d39980 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39930 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d399d0 [Type: _LIST_ENTRY *]

1: kd> dt ACPI_BUILD_REQUEST 0x89d39ac0
+0x000 ListEntry : _LIST_ENTRY [ 0x89d39a70 - 0xf743b870 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0xc
+0x00c UFlags : __unnamed
+0x010 WorkDone : 1
+0x014 CurrentWorkDone : 3
+0x018 NextWorkDone : 4
+0x01c BuildContext : 0x89df4288 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0
+0x044 String : (null)
+0x044 TargetListEntry : (null)
1: kd> dt ACPI_BUILD_REQUEST 0x89d39a70
+0x000 ListEntry : _LIST_ENTRY [ 0x89d399d0 - 0x89d39ac0 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0xc
+0x00c UFlags : __unnamed
+0x010 WorkDone : 1
+0x014 CurrentWorkDone : 3
+0x018 NextWorkDone : 4
+0x01c BuildContext : 0x89da2008 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0
+0x044 String : (null)
+0x044 TargetListEntry : (null)
1: kd> dt ACPI_BUILD_REQUEST 0x89d399d0
+0x000 ListEntry : _LIST_ENTRY [ 0x89d39980 - 0x89d39a70 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0xc
+0x00c UFlags : __unnamed
+0x010 WorkDone : 1
+0x014 CurrentWorkDone : 3
+0x018 NextWorkDone : 4
+0x01c BuildContext : 0x89da2c40 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0
+0x044 String : (null)
+0x044 TargetListEntry : (null)


1: kd> dt ACPI_BUILD_REQUEST 0x89d39980
+0x000 ListEntry : _LIST_ENTRY [ 0x89d39930 - 0x89d399d0 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0xc
+0x00c UFlags : __unnamed
+0x010 WorkDone : 1
+0x014 CurrentWorkDone : 5
+0x018 NextWorkDone : 2
+0x01c BuildContext : 0x89dea908 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0xf
+0x044 String : 0x0000000f "--- memory read error at address 0x0000000f ---"
+0x044 TargetListEntry : 0x0000000f _LIST_ENTRY


1: kd> dx -r1 (*((ACPI!_LIST_ENTRY *)0xf743b870))
(*((ACPI!_LIST_ENTRY *)0xf743b870)) [Type: _LIST_ENTRY]
[+0x000] Flink : 0x89d39ac0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39840 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39ac0)
((ACPI!_LIST_ENTRY *)0x89d39ac0) : 0x89d39ac0 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39a70 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0xf743b870 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39a70)
((ACPI!_LIST_ENTRY *)0x89d39a70) : 0x89d39a70 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d399d0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39ac0 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d399d0)
((ACPI!_LIST_ENTRY *)0x89d399d0) : 0x89d399d0 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39930 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39a70 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39930)
((ACPI!_LIST_ENTRY *)0x89d39930) : 0x89d39930 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d398e0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d399d0 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d398e0)
((ACPI!_LIST_ENTRY *)0x89d398e0) : 0x89d398e0 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d39890 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d39930 [Type: _LIST_ENTRY *]
1: kd> dx -r1 ((ACPI!_LIST_ENTRY *)0x89d39890)
((ACPI!_LIST_ENTRY *)0x89d39890) : 0x89d39890 [Type: _LIST_ENTRY *]
[+0x000] Flink : 0x89d396b0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x89d398e0 [Type: _LIST_ENTRY *]


1: kd> g
Breakpoint 37 hit
eax=00000001 ebx=89d39940 ecx=00000000 edx=00000001 esi=89d398e0 edi=80b019f4
eip=f73fb8e1 esp=f78aef6c ebp=f78aef84 iopl=0 nv up ei ng nz na po cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000283
ACPI!ACPIBuildProcessGenericList+0x1d:
f73fb8e1 8b06 mov eax,dword ptr [esi] ds:0023:89d398e0=89d39890
1: kd> dt ACPI_BUILD_REQUEST 89d398e0
+0x000 ListEntry : _LIST_ENTRY [ 0x89d39890 - 0x89d39930 ]
+0x008 Signature : 0x5f534750
+0x00c Flags : 0xc
+0x00c UFlags : __unnamed
+0x010 WorkDone : 4
+0x014 CurrentWorkDone : 3
+0x018 NextWorkDone : 2
+0x01c BuildContext : 0x89d41a28 Void
+0x020 Status : 0n0
+0x024 CurrentObject : (null)
+0x028 CallBack : (null)
+0x02c CallBackContext : (null)
+0x030 DeviceRequest : __unnamed
+0x030 RunRequest : __unnamed
+0x030 SynchronizeRequest : __unnamed
+0x044 Integer : 0
+0x044 String : (null)
+0x044 TargetListEntry : (null)


ACPI_BUILD_REQUEST结构中的WorkDone什么时候变成4的?

VOID EXPORT
ACPIBuildCompleteMustSucceed(
IN PNSOBJ AcpiObject,
IN NTSTATUS Status,
IN POBJDATA ObjectData,
IN PVOID Context
)
/*++

Routine Description:

This is a generic completion handler. If the interperter has successfully
execute the method, it completes the request to the next desired WORK_DONE,
otherwise, it fails the request

Arguments:

AcpiObject - Points to the control that was run
Status - Result of the method
ObjectData - Information about the result
Context - PACPI_BUILD_REQUEST

Return Value:

VOID

--*/
{
PACPI_BUILD_REQUEST buildRequest = (PACPI_BUILD_REQUEST) Context;
ULONG nextWorkDone = buildRequest->NextWorkDone;

//
// Device what state we should transition to next
//
if (!NT_SUCCESS(Status)) {

//
// Remember why we failed, and mark the request as being failed
//
buildRequest->Status = Status;

//
// Death
//
KeBugCheckEx(
ACPI_BIOS_ERROR,
ACPI_FAILED_MUST_SUCCEED_METHOD,
(ULONG_PTR) AcpiObject,
Status,
(AcpiObject ? AcpiObject->dwNameSeg : 0)
);

} else {

//
// Note: we don't have a race condition here because only one
// routine can be processing a request at any given time. Thus it
// is safe for us to specify a new next phase
//
buildRequest->NextWorkDone = WORK_DONE_FAILURE;

//
// Transition to the next stage
//
ACPIBuildCompleteCommon(
&(buildRequest->WorkDone),
nextWorkDone
);

}

}


VOID
ACPIBuildCompleteCommon(
IN PULONG OldWorkDone,
IN ULONG NewWorkDone
)
/*++

Routine Description:

Since the completion routines all have to do some bit of common work to
get the DPC firing again, this routine reduces the code duplication

Arguments:

OldWorkDone - Pointer to the old amount of work done
NewWorkDone - The new amount of work that has been completed

NOTENOTE: There is an implicit assumption that the current value of
WorkDone in the request is WORK_DONE_PENDING. If that is
not the case, we will fail to transition to the next stage,
which means that we will loop forever.

Return Value:

None

--*/
{
KIRQL oldIrql;

//
// Update the state of the request
//
InterlockedCompareExchange( OldWorkDone, NewWorkDone,WORK_DONE_PENDING);//这个时候buildRequest->WorkDone变成了4

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

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

立即咨询