ACPIInternalUpdateDeviceStatus函数对应不存在的设备添加DEV_PROP_DEVICE_FAILED标志0x0080000000000000
第一部分:
1: kd> g
Breakpoint 14 hit
eax=f74255ed ebx=8997c000 ecx=8997c000 edx=8997c000 esi=8997ded8 edi=00000000
eip=f74255ed esp=f791acf4 ebp=f791ad0c iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
ACPI!Return:
f74255ed 55 push ebp
1: kd> dv
pctxt = 0x8997c000
pterm = 0x8997ded8
1: kd> dx -r1 ((ACPI!_term *)0x8997ded8)
((ACPI!_term *)0x8997ded8) : 0x8997ded8 [Type: _term *]
[+0x000] FrameHdr [Type: _framehdr]
[+0x010] pbOpTerm : 0x899b498d : 0xa4 [Type: unsigned char *]
[+0x014] pbOpEnd : 0x0 [Type: unsigned char *]
[+0x018] pbScopeEnd : 0x899b4994 : 0x48 [Type: unsigned char *]
[+0x01c] pamlterm : 0xf7439070 [Type: _amlterm *]
[+0x020] pnsObj : 0x0 [Type: _NSObj *]
[+0x024] iArg : 1 [Type: int]
[+0x028] icArgs : 1 [Type: int]
[+0x02c] pdataArgs : 0x8997c0fc [Type: _ObjData *]
[+0x030] pdataResult : 0x8997c040 [Type: _ObjData *]
1: kd> dx -r1 ((ACPI!_ObjData *)0x8997c0fc)
((ACPI!_ObjData *)0x8997c0fc) : 0x8997c0fc [Type: _ObjData *]
[+0x000] dwfData : 0x0 [Type: unsigned short]
[+0x002] dwDataType : 0x1 [Type: unsigned short]
[+0x004] dwRefCount : 0x0 [Type: unsigned long]
[+0x004] pdataBase : 0x0 [Type: _ObjData *]
[+0x008] dwDataValue : 0x0 [Type: unsigned long]
[+0x008] uipDataValue : 0x0 [Type: unsigned long]
[+0x008] pnsAlias : 0x0 [Type: _NSObj *]
[+0x008] pdataAlias : 0x0 [Type: _ObjData *]
[+0x008] powner : 0x0 [Type: void *]
[+0x00c] dwDataLen : 0x0 [Type: unsigned long]
[+0x010] pbDataBuff : 0x0 [Type: unsigned char *]
1: kd> g
Breakpoint 13 hit
eax=00000000 ebx=f743a948 ecx=8997c000 edx=8997c000 esi=8997c000 edi=8997df34
eip=f7427709 esp=f791ad10 ebp=f791ad34 iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
ACPI!ParseCall:
f7427709 55 push ebp
1: kd> g
Breakpoint 11 hit
eax=00000001 ebx=f743a948 ecx=8997c000 edx=8997c000 esi=8997c000 edi=8997df34
eip=f741d852 esp=f791ad1c ebp=f791ad34 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
ACPI!RunContext+0x142:
f741d852 e83bceffff call ACPI!AcquireMutex (f741a692)
第二部分:
1: kd> g
Breakpoint 15 hit
eax=89906d14 ebx=00000000 ecx=40040802 edx=00002707 esi=899c6320 edi=899c634c
eip=f7406cd6 esp=f791acac ebp=f791acd8 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
ACPI!ACPIGetConvertToDevicePresence:
f7406cd6 55 push ebp
1: kd> kc
#
00 ACPI!ACPIGetConvertToDevicePresence
01 ACPI!ACPIGetWorkerForInteger
02 ACPI!AsyncCallBack
03 ACPI!RunContext
04 ACPI!DispatchCtxtQueue
05 ACPI!StartTimeSlicePassive
06 ACPI!ACPIWorker
07 nt!PspSystemThreadStartup
08 nt!KiThreadStartup
1: kd> dv
DeviceExtension = 0x899aee58
Status = 0n0
Result = 0x899c634c
Flags = 0x40040802
Buffer = 0x89906d14
BufferSize = 0x00000000
deviceStatus = 8
1: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x899aee58)
((ACPI!_DEVICE_EXTENSION *)0x899aee58) : 0x899aee58 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0xa [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0x0 [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 : 0x0 [Type: unsigned char *]
[+0x10c] Address : 0x0 [Type: unsigned long]
[+0x110] InstanceID : 0x0 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 4 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899b4804 [Type: _NSObj *]
[+0x130] DeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
1: kd> db 0x899b4804
899b4804 18 45 9b 89 70 4a 9b 89-f0 f0 9a 89 48 48 9b 89 .E..pJ......HH..
899b4814 42 41 54 32 30 f3 9a 89-84 47 9b 89 00 00 06 00 BAT20....G......
899b4824 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
899b4834 58 ee 9a 89 00 00 00 00-48 4e 53 4f 44 00 00 00 X.......HNSOD...
899b4844 00 f0 9a 89 08 4a 9b 89-8c 48 9b 89 04 48 9b 89 .....J...H...H..
899b4854 00 00 00 00 5f 48 49 44-30 f3 9a 89 04 48 9b 89 ...._HID0....H..
899b4864 00 00 01 00 00 00 00 00-41 d0 0c 0a 00 00 00 00 ........A.......
899b4874 00 00 00 00 00 00 00 00-00 00 00 00 48 4e 53 4f ............HNSO
第三部分:
1: kd> kc
#
00 ACPI!ACPIInternalUpdateDeviceStatus
01 ACPI!ACPIGetConvertToDevicePresence
02 ACPI!ACPIGetWorkerForInteger
03 ACPI!AsyncCallBack
04 ACPI!RunContext
05 ACPI!DispatchCtxtQueue
06 ACPI!StartTimeSlicePassive
07 ACPI!ACPIWorker
08 nt!PspSystemThreadStartup
09 nt!KiThreadStartup
1: kd> dv
DeviceExtension = 0x899aee58
DeviceStatus = 0
oldIrql = 0x00 ''
1: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x899aee58)
((ACPI!_DEVICE_EXTENSION *)0x899aee58) : 0x899aee58 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0xa [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0x0 [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 : 0x0 [Type: unsigned char *]
[+0x10c] Address : 0x0 [Type: unsigned long]
[+0x110] InstanceID : 0x0 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 4 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899b4804 [Type: _NSObj *]
[+0x130] DeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
//
// Update the extensions flags bassed on wether or not STA_STATUS_PRESENT is
// set
//
originalFlags = ACPIInternalUpdateFlags(
&(DeviceExtension->Flags),
DEV_TYPE_NOT_PRESENT,
(BOOLEAN) (DeviceStatus & STA_STATUS_PRESENT)第三个参数为0,表示设置标志
);
#define DEV_TYPE_NOT_PRESENT 0x0000000000000002
1: kd> gu
eax=00000002 ebx=00000000 ecx=00800000 edx=00000000 esi=899aee58 edi=00000000
eip=f7406da5 esp=f791ac94 ebp=f791aca8 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
ACPI!ACPIGetConvertToDevicePresence+0xcf:
f7406da5 5e pop esi
1: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x899aee58)
((ACPI!_DEVICE_EXTENSION *)0x899aee58) : 0x899aee58 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0x8000002000000a[Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0x0 [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 : 0x0 [Type: unsigned char *]
[+0x10c] Address : 0x0 [Type: unsigned long]
[+0x110] InstanceID : 0x0 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 4 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899b4804 [Type: _NSObj *]
[+0x130] DeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
#define DEV_PROP_DEVICE_FAILED 0x0080000000000000
#define DEV_PROP_DEVICE_FAILED 0x00800000 00000000
0x800000 2000000a
VOID
ACPIInternalUpdateDeviceStatus(
IN PDEVICE_EXTENSION DeviceExtension,
IN ULONG DeviceStatus
)
{
//
// Is the device working okay?
//
originalFlags = ACPIInternalUpdateFlags(
&(DeviceExtension->Flags),
DEV_PROP_DEVICE_FAILED,
(BOOLEAN) (DeviceStatus & STA_STATUS_WORKING_OK)
);//设置标志DEV_PROP_DEVICE_FAILED
//
// Is the device meant to be shown in the UI?
//
originalFlags = ACPIInternalUpdateFlags(
&(DeviceExtension->Flags),
DEV_CAP_NO_SHOW_IN_UI,
(BOOLEAN) (DeviceStatus & STA_STATUS_USER_INTERFACE)
);
#define STA_STATUS_PRESENT 0x00000001
#define STA_STATUS_ENABLED 0x00000002
#define STA_STATUS_USER_INTERFACE 0x00000004
#define STA_STATUS_WORKING_OK 0x00000008
#define STA_STATUS_DEFAULT ( STA_STATUS_PRESENT | \
STA_STATUS_ENABLED | \
STA_STATUS_USER_INTERFACE | \
STA_STATUS_WORKING_OK)
第四部分:
ULONGLONG
ACPIInternalUpdateFlags(
IN PULONGLONG FlagLocation,
IN ULONGLONG NewFlags,
IN BOOLEAN Clear
)
{
ULONGLONG originalFlags;
ULONGLONG tempFlags;
ULONGLONG flags;
ULONG uFlags;
ULONG uTempFlags;
ULONG uOriginalFlags;
if (Clear) {
//
// Clear the bits
//
originalFlags = *FlagLocation;
do {
tempFlags = originalFlags;
flags = tempFlags & ~NewFlags;
//
// Exchange the bits
//
originalFlags = ExInterlockedCompareExchange64(
(PLONGLONG) FlagLocation,
(PLONGLONG) &flags,
(PLONGLONG) &tempFlags,
&AcpiUpdateFlagsLock
);
} while ( tempFlags != originalFlags );
} else {
//
// Set the bits
//
originalFlags = *FlagLocation;
do {
tempFlags = originalFlags;
flags = tempFlags | NewFlags;
//
// Exchange teh bits
//
originalFlags = ExInterlockedCompareExchange64(
(PLONGLONG) FlagLocation,
(PLONGLONG) &flags,
(PLONGLONG) &tempFlags,
&AcpiUpdateFlagsLock
);
} while ( tempFlags != originalFlags );
}
//
// return the original flags
//
return originalFlags;
}