news 2026/4/16 10:19:11

ACPI!ParseOpcode函数分析和全局变量acpi!OpcodeTable和acpi!ExOpcodeTable的关系

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ACPI!ParseOpcode函数分析和全局变量acpi!OpcodeTable和acpi!ExOpcodeTable的关系

ACPI!ParseOpcode函数分析和全局变量acpi!OpcodeTable和acpi!ExOpcodeTable的关系

while (!IsStackEmpty(pctxt))
{
CHKDEBUGGERREQ();
pfh = (PFRAMEHDR)pctxt->LocalHeap.pbHeapEnd;
ASSERT(pfh->pfnParse != NULL);

rc = pfh->pfnParse(pctxt, pfh, rc);


0: kd> dt _FRAMEHDR 0x8997de54
ACPI!_framehdr
+0x000 dwSig : 0x504f4353
+0x004 dwLen : 0x28
+0x008 dwfFrame : 1
+0x00c pfnParse : 0xf74274fd long ACPI!ParseScope+0

if (((rc = ParseOpcode(pctxt, pscope->pbOpEnd,
pscope->pdataResult)) !=
STATUS_SUCCESS) ||
(&pscope->FrameHdr !=


0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_ctxt *)0x8997c000)
((ACPI!_ctxt *)0x8997c000) : 0x8997c000 [Type: _ctxt *]
[+0x000] dwSig : 0x54585443 [Type: unsigned long]
[+0x004] pbCtxtEnd : 0x8997e000 : 0x54 [Type: unsigned char *]
[+0x008] listCtxt [Type: _List]
[+0x010] listQueue [Type: _List]
[+0x018] pplistCtxtQueue : 0x0 [Type: _List * *]
[+0x01c] plistResources : 0x0 [Type: _List *]
[+0x020] dwfCtxt : 0x10 [Type: unsigned long]
[+0x024] pnsObj : 0x0 [Type: _NSObj *]
[+0x028] pnsScope : 0x899affac [Type: _NSObj *]
[+0x02c] powner : 0x899af330 [Type: _objowner *]
[+0x030] pcall : 0x8997df34 [Type: _call *]
[+0x034] pnctxt : 0x0 [Type: _nestedctxt *]
[+0x038] dwSyncLevel : 0x0 [Type: unsigned long]
[+0x03c] pbOp : 0xf74c7821 : 0x5b [Type: unsigned char *]

pbOpTerm = pctxt->pbOp;
if (*pctxt->pbOp == OP_EXT_PREFIX)
{
pctxt->pbOp++;
pamlterm = FindOpcodeTerm(*pctxt->pbOp, ExOpcodeTable);
}
else
{
pamlterm = OpcodeTable[*pctxt->pbOp]; 0x5b
}


0: kd> x acpi!OpcodeTable
f74396b0 ACPI!OpcodeTable = struct _amlterm *[256]
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_amlterm * (*)[256])0xf74396b0))
(*((ACPI!_amlterm * (*)[256])0xf74396b0)) [Type: _amlterm * [256]]
[0] : 0xf7439610 [Type: _amlterm *]
[1] : 0xf7439610 [Type: _amlterm *]
[2] : 0x0 [Type: _amlterm *]
[3] : 0x0 [Type: _amlterm *]
[4] : 0x0 [Type: _amlterm *]
[5] : 0x0 [Type: _amlterm *]
[6] : 0xf7438cd0 [Type: _amlterm *]
[7] : 0x0 [Type: _amlterm *]
[8] : 0xf7438cf0 [Type: _amlterm *]
[9] : 0x0 [Type: _amlterm *]
[10] : 0xf7439610 [Type: _amlterm *]
[11] : 0xf7439610 [Type: _amlterm *]
[12] : 0xf7439610 [Type: _amlterm *]
[13] : 0xf7439630 [Type: _amlterm *]
[14] : 0x0 [Type: _amlterm *]
[15] : 0x0 [Type: _amlterm *]
[16] : 0xf7438d10 [Type: _amlterm *]
[17] : 0xf7439190 [Type: _amlterm *]
[18] : 0xf74394b0 [Type: _amlterm *]
[19] : 0x0 [Type: _amlterm *]
[20] : 0xf7438e70 [Type: _amlterm *]
[21] : 0x0 [Type: _amlterm *]
[22] : 0x0 [Type: _amlterm *]
[23] : 0x0 [Type: _amlterm *]
[24] : 0x0 [Type: _amlterm *]
[25] : 0x0 [Type: _amlterm *]
[26] : 0x0 [Type: _amlterm *]
[27] : 0x0 [Type: _amlterm *]
[28] : 0x0 [Type: _amlterm *]
[29] : 0x0 [Type: _amlterm *]
[30] : 0x0 [Type: _amlterm *]
[31] : 0x0 [Type: _amlterm *]
[32] : 0x0 [Type: _amlterm *]
[33] : 0x0 [Type: _amlterm *]
[34] : 0x0 [Type: _amlterm *]
[35] : 0x0 [Type: _amlterm *]
[36] : 0x0 [Type: _amlterm *]
[37] : 0x0 [Type: _amlterm *]
[38] : 0x0 [Type: _amlterm *]
[39] : 0x0 [Type: _amlterm *]
[40] : 0x0 [Type: _amlterm *]
[41] : 0x0 [Type: _amlterm *]
[42] : 0x0 [Type: _amlterm *]
[43] : 0x0 [Type: _amlterm *]
[44] : 0x0 [Type: _amlterm *]
[45] : 0x0 [Type: _amlterm *]
[46] : 0xf74395f0 [Type: _amlterm *]
[47] : 0xf74395f0 [Type: _amlterm *]
[48] : 0x0 [Type: _amlterm *]
[49] : 0x0 [Type: _amlterm *]
[50] : 0x0 [Type: _amlterm *]
[51] : 0x0 [Type: _amlterm *]
[52] : 0x0 [Type: _amlterm *]
[53] : 0x0 [Type: _amlterm *]
[54] : 0x0 [Type: _amlterm *]
[55] : 0x0 [Type: _amlterm *]
[56] : 0x0 [Type: _amlterm *]
[57] : 0x0 [Type: _amlterm *]
[58] : 0x0 [Type: _amlterm *]
[59] : 0x0 [Type: _amlterm *]
[60] : 0x0 [Type: _amlterm *]
[61] : 0x0 [Type: _amlterm *]
[62] : 0x0 [Type: _amlterm *]
[63] : 0x0 [Type: _amlterm *]
[64] : 0x0 [Type: _amlterm *]
[65] : 0xf74395f0 [Type: _amlterm *]
[66] : 0xf74395f0 [Type: _amlterm *]
[67] : 0xf74395f0 [Type: _amlterm *]
[68] : 0xf74395f0 [Type: _amlterm *]
[69] : 0xf74395f0 [Type: _amlterm *]
[70] : 0xf74395f0 [Type: _amlterm *]
[71] : 0xf74395f0 [Type: _amlterm *]
[72] : 0xf74395f0 [Type: _amlterm *]
[73] : 0xf74395f0 [Type: _amlterm *]
[74] : 0xf74395f0 [Type: _amlterm *]
[75] : 0xf74395f0 [Type: _amlterm *]
[76] : 0xf74395f0 [Type: _amlterm *]
[77] : 0xf74395f0 [Type: _amlterm *]
[78] : 0xf74395f0 [Type: _amlterm *]
[79] : 0xf74395f0 [Type: _amlterm *]
[80] : 0xf74395f0 [Type: _amlterm *]
[81] : 0xf74395f0 [Type: _amlterm *]
[82] : 0xf74395f0 [Type: _amlterm *]
[83] : 0xf74395f0 [Type: _amlterm *]
[84] : 0xf74395f0 [Type: _amlterm *]
[85] : 0xf74395f0 [Type: _amlterm *]
[86] : 0xf74395f0 [Type: _amlterm *]
[87] : 0xf74395f0 [Type: _amlterm *]
[88] : 0xf74395f0 [Type: _amlterm *]
[89] : 0xf74395f0 [Type: _amlterm *]
[90] : 0xf74395f0 [Type: _amlterm *]
[91] : 0x0 [Type: _amlterm *]没有
[92] : 0xf74395f0 [Type: _amlterm *]
[93] : 0x0 [Type: _amlterm *]
[94] : 0xf74395f0 [Type: _amlterm *]
[95] : 0xf74395f0 [Type: _amlterm *]
[96] : 0xf7439670 [Type: _amlterm *]
[97] : 0xf7439670 [Type: _amlterm *]
[98] : 0xf7439670 [Type: _amlterm *]
[99] : 0xf7439670 [Type: _amlterm *]
[...] [Type: _amlterm * [256]]
0: kd> ?5b
Evaluate expression: 91 = 0000005b


0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_amlterm *)0xf74395f0)
((ACPI!_amlterm *)0xf74395f0) : 0xf74395f0 [Type: _amlterm *]
[+0x000] pszTermName : 0x0 [Type: char *]
[+0x004] dwOpcode : 0xffffffff [Type: unsigned long]
[+0x008] pszArgTypes : 0x0 [Type: char *]
[+0x00c] dwTermClass : 0x5 [Type: unsigned long]
[+0x010] dwfOpcode : 0x20 [Type: unsigned long] dwfOpcode : 0x20
[+0x014] pfnCallBack : 0x0 [Type: long (__cdecl*)(unsigned long,unsigned long,_NSObj *,unsigned long)]
[+0x018] dwCBData : 0x0 [Type: unsigned long]
[+0x01c] pfnOpcode : 0x0 [Type: long (__cdecl*)()]


#define OP_EXT_PREFIX 0x5b // '['


pbOpTerm = pctxt->pbOp;
if (*pctxt->pbOp == OP_EXT_PREFIX)
{
pctxt->pbOp++;
pamlterm = FindOpcodeTerm(*pctxt->pbOp, ExOpcodeTable);
}

0: kd> db 0xf74c7821
f74c7821 5b 80 52 45 47 53 02 0a-50 0a 30 5b 81 40 07 52 [.REGS..P.0[.@.R
f74c7831 45 47 53 03 00 48 04 50-41 4d 30 08 50 41 4d 31 EGS..H.PAM0.PAM1
f74c7841 08 50 41 4d 32 08 50 41-4d 33 08 50 41 4d 34 08 .PAM2.PAM3.PAM4.
f74c7851 50 41 4d 35 08 50 41 4d-36 08 44 52 42 30 08 44 PAM5.PAM6.DRB0.D
f74c7861 52 42 31 08 44 52 42 32-08 44 52 42 33 08 44 52 RB1.DRB2.DRB3.DR
f74c7871 42 34 08 44 52 42 35 08-44 52 42 36 08 44 52 42 B4.DRB5.DRB6.DRB
f74c7881 37 08 00 06 48 45 4e 5f-02 00 40 05 54 5f 45 4e 7...HEN_..@.T_EN
f74c7891 01 54 5f 53 5a 02 00 35-43 52 53 54 01 5b 80 52 .T_SZ..5CRST.[.R

80

0: kd> x acpi!ExOpcodeTable
f7439ab0 ACPI!ExOpcodeTable = struct _opcodemap []
f7439ab0 ACPI!ExOpcodeTable = struct _opcodemap [27]
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_opcodemap (*)[27])0xf7439ab0))
(*((ACPI!_opcodemap (*)[27])0xf7439ab0)) [Type: _opcodemap [27]]
[0] [Type: _opcodemap]
[1] [Type: _opcodemap]
[2] [Type: _opcodemap]
[3] [Type: _opcodemap]
[4] [Type: _opcodemap]
[5] [Type: _opcodemap]
[6] [Type: _opcodemap]
[7] [Type: _opcodemap]
[8] [Type: _opcodemap]
[9] [Type: _opcodemap]
[10] [Type: _opcodemap]
[11] [Type: _opcodemap]
[12] [Type: _opcodemap]
[13] [Type: _opcodemap]
[14] [Type: _opcodemap]
[15] [Type: _opcodemap]
[16] [Type: _opcodemap]
[17] [Type: _opcodemap]
[18] [Type: _opcodemap]
[19] [Type: _opcodemap]
[20] [Type: _opcodemap]
[21] [Type: _opcodemap]
[22] [Type: _opcodemap]
[23] [Type: _opcodemap]
[24] [Type: _opcodemap]
[25] [Type: _opcodemap]
[26] [Type: _opcodemap]

0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_opcodemap *)0xf7439ab0))
(*((ACPI!_opcodemap *)0xf7439ab0)) [Type: _opcodemap]
[+0x000] dwOpcode : 0x1 [Type: unsigned long]
[+0x004] pamlterm : 0xf7438e90 [Type: _amlterm *]
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_opcodemap *)0xf7439ab8))
(*((ACPI!_opcodemap *)0xf7439ab8)) [Type: _opcodemap]
[+0x000] dwOpcode : 0x2 [Type: unsigned long]
[+0x004] pamlterm : 0xf7438e10 [Type: _amlterm *]
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_opcodemap *)0xf7439ac0))
(*((ACPI!_opcodemap *)0xf7439ac0)) [Type: _opcodemap]
[+0x000] dwOpcode : 0x12 [Type: unsigned long]
[+0x004] pamlterm : 0xf74391d0 [Type: _amlterm *]
0: kd> dd 0xf7439ab0
f7439ab0 00000001 f7438e90 00000002 f7438e10
f7439ac0 00000012 f74391d0 00000013 f7438db0
f7439ad0 00000020 f7438fd0 00000021 f74390d0
f7439ae0 00000022 f74390b0 00000023 f7439130
f7439af0 00000024 f7439090 00000025 f74395b0
f7439b00 00000026 f7439050 00000027 f7439030
f7439b10 00000028 f7439290 00000029 f7439590
f7439b20 0000002a f74390f0 00000030 f7439610
0: kd> dd 0xf7439ab0+80
f7439b30 00000031 f7439690 00000032 f7438f90
f7439b4000000080 f7438eb000000081 f7438e30
f7439b50 00000082 f7438df0 00000083 f7438ef0
f7439b60 00000084 f7438ed0 00000085 f7438f10
f7439b70 00000086 f7438e50 00000087 f7438d30
f7439b80 00000000 00000000 00000000 00000005
f7439b90 00000000 00000000 00000000 f7415b0b
f7439ba0 00000000 00000000 00000000 00000000

0: kd> x acpi!FindOpcodeTerm
f741a799 ACPI!FindOpcodeTerm (unsigned long, struct _opcodemap *)

PAMLTERM LOCAL FindOpcodeTerm(ULONG dwOp, POPCODEMAP pOpTable)
{
TRACENAME("FINDOPCODETERM")
PAMLTERM pamlterm = NULL;

ENTER(3, ("FindOpcodeTerm(Op=%x,pOpTable=%x)\n", dwOp, pOpTable));

while (pOpTable->pamlterm != NULL)
{
if (dwOp == pOpTable->dwOpcode)
{
pamlterm = pOpTable->pamlterm;
break;
}
else
pOpTable++;
}

EXIT(3, ("FindOpcodeTerm=%x\n", pamlterm));
return pamlterm;
} //FindOpcodeTerm

f7439b40 00000080 f7438eb0

0: kd> dt ACPI!_amlterm f7438eb0
+0x000 pszTermName : 0xf742c6a0 "OperationRegion"
+0x004 dwOpcode : 0x805b
+0x008 pszArgTypes : 0xf742c698 "NBCC"
+0x00c dwTermClass : 2
+0x010 dwfOpcode : 0
+0x014 pfnCallBack : (null)
+0x018 dwCBData : 0
+0x01c pfnOpcode : 0xf742190e long ACPI!OpRegion+0

0: kd> gu
eax=f7438eb0 ebx=8997c000 ecx=f7438eb0 edx=899af000 esi=8997c03c edi=f74c7821
eip=f742727e esp=f789a0f4 ebp=f789a108 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!ParseOpcode+0x96:
f742727e 59 pop ecx

eax=f7438eb0 正确!!!


pbOpTerm = pctxt->pbOp;
if (*pctxt->pbOp == OP_EXT_PREFIX)
{
pctxt->pbOp++;
pamlterm = FindOpcodeTerm(*pctxt->pbOp, ExOpcodeTable); 返回到这里:
}


// dwfOpcode flags
#define OF_VARIABLE_LIST 0x00000001
#define OF_ARG_OBJECT 0x00000002
#define OF_LOCAL_OBJECT 0x00000004
#define OF_DATA_OBJECT 0x00000008
#define OF_STRING_OBJECT 0x00000010
#define OF_NAME_OBJECT 0x00000020
#define OF_DEBUG_OBJECT 0x00000040
#define OF_REF_OBJECT 0x00000080
#define OF_CALLBACK_EX 0x80000000

NTSTATUS LOCAL ParseOpcode(PCTXT pctxt, PUCHAR pbScopeEnd, POBJDATA pdataResult)
{


。。。。 说明:rc = ParseIntObj(&pctxt->pbOp, pdataResult, FALSE);结果放到pdataResult,返回 说明:

if (pamlterm == NULL)
{
rc = AMLI_LOGERR(AMLIERR_INVALID_OPCODE,
("ParseOpcode: invalid opcode 0x%02x at 0x%08x",
*pctxt->pbOp, pctxt->pbOp));
}
else if (pamlterm->dwfOpcode & OF_DATA_OBJECT)
{
rc = ParseIntObj(&pctxt->pbOp, pdataResult, FALSE);
}
else if (pamlterm->dwfOpcode & OF_STRING_OBJECT)
{
rc = ParseString(&pctxt->pbOp, pdataResult, FALSE);
}
else if (pamlterm->dwfOpcode & OF_ARG_OBJECT)
{
rc = ParseArgObj(pctxt, pdataResult);
}
else if (pamlterm->dwfOpcode & OF_LOCAL_OBJECT)
{
rc = ParseLocalObj(pctxt, pdataResult);
}
else if (pamlterm->dwfOpcode & OF_NAME_OBJECT)
{
rc = ParseNameObj(pctxt, pdataResult);
}
else if (pamlterm->dwfOpcode & OF_DEBUG_OBJECT)
{
rc = AMLI_LOGERR(AMLIERR_FATAL,
("ParseOpcode: debug object cannot be evaluated"));
}
else
{
//
// Must be an ASL Term.
//
pctxt->pbOp++;
rc = PushTerm(pctxt, pbOpTerm, pbScopeEnd, pamlterm, pdataResult);
}

NTSTATUS LOCAL PushTerm(PCTXT pctxt, PUCHAR pbOpTerm, PUCHAR pbScopeEnd,
PAMLTERM pamlterm, POBJDATA pdataResult)
{
TRACENAME("PUSHTERM")
NTSTATUS rc = STATUS_SUCCESS;
PTERM pterm;

ENTER(2, ("PushTerm(pctxt=%x,pbOpTerm=%x,pbScopeEnd=%x,pamlterm=%x,pdataResult=%x)\n",
pctxt, pbOpTerm, pbScopeEnd, pamlterm, pdataResult));

if ((rc = PushFrame(pctxt, SIG_TERM, sizeof(TERM), ParseTerm, &pterm)) ==
STATUS_SUCCESS)
{
pterm->pbOpTerm = pbOpTerm;
pterm->pbScopeEnd = pbScopeEnd;
pterm->pamlterm = pamlterm;
pterm->pdataResult = pdataResult;
pterm->icArgs = pamlterm->pszArgTypes? STRLEN(pamlterm->pszArgTypes): 0;
if (pterm->icArgs > 0)
{
if ((pterm->pdataArgs = NEWODOBJ(pctxt->pheapCurrent,
sizeof(OBJDATA)*pterm->icArgs)) ==
NULL)
{
rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
("PushTerm: failed to allocate argument objects"));
}
else
{
MEMZERO(pterm->pdataArgs, sizeof(OBJDATA)*pterm->icArgs);
}
}
}

EXIT(2, ("PushTerm=%x (pterm=%x)\n", rc, pterm));
return rc;
} //PushTerm

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/16 10:16:15

物理AI开启智能机器新时代:超越传统自动化

如今,如果有人在Spanx公司的网站上订购塑身衣,处理包裹的是一台人形机器人。在乔治亚州GXO物流公司的配送中心,Agility Robotics公司的双足机器人正以机械般的精准度搬运货物。而在宝马集团的斯帕坦堡工厂,Figure 02机器人在将钣金…

作者头像 李华
网站建设 2026/4/14 23:58:30

GLM-TTS支持中英混合语音合成,助力国际化内容创作

GLM-TTS 实现中英混合语音合成,赋能全球化内容创作 在短视频、在线教育和数字人播报日益普及的今天,创作者对语音合成的需求早已超越“能说话”这一基础功能。人们期待的是自然、富有情感、支持多语言切换,并能复刻特定音色的声音输出——尤其…

作者头像 李华
网站建设 2026/4/15 16:06:16

GLM-TTS模型结构浅析:理解其背后的深度学习原理

GLM-TTS模型结构浅析:理解其背后的深度学习原理 在虚拟主播声线定制、有声书自动朗读和智能客服语音生成这些场景中,我们越来越不满足于“能说话”的TTS系统——用户期待的是像真人一样富有情感、发音精准且音色可定制的语音输出。然而,传统T…

作者头像 李华
网站建设 2026/4/13 18:11:11

RAG架构从入门到精通,一篇搞定AI“胡说八道”,收藏这一篇就够了!

你的聊天机器人自信地告诉顾客,你们的退货政策是90天,但实际上是30天。之后,它还描述了一些你们产品根本不具备的功能。 这就是优秀的演示系统与实际生产系统之间的差距。语言模型即使出错,听起来也很可靠,但在生产环境…

作者头像 李华