当前位置: 首页 > news >正文

ACPI!ACPIBuildDeviceExtension函数分析之建立了第一个子设备扩展

ACPI!ACPIBuildDeviceExtension函数分析之建立了第一个子设备扩展

0: kd> dv
CurrentObject = 0x899affac
ParentDeviceExtension = 0x89981a18
ReturnExtension = 0xf789a0d4
0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_NSObj *)0x899affac)
((ACPI!_NSObj *)0x899affac) : 0x899affac [Type: _NSObj *]
[+0x000] list [Type: _List]
[+0x008] pnsParent : 0x899af0f0 [Type: _NSObj *]
[+0x00c] pnsFirstChild : 0x0 [Type: _NSObj *]
[+0x010] dwNameSeg : 0x30494350 [Type: unsigned long]
[+0x014] hOwner : 0x899af330 [Type: void *]
[+0x018] pnsOwnedNext : 0x899aff4c [Type: _NSObj *]
[+0x01c] ObjData [Type: _ObjData]
[+0x030] Context : 0x0 [Type: void *]
[+0x034] dwRefCount : 0x0 [Type: unsigned long]

//
// Create a new extension for the object
//
deviceExtension = ExAllocateFromNPagedLookasideList( esi=899c0d58
&DeviceExtensionLookAsideList
);

0: kd> p
eax=899c0d58 ebx=89981a18 ecx=89bfe0e0 edx=00000000 esi=899c0d58 edi=899affac
eip=f73fc8e3 esp=f789a0a8 ebp=f789a0b4 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!ACPIBuildDeviceExtension+0x7b:
f73fc8e3 85f6 test esi,esi
//
// Lets begin with a clean slate
//
RtlZeroMemory( deviceExtension, sizeof(DEVICE_EXTENSION) );

//
// Initialize the reference count mechanism. We only have a NS object
// so the value should be 1
//
deviceExtension->ReferenceCount++ ;

//
// The initial outstanding IRP count will be set to one. Only during a
// remove IRP will this drop to zero, and then it will immediately pop
// back up to one.
//
deviceExtension->OutstandingIrpCount++;

//
// Initialize the link fields
//
deviceExtension->AcpiObject = CurrentObject; 关键代码1:

//
// Initialize the data fields
//
deviceExtension->Signature = ACPI_SIGNATURE;
deviceExtension->Flags = DEV_TYPE_NOT_FOUND | DEV_TYPE_NOT_PRESENT;
deviceExtension->DispatchTable = NULL;
deviceExtension->DeviceState = Stopped;
*ReturnExtension = deviceExtension;


0: kd> dt acpi!_DEVICE_EXTENSION 899c0d58
+0x000 Flags : 0xa
+0x000 UFlags : __unnamed
+0x008 Signature : 0x5f534750
+0x00c DebugFlags : 0
+0x010 DispatchTable : (null)
+0x014 WorkContext : WORK_QUEUE_CONTEXT
+0x014 Fdo : _FDO_DEVICE_EXTENSION
+0x014 Filter : _FILTER_DEVICE_EXTENSION
+0x014 Pdo : _PDO_DEVICE_EXTENSION
+0x058 WorkQueue : EXTENSION_WORKER
+0x058 Button : BUTTON_EXTENSION
+0x058 Thermal : THERMAL_EXTENSION
+0x058 LinkNode : LINK_NODE_EXTENSION
+0x058 Dock : DOCK_EXTENSION
+0x058 Processor : _PROCESSOR_DEVICE_EXTENSION
+0x088 DeviceState : 0 ( Stopped )
+0x08c PreviousState : 0 ( Stopped )
+0x090 PowerInfo : _ACPI_POWER_INFO
+0x10c DeviceID : (null)
+0x10c Address : 0
+0x110 InstanceID : (null)
+0x114 ResourceList : (null)
+0x118 PnpResourceList : (null)
+0x11c OutstandingIrpCount : 0n1
+0x120 ReferenceCount : 0n1
+0x124 HibernatePathCount : 0n0
+0x128 RemoveEvent : (null)
+0x12c AcpiObject : 0x899affac _NSObj
+0x130 DeviceObject : (null)
+0x134 TargetDeviceObject : (null)
+0x138 PhysicalDeviceObject : (null)
+0x13c ParentExtension : (null)
+0x140 ChildDeviceList : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x148 SiblingDeviceList : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x150 EjectDeviceHead : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x158 EjectDeviceList : _LIST_ENTRY [ 0x0 - 0x0 ]


//
// Initialize the list entries
//
InitializeListHead( &(deviceExtension->ChildDeviceList) );
InitializeListHead( &(deviceExtension->EjectDeviceHead) );
InitializeListHead( &(deviceExtension->EjectDeviceList) );
InitializeListHead( &(powerInfo->WakeSupportList) );
InitializeListHead( &(powerInfo->PowerRequestListEntry) );

//
// Make sure that the deviceExtension has pointers to its parent
// extension. Note, that this should cause the ref count on the
// parent to increase
//
deviceExtension->ParentExtension = ParentDeviceExtension; 关键代码2:


0: kd> dt acpi!_DEVICE_EXTENSION 899c0d58
+0x000 Flags : 0xa
+0x000 UFlags : __unnamed
+0x008 Signature : 0x5f534750
+0x00c DebugFlags : 0
+0x010 DispatchTable : (null)
+0x014 WorkContext : WORK_QUEUE_CONTEXT
+0x014 Fdo : _FDO_DEVICE_EXTENSION
+0x014 Filter : _FILTER_DEVICE_EXTENSION
+0x014 Pdo : _PDO_DEVICE_EXTENSION
+0x058 WorkQueue : EXTENSION_WORKER
+0x058 Button : BUTTON_EXTENSION
+0x058 Thermal : THERMAL_EXTENSION
+0x058 LinkNode : LINK_NODE_EXTENSION
+0x058 Dock : DOCK_EXTENSION
+0x058 Processor : _PROCESSOR_DEVICE_EXTENSION
+0x088 DeviceState : 0 ( Stopped )
+0x08c PreviousState : 0 ( Stopped )
+0x090 PowerInfo : _ACPI_POWER_INFO
+0x10c DeviceID : (null)
+0x10c Address : 0
+0x110 InstanceID : (null)
+0x114 ResourceList : (null)
+0x118 PnpResourceList : (null)
+0x11c OutstandingIrpCount : 0n1
+0x120 ReferenceCount : 0n1
+0x124 HibernatePathCount : 0n0
+0x128 RemoveEvent : (null)
+0x12c AcpiObject : 0x899affac _NSObj
+0x130 DeviceObject : (null)
+0x134 TargetDeviceObject : (null)
+0x138 PhysicalDeviceObject : (null)
+0x13c ParentExtension : 0x89981a18 _DEVICE_EXTENSION
+0x140 ChildDeviceList : _LIST_ENTRY [ 0x899c0e98 - 0x899c0e98 ]
+0x148 SiblingDeviceList : _LIST_ENTRY [ 0x89981b58 - 0x89981b58 ]
+0x150 EjectDeviceHead : _LIST_ENTRY [ 0x899c0ea8 - 0x899c0ea8 ]
+0x158 EjectDeviceList : _LIST_ENTRY [ 0x899c0eb0 - 0x899c0eb0 ]

if (ParentDeviceExtension) {

InterlockedIncrement( &(ParentDeviceExtension->ReferenceCount) );

//
// Add the deviceExtension into the deviceExtension tree
//
InsertTailList(
&(ParentDeviceExtension->ChildDeviceList),
&(deviceExtension->SiblingDeviceList)
); 关键代码3:
}


0: kd> dt ACPI!_DEVICE_EXTENSION 0x89981a18
+0x000 Flags : 0x0001e000`00200010
+0x000 UFlags : __unnamed
+0x008 Signature : 0x5f534750
+0x00c DebugFlags : 0
+0x010 DispatchTable : 0xf743826c IRP_DISPATCH_TABLE
+0x014 WorkContext : WORK_QUEUE_CONTEXT
+0x014 Fdo : _FDO_DEVICE_EXTENSION
+0x014 Filter : _FILTER_DEVICE_EXTENSION
+0x014 Pdo : _PDO_DEVICE_EXTENSION
+0x058 WorkQueue : EXTENSION_WORKER
+0x058 Button : BUTTON_EXTENSION
+0x058 Thermal : THERMAL_EXTENSION
+0x058 LinkNode : LINK_NODE_EXTENSION
+0x058 Dock : DOCK_EXTENSION
+0x058 Processor : _PROCESSOR_DEVICE_EXTENSION
+0x088 DeviceState : 0 ( Stopped )
+0x08c PreviousState : 0 ( Stopped )
+0x090 PowerInfo : _ACPI_POWER_INFO
+0x10c DeviceID : 0x899bfea0 "ACPI\PNP0C08"
+0x10c Address : 0x899bfea0
+0x110 InstanceID : 0x899c53e8 "0x5F534750"
+0x114 ResourceList : 0x899bfeb8 _CM_RESOURCE_LIST
+0x118 PnpResourceList : (null)
+0x11c OutstandingIrpCount : 0n2
+0x120 ReferenceCount : 0n3
+0x124 HibernatePathCount : 0n0
+0x128 RemoveEvent : (null)
+0x12c AcpiObject : (null)
+0x130 DeviceObject : 0x89981b98 _DEVICE_OBJECT
+0x134 TargetDeviceObject : 0x899c1de0 _DEVICE_OBJECT
+0x138 PhysicalDeviceObject : 0x899c1de0 _DEVICE_OBJECT
+0x13c ParentExtension : (null)
+0x140 ChildDeviceList : _LIST_ENTRY [ 0x899c0ea0 - 0x899c0ea0 ]
+0x148 SiblingDeviceList : _LIST_ENTRY [ 0x89981b60 - 0x89981b60 ]
+0x150 EjectDeviceHead : _LIST_ENTRY [ 0x89981b68 - 0x89981b68 ]
+0x158 EjectDeviceList : _LIST_ENTRY [ 0x89981b70 - 0x89981b70 ]
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_LIST_ENTRY *)0x89981b58))
(*((ACPI!_LIST_ENTRY *)0x89981b58)) [Type: _LIST_ENTRY]
[+0x000] Flink : 0x899c0ea0 [Type: _LIST_ENTRY *]
[+0x004] Blink : 0x899c0ea0 [Type: _LIST_ENTRY *]


//
// And make sure that the Name Space Object points to the extension
//
if (CurrentObject != NULL ) {

CurrentObject->Context = deviceExtension; 关键代码4:
}


0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_NSObj *)0x899affac)
((ACPI!_NSObj *)0x899affac) : 0x899affac [Type: _NSObj *]
[+0x000] list [Type: _List]
[+0x008] pnsParent : 0x899af0f0 [Type: _NSObj *]
[+0x00c] pnsFirstChild : 0x0 [Type: _NSObj *]
[+0x010] dwNameSeg : 0x30494350 [Type: unsigned long]
[+0x014] hOwner : 0x899af330 [Type: void *]
[+0x018] pnsOwnedNext : 0x899aff4c [Type: _NSObj *]
[+0x01c] ObjData [Type: _ObjData]
[+0x030] Context : 0x899c0d58 [Type: void *] [+0x030] Context : 0x899c0d58
[+0x034] dwRefCount : 0x0 [Type: unsigned long]


0: kd> kc
#
00 ACPI!ACPIBuildDeviceExtension
01 ACPI!OSNotifyCreateDevice
02 ACPI!OSNotifyCreate
03 ACPI!Device
04 ACPI!ParseTerm
05 ACPI!RunContext
06 ACPI!InsertReadyQueue
07 ACPI!RestartContext
08 ACPI!SyncLoadDDB
09 ACPI!AMLILoadDDB
0a ACPI!ACPIInitializeDDB
0b ACPI!ACPIInitializeDDBs
0c ACPI!ACPIInitialize
0d ACPI!ACPIInitStartACPI
0e ACPI!ACPIRootIrpStartDevice
0f ACPI!ACPIDispatchIrp
10 nt!IofCallDriver
11 nt!IopSynchronousCall
12 nt!IopStartDevice
13 nt!PipProcessStartPhase1
14 nt!PipProcessDevNodeTree
15 nt!PipDeviceActionWorker
16 nt!PipRequestDeviceAction
17 nt!IopInitializeBootDrivers
18 nt!IoInitSystem
19 nt!Phase1Initialization
1a nt!PspSystemThreadStartup
1b nt!KiThreadStartup

http://www.jsqmd.com/news/186827/

相关文章:

  • 高性能C++服务背后的秘密(多线程资源调度优化实战案例)
  • C++26任务优先级机制全面曝光(下一代并发编程革命)
  • CircleCI云端构建加速lora-scripts镜像打包发布流程
  • CI/CD流水线中集成lora-scripts自动测试与发布流程
  • 微信公众号推文介绍lora-scripts最新功能更新动态
  • 导师推荐10个AI论文写作软件,专科生轻松搞定毕业论文!
  • Teambition任务分配明确lora-scripts各成员职责分工
  • JLink烧录过程中SWD接口驱动行为解析
  • C++26 prioritized任务调度:3个你必须掌握的实时系统编程技巧
  • 基于lora-scripts的赛博朋克艺术风格生成器部署全过程
  • C++26中std::future异常处理全面升级(专家级避坑指南)
  • RabbitMQ消息队列解耦lora-scripts训练任务提交与执行过程
  • 为什么C++26的prioritized特性将改变嵌入式开发格局(仅限少数人掌握的核心技术)
  • 举办线上Workshop推广lora-scripts使用经验交流活动
  • 【C++26性能飞跃指南】:掌握std::execution on函数的3个关键技巧
  • 【C++26契约编程重大突破】:深度解析post条件如何重塑代码可靠性
  • 关键规则笔记
  • 北京网红集装箱定制,口碑推荐一览,集装箱设计/箱式房/集成房屋设计/活动板房,网红集装箱公司怎么选择 - 品牌推荐师
  • 牛批了,护眼神器
  • 【C++26多核编程终极指南】:掌握CPU核心绑定的5大实战技巧
  • vue+uniapp+ssm微信小程序的农机收割机信息化服务平台
  • C++并发编程资源竞争难题(90%开发者忽略的RAII深度应用)
  • 选股系统适配A股修改点
  • 从 “文献迷宫” 到 “写作加速器”:大学生论文救星竟是它?paperxie 文献综述
  • 在提示词中正确调用LoRA模型并调整强度(0~1)的操作示例
  • 使用国内镜像网站加速huggingface模型下载以配合lora-scripts
  • vue+uniapp+ssm微信闲置二手物品置换系统卖家 多商家 微信小程序
  • deepin 23 一个可用 mysql-workbench 版本 8.0.36
  • 你真的会用std::shared_ptr吗?:多线程环境下资源释放陷阱全解析
  • vue+uniapp+ssm智能泊车自动停车预约系统 小程序lw