{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUSStatus = AE_OK;
UINT64Index;
ACPI_OPERAND_OBJECT *ThisElement;
ACPI_FUNCTION_TRACE_STR (ExOpcode_6A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
caseAML_MATCH_OP:
/* * Match (SearchPkg[0], MatchOp1[1], MatchObj1[2], * MatchOp2[3], MatchObj2[4], StartIndex[5]) *//* Validate both Match Term Operators (MTR, MEQ, etc.) */if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) ||
(Operand[3]->Integer.Value > MAX_MATCH_OPERATOR))
{
ACPI_ERROR ((AE_INFO, "Match operator out of range"));
Status = AE_AML_OPERAND_VALUE;
gotoCleanup;
}
/* Get the package StartIndex, validate against the package length */
Index = Operand[5]->Integer.Value;
if (Index >= Operand[0]->Package.Count)
{
ACPI_ERROR ((AE_INFO,
"Index (0x%8.8X%8.8X) beyond package end (0x%X)",
ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
Status = AE_AML_PACKAGE_LIMIT;
gotoCleanup;
}
/* Create an integer for the return value *//* Default return value is ACPI_UINT64_MAX if no match found */
ReturnDesc = AcpiUtCreateIntegerObject (ACPI_UINT64_MAX);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
gotoCleanup;
}
/* * Examine each element until a match is found. Both match conditions * must be satisfied for a match to occur. Within the loop, * "continue" signifies that the current element does not match * and the next should be examined. * * Upon finding a match, the loop will terminate via "break" at * the bottom. If it terminates "normally", MatchValue will be * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no * match was found. */for ( ; Index < Operand[0]->Package.Count; Index++)
{
/* Get the current package element */
ThisElement = Operand[0]->Package.Elements[Index];
/* Treat any uninitialized (NULL) elements as non-matching */if (!ThisElement)
{
continue;
}
/* * Both match conditions must be satisfied. Execution of a continue * (proceed to next iteration of enclosing for loop) signifies a * non-match. */if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
ThisElement, Operand[2]))
{
continue;
}
if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
ThisElement, Operand[4]))
{
continue;
}
/* Match found: Index is the return value */
ReturnDesc->Integer.Value = Index;
break;
}
break;
caseAML_LOAD_TABLE_OP:
Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
gotoCleanup;
}
Cleanup:
/* Delete return object on error */if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ReturnDesc);
}
/* Save return object on success */else
{
WalkState->ResultObj = ReturnDesc;
}
return_ACPI_STATUS (Status);
}
Generated on Sat May 26 2012 05:20:47 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.