mirror of
https://github.com/acpica/acpica/
synced 2025-01-18 15:39:18 +03:00
Enhanced error checking for namepath arguments
date 2002.08.13.22.19.00; author rmoore1; state Exp;
This commit is contained in:
parent
d2ec4aba01
commit
9363391aba
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psparse - Parser top level AML parse routines
|
||||
* $Revision: 1.132 $
|
||||
* $Revision: 1.133 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -437,6 +437,13 @@ AcpiPsNextParseState (
|
||||
ParserState->Aml = WalkState->AmlLastWhile;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case AE_CTRL_SKIP:
|
||||
|
||||
ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
|
||||
Status = AE_OK;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case AE_CTRL_TRUE:
|
||||
|
||||
@ -656,9 +663,14 @@ AcpiPsParseLoop (
|
||||
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
|
||||
(GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
|
||||
{
|
||||
Arg = AcpiPsGetNextArg (ParserState,
|
||||
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
|
||||
&WalkState->ArgCount);
|
||||
Status = AcpiPsGetNextArg (ParserState,
|
||||
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
|
||||
&WalkState->ArgCount, &Arg);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto CloseThisOp;
|
||||
}
|
||||
|
||||
AcpiPsAppendArg (&PreOp, Arg);
|
||||
INCREMENT_ARG_LIST (WalkState->ArgTypes);
|
||||
}
|
||||
@ -777,8 +789,8 @@ AcpiPsParseLoop (
|
||||
if (WalkState->OpInfo)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
||||
"Opcode %4.4hX [%s] Op %p Aml %p AmlOffset %5.5X\n",
|
||||
Op->Common.AmlOpcode, WalkState->OpInfo->Name,
|
||||
"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
|
||||
(UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
|
||||
Op, ParserState->Aml, Op->Common.AmlOffset));
|
||||
}
|
||||
}
|
||||
@ -808,7 +820,19 @@ AcpiPsParseLoop (
|
||||
|
||||
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
|
||||
|
||||
AcpiPsGetNextNamepath (ParserState, Op, &WalkState->ArgCount, 1);
|
||||
Status = AcpiPsGetNextNamepath (ParserState, Op, &WalkState->ArgCount, 1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* NOT_FOUND is an error only if we are actually executing a method */
|
||||
|
||||
if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
|
||||
(Status == AE_NOT_FOUND)) ||
|
||||
(Status != AE_NOT_FOUND))
|
||||
{
|
||||
goto CloseThisOp;
|
||||
}
|
||||
}
|
||||
|
||||
WalkState->ArgTypes = 0;
|
||||
break;
|
||||
|
||||
@ -821,15 +845,27 @@ AcpiPsParseLoop (
|
||||
{
|
||||
WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
|
||||
ParserState->AmlStart);
|
||||
Arg = AcpiPsGetNextArg (ParserState,
|
||||
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
|
||||
&WalkState->ArgCount);
|
||||
Status = AcpiPsGetNextArg (ParserState,
|
||||
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
|
||||
&WalkState->ArgCount, &Arg);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* NOT_FOUND is an error only if we are actually executing a method */
|
||||
|
||||
if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
|
||||
(Status == AE_NOT_FOUND) &&
|
||||
(Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) ||
|
||||
(Status != AE_NOT_FOUND))
|
||||
{
|
||||
goto CloseThisOp;
|
||||
}
|
||||
}
|
||||
|
||||
if (Arg)
|
||||
{
|
||||
Arg->Common.AmlOffset = WalkState->AmlOffset;
|
||||
AcpiPsAppendArg (Op, Arg);
|
||||
}
|
||||
|
||||
INCREMENT_ARG_LIST (WalkState->ArgTypes);
|
||||
}
|
||||
|
||||
@ -992,15 +1028,18 @@ CloseThisOp:
|
||||
|
||||
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
|
||||
|
||||
WalkState->Op = Op;
|
||||
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
WalkState->Opcode = Op->Common.AmlOpcode;
|
||||
if (Op)
|
||||
{
|
||||
WalkState->Op = Op;
|
||||
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
WalkState->Opcode = Op->Common.AmlOpcode;
|
||||
|
||||
Status = WalkState->AscendingCallback (WalkState);
|
||||
Status = AcpiPsNextParseState (WalkState, Op, Status);
|
||||
Status = WalkState->AscendingCallback (WalkState);
|
||||
Status = AcpiPsNextParseState (WalkState, Op, Status);
|
||||
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
Op = NULL;
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
Op = NULL;
|
||||
}
|
||||
Status = AE_OK;
|
||||
break;
|
||||
|
||||
@ -1174,6 +1213,7 @@ AcpiPsParseAml (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_STATUS TerminateStatus;
|
||||
ACPI_THREAD_STATE *Thread;
|
||||
ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
|
||||
ACPI_WALK_STATE *PreviousWalkState;
|
||||
@ -1258,11 +1298,10 @@ AcpiPsParseAml (
|
||||
*/
|
||||
if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE)
|
||||
{
|
||||
Status = AcpiDsTerminateControlMethod (WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
TerminateStatus = AcpiDsTerminateControlMethod (WalkState);
|
||||
if (ACPI_FAILURE (TerminateStatus))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not terminate control method properly\n"));
|
||||
Status = AE_OK;
|
||||
|
||||
/* Ignore error and continue */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user