📄 asllength.c
字号:
return (0);}/******************************************************************************* * * FUNCTION: CgGenerateAmlOpcodeLength * * PARAMETERS: Op - Parse node whose AML opcode lengths will be * calculated * * RETURN: None. * * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength * fields for this node. * ******************************************************************************/static voidCgGenerateAmlOpcodeLength ( ACPI_PARSE_OBJECT *Op){ /* Check for two-byte opcode */ if (Op->Asl.AmlOpcode > 0x00FF) { Op->Asl.AmlOpcodeLength = 2; } else { Op->Asl.AmlOpcodeLength = 1; } /* Does this opcode have an associated "PackageLength" field? */ Op->Asl.AmlPkgLenBytes = 0; if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) { Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount ( Op, Op->Asl.AmlSubtreeLength); } /* Data opcode lengths are easy */ switch (Op->Asl.AmlOpcode) { case AML_BYTE_OP: Op->Asl.AmlLength = 1; break; case AML_WORD_OP: Op->Asl.AmlLength = 2; break; case AML_DWORD_OP: Op->Asl.AmlLength = 4; break; case AML_QWORD_OP: Op->Asl.AmlLength = 8; break; default: /* All data opcodes must be above */ break; }}/******************************************************************************* * * FUNCTION: CgGenerateAmlLengths * * PARAMETERS: Op - Parse node * * RETURN: None. * * DESCRIPTION: Generate internal length fields based on the AML opcode or * parse opcode. * ******************************************************************************/voidCgGenerateAmlLengths ( ACPI_PARSE_OBJECT *Op){ char *Buffer; ACPI_STATUS Status; switch (Op->Asl.AmlOpcode) { case AML_RAW_DATA_BYTE: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlLength = 1; return; case AML_RAW_DATA_WORD: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlLength = 2; return; case AML_RAW_DATA_DWORD: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlLength = 4; return; case AML_RAW_DATA_QWORD: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlLength = 8; return; case AML_RAW_DATA_BUFFER: /* Aml length is/was set by creator */ Op->Asl.AmlOpcodeLength = 0; return; case AML_RAW_DATA_CHAIN: /* Aml length is/was set by creator */ Op->Asl.AmlOpcodeLength = 0; return; default: break; } switch (Op->Asl.ParseOpcode) { case PARSEOP_DEFINITIONBLOCK: Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; break; case PARSEOP_NAMESEG: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlLength = 4; Op->Asl.ExternalName = Op->Asl.Value.String; break; case PARSEOP_NAMESTRING: case PARSEOP_METHODCALL: if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED) { break; } Op->Asl.AmlOpcodeLength = 0; Status = UtInternalizeName (Op->Asl.Value.String, &Buffer); if (ACPI_FAILURE (Status)) { DbgPrint (ASL_DEBUG_OUTPUT, "Failure from internalize name %X\n", Status); break; } Op->Asl.ExternalName = Op->Asl.Value.String; Op->Asl.Value.String = Buffer; Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED; Op->Asl.AmlLength = strlen (Buffer); /* * Check for single backslash reference to root, * make it a null terminated string in the AML */ if (Op->Asl.AmlLength == 1) { Op->Asl.AmlLength = 2; } break; case PARSEOP_STRING_LITERAL: Op->Asl.AmlOpcodeLength = 1; /* Get null terminator */ Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; break; case PARSEOP_PACKAGE_LENGTH: Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, (UINT32) Op->Asl.Value.Integer); break; case PARSEOP_RAW_DATA: Op->Asl.AmlOpcodeLength = 0; break; case PARSEOP_DEFAULT_ARG: case PARSEOP_EXTERNAL: case PARSEOP_INCLUDE: case PARSEOP_INCLUDE_END: /* Ignore the "default arg" nodes, they are extraneous at this point */ break; default: CgGenerateAmlOpcodeLength (Op); break; }}#ifdef ACPI_OBSOLETE_FUNCTIONS/******************************************************************************* * * FUNCTION: LnAdjustLengthToRoot * * PARAMETERS: Op - Node whose Length was changed * * RETURN: None. * * DESCRIPTION: Change the Subtree length of the given node, and bubble the * change all the way up to the root node. This allows for * last second changes to a package length (for example, if the * package length encoding gets shorter or longer.) * ******************************************************************************/voidLnAdjustLengthToRoot ( ACPI_PARSE_OBJECT *SubtreeOp, UINT32 LengthDelta){ ACPI_PARSE_OBJECT *Op; /* Adjust all subtree lengths up to the root */ Op = SubtreeOp->Asl.Parent; while (Op) { Op->Asl.AmlSubtreeLength -= LengthDelta; Op = Op->Asl.Parent; } /* Adjust the global table length */ Gbl_TableLength -= LengthDelta;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -