Several fixes for internal method result stack.

fixes STACK_OVERFLOW exception on nested method calls. internal bugzilla 262 and 275.
This commit is contained in:
rmoore1 2007-03-08 20:26:06 +00:00
parent e7f1c526ce
commit 7e357a5031
12 changed files with 233 additions and 574 deletions

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 1.119 $
* $Revision: 1.120 $
*
******************************************************************************/
@ -580,8 +580,10 @@ AcpiDbDisplayResults (
UINT32 i;
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
UINT32 NumResults = 0;
UINT32 ResultCount = 0;
ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_STATE *Frame;
UINT32 Index; /* Index onto current frame */
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
@ -596,17 +598,28 @@ AcpiDbDisplayResults (
if (WalkState->Results)
{
NumResults = WalkState->Results->Results.NumResults;
ResultCount = WalkState->ResultCount;
}
AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
AcpiUtGetNodeName (Node), NumResults);
AcpiUtGetNodeName (Node), ResultCount);
for (i = 0; i < NumResults; i++)
/* From the top element of result stack */
Frame = WalkState->Results;
Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
for (i = 0; i < ResultCount; i++)
{
ObjDesc = WalkState->Results->Results.ObjDesc[i];
ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%d: ", i);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
if (Index == 0)
{
Frame = Frame->Results.Next;
Index = ACPI_RESULTS_FRAME_OBJ_NUM;
}
Index--;
}
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
* $Revision: 1.100 $
* $Revision: 1.101 $
*
******************************************************************************/
@ -615,13 +615,15 @@ AcpiDmDisassembleOneOp (
if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
(WalkState) &&
(WalkState->Results) &&
(WalkState->Results->Results.NumResults))
(WalkState->ResultCount))
{
AcpiDmDecodeInternalObject (
WalkState->Results->Results.ObjDesc [
WalkState->Results->Results.NumResults-1]);
(WalkState->ResultCount - 1) %
ACPI_RESULTS_FRAME_OBJ_NUM]);
}
#endif
break;
}
}

View File

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.110 $
* $Revision: 1.111 $
*
*****************************************************************************/
@ -947,6 +947,12 @@ AcpiDsEvalDataObjectOperands (
/* The first operand (for all of these data objects) is the length */
/*
* Set proper index into operand stack for AcpiDsObjStackPush
* invoked inside AcpiDsCreateOperand.
*/
WalkState->OperandIndex = WalkState->NumOperands;
Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
if (ACPI_FAILURE (Status))
{
@ -1217,8 +1223,7 @@ AcpiDsExecEndControlOp (
*/
WalkState->ReturnDesc = WalkState->Operands[0];
}
else if ((WalkState->Results) &&
(WalkState->Results->Results.NumResults > 0))
else if (WalkState->ResultCount)
{
/* Since we have a real Return(), delete any implicit return */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.122 $
* $Revision: 1.123 $
*
******************************************************************************/
@ -753,7 +753,7 @@ AcpiDsCreateOperand (
* Use value that was already previously returned
* by the evaluation of this argument
*/
Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
/*
@ -823,30 +823,59 @@ AcpiDsCreateOperands (
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg;
UINT32 ArgCount = 0;
ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
UINT8 ArgCount = 0;
UINT8 Count = 0;
UINT8 Index = WalkState->NumOperands;
UINT8 i;
ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);
/* For all arguments in the list... */
/* Get all arguments in the list */
Arg = FirstArg;
while (Arg)
{
Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
if (ACPI_FAILURE (Status))
if (Index >= ACPI_OBJ_NUM_OPERANDS)
{
goto Cleanup;
return_ACPI_STATUS (AE_BAD_DATA);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
ArgCount, Arg, FirstArg));
Arguments[Index] = Arg;
WalkState->Operands [Index] = NULL;
/* Move on to next argument, if any */
Arg = Arg->Common.Next;
ArgCount++;
Index++;
}
Index--;
/* It is the appropriate order to get objects from the Result stack */
for (i = 0; i < ArgCount; i++)
{
Arg = Arguments[Index];
/* Force the filling of the operand stack in inverse order */
WalkState->OperandIndex = Index;
Status = AcpiDsCreateOperand (WalkState, Arg, Index);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Count++;
Index--;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
Index, Arg, FirstArg));
}
return_ACPI_STATUS (Status);
@ -858,10 +887,9 @@ Cleanup:
* pop everything off of the operand stack and delete those
* objects
*/
(void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d",
(ArgCount + 1)));
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.132 $
* $Revision: 1.133 $
*
*****************************************************************************/
@ -383,12 +383,6 @@ AcpiDsExecBeginOp (
{
case AML_CLASS_CONTROL:
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
Status = AcpiDsExecBeginControlOp (WalkState, Op);
break;
@ -406,23 +400,12 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (WalkState, NULL);
}
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
Status = AcpiDsResultStackPush (WalkState);
}
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
/*
* Most operators with arguments (except CreateXxxField operators)
* Start a new result/operand state
*/
if (WalkState->OpInfo->ObjectType != ACPI_TYPE_BUFFER_FIELD)
{
Status = AcpiDsResultStackPush (WalkState);
}
break;
@ -485,6 +468,7 @@ AcpiDsExecEndOp (
/* Init the walk state */
WalkState->NumOperands = 0;
WalkState->OperandIndex = 0;
WalkState->ReturnDesc = NULL;
WalkState->ResultObj = NULL;
@ -511,14 +495,6 @@ AcpiDsExecEndOp (
goto Cleanup;
}
/* Done with this result state (Now that operand stack is built) */
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* All opcodes require operand resolution, with the only exceptions
* being the ObjectType and SizeOf operators.
@ -598,20 +574,6 @@ AcpiDsExecEndOp (
Status = AcpiDsExecEndControlOp (WalkState, Op);
/* Make sure to properly pop the result stack */
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPop (WalkState);
}
else if (Status == AE_CTRL_PENDING)
{
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_PENDING;
}
}
break;
@ -738,14 +700,6 @@ AcpiDsExecEndOp (
break;
}
/* Done with result state (Now that operand stack is built) */
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* If a result object was returned from above, push it on the
* current result stack
@ -778,8 +732,6 @@ AcpiDsExecEndOp (
{
break;
}
Status = AcpiDsResultStackPop (WalkState);
}
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.99 $
* $Revision: 1.100 $
*
*****************************************************************************/
@ -127,96 +127,14 @@
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_STATUS
AcpiDsResultInsert (
void *Object,
UINT32 Index,
static ACPI_STATUS
AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsObjStackDeleteAll (
static ACPI_STATUS
AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsObjStackPopObject (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState);
void *
AcpiDsObjStackGetValue (
UINT32 Index,
ACPI_WALK_STATE *WalkState);
#endif
/*******************************************************************************
*
* FUNCTION: AcpiDsResultRemove
*
* PARAMETERS: Object - Where to return the popped object
* Index - Where to extract the object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultRemove (
ACPI_OPERAND_OBJECT **Object,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_FUNCTION_NAME (DsResultRemove);
State = WalkState->Results;
if (!State)
{
ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p",
WalkState));
return (AE_NOT_EXIST);
}
if (Index >= ACPI_OBJ_MAX_OPERAND)
{
ACPI_ERROR ((AE_INFO,
"Index out of range: %X State=%p Num=%X",
Index, WalkState, State->Results.NumResults));
}
/* Check for a valid result object */
if (!State->Results.ObjDesc [Index])
{
ACPI_ERROR ((AE_INFO,
"Null operand! State=%p #Ops=%X, Index=%X",
WalkState, State->Results.NumResults, Index));
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove the object */
State->Results.NumResults--;
*Object = State->Results.ObjDesc [Index];
State->Results.ObjDesc [Index] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
Index, WalkState, State->Results.NumResults));
return (AE_OK);
}
/*******************************************************************************
*
@ -227,8 +145,7 @@ AcpiDsResultRemove (
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
* DESCRIPTION: Pop an object off the top of this walk's result stack
*
******************************************************************************/
@ -239,120 +156,63 @@ AcpiDsResultPop (
{
ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
ACPI_STATUS Status;
ACPI_FUNCTION_NAME (DsResultPop);
State = WalkState->Results;
if (!State)
/* Incorrect state of result stack */
if (State && !WalkState->ResultCount)
{
return (AE_OK);
ACPI_ERROR ((AE_INFO, "No results on result stack"));
return (AE_AML_INTERNAL);
}
if (!State->Results.NumResults)
if (!State && WalkState->ResultCount)
{
ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p",
ACPI_ERROR ((AE_INFO, "No result state for result stack"));
return (AE_AML_INTERNAL);
}
/* Empty result stack */
if (!State)
{
ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
/* Return object of the top element and clean that top element result stack */
WalkState->ResultCount--;
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
*Object = State->Results.ObjDesc [Index];
if (!*Object)
{
ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p",
WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove top element */
State->Results.NumResults--;
for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
State->Results.ObjDesc [Index] = NULL;
if (Index == 0)
{
/* Check for a valid result object */
if (State->Results.ObjDesc [Index -1])
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
*Object = State->Results.ObjDesc [Index -1];
State->Results.ObjDesc [Index -1] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
*Object,
(*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
(UINT32) Index -1, WalkState, State->Results.NumResults));
return (AE_OK);
return (Status);
}
}
ACPI_ERROR ((AE_INFO,
"No result objects! State=%p", WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPopFromBottom
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultPopFromBottom (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
ACPI_FUNCTION_NAME (DsResultPopFromBottom);
State = WalkState->Results;
if (!State)
{
ACPI_ERROR ((AE_INFO,
"No result object pushed! State=%p", WalkState));
return (AE_NOT_EXIST);
}
if (!State->Results.NumResults)
{
ACPI_ERROR ((AE_INFO, "No result objects! State=%p",
WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove Bottom element */
*Object = State->Results.ObjDesc [0];
/* Push entire stack down one element */
for (Index = 0; Index < State->Results.NumResults; Index++)
{
State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
}
State->Results.NumResults--;
/* Check for a valid result object */
if (!*Object)
{
ACPI_ERROR ((AE_INFO,
"Null operand! State=%p #Ops=%X Index=%X",
WalkState, State->Results.NumResults, (UINT32) Index));
return (AE_AML_NO_RETURN_VALUE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
State, WalkState));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object,
AcpiUtGetObjectTypeName (*Object),
(UINT32) Index, WalkState, WalkState->ResultCount));
return (AE_OK);
}
@ -377,11 +237,36 @@ AcpiDsResultPush (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_STATUS Status;
ACPI_NATIVE_UINT Index;
ACPI_FUNCTION_NAME (DsResultPush);
if (WalkState->ResultCount > WalkState->ResultSize)
{
ACPI_ERROR ((AE_INFO, "Result stack is full"));
return (AE_AML_INTERNAL);
}
else if (WalkState->ResultCount == WalkState->ResultSize)
{
/* Extend the result stack */
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Failed to extend the result stack"));
return (Status);
}
}
if (!(WalkState->ResultCount < WalkState->ResultSize))
{
ACPI_ERROR ((AE_INFO, "No free elements in result stack"));
return (AE_AML_INTERNAL);
}
State = WalkState->Results;
if (!State)
{
@ -389,28 +274,23 @@ AcpiDsResultPush (
return (AE_AML_INTERNAL);
}
if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
{
ACPI_ERROR ((AE_INFO,
"Result stack overflow: Obj=%p State=%p Num=%X",
Object, WalkState, State->Results.NumResults));
return (AE_STACK_OVERFLOW);
}
if (!Object)
{
ACPI_ERROR ((AE_INFO,
"Null Object! Obj=%p State=%p Num=%X",
Object, WalkState, State->Results.NumResults));
Object, WalkState, WalkState->ResultCount));
return (AE_BAD_PARAMETER);
}
State->Results.ObjDesc [State->Results.NumResults] = Object;
State->Results.NumResults++;
/* Assign the address of object to the top free element of result stack */
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
State->Results.ObjDesc [Index] = Object;
WalkState->ResultCount++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
WalkState, State->Results.NumResults, WalkState->CurrentResult));
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
WalkState, WalkState->ResultCount, WalkState->CurrentResult));
return (AE_OK);
}
@ -424,19 +304,30 @@ AcpiDsResultPush (
*
* RETURN: Status
*
* DESCRIPTION: Push an object onto the WalkState result stack.
* DESCRIPTION: Push an object onto the WalkState result stack
*
******************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_FUNCTION_NAME (DsResultStackPush);
/* Check for stack overflow */
if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
ACPI_RESULTS_OBJ_NUM_MAX)
{
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
WalkState, WalkState->ResultSize));
return (AE_STACK_OVERFLOW);
}
State = AcpiUtCreateGenericState ();
if (!State)
{
@ -446,6 +337,10 @@ AcpiDsResultStackPush (
State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT;
AcpiUtPushGenericState (&WalkState->Results, State);
/* Increase the length of the result stack by the length of frame */
WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
State, WalkState));
@ -461,16 +356,17 @@ AcpiDsResultStackPush (
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off of the WalkState result stack.
* DESCRIPTION: Pop an object off of the WalkState result stack
*
******************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_FUNCTION_NAME (DsResultStackPop);
@ -478,18 +374,27 @@ AcpiDsResultStackPop (
if (WalkState->Results == NULL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n",
WalkState));
return (AE_AML_NO_OPERAND);
}
if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM)
{
ACPI_ERROR ((AE_INFO, "Insufficient result stack size"));
return (AE_AML_INTERNAL);
}
State = AcpiUtPopGenericState (&WalkState->Results);
AcpiUtDeleteGenericState (State);
/* Decrease the length of result stack by the length of frame */
WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Result=%p RemainingResults=%X State=%p\n",
State, State->Results.NumResults, WalkState));
AcpiUtDeleteGenericState (State);
State, WalkState->ResultCount, WalkState));
return (AE_OK);
}
@ -528,12 +433,16 @@ AcpiDsObjStackPush (
/* Put the object onto the stack */
WalkState->Operands [WalkState->NumOperands] = Object;
WalkState->Operands [WalkState->OperandIndex] = Object;
WalkState->NumOperands++;
/* For the usual order of filling the operand stack */
WalkState->OperandIndex++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
WalkState, WalkState->NumOperands));
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
WalkState, WalkState->NumOperands));
return (AE_OK);
}
@ -560,6 +469,7 @@ AcpiDsObjStackPop (
{
UINT32 i;
ACPI_FUNCTION_NAME (DsObjStackPop);
@ -582,7 +492,7 @@ AcpiDsObjStackPop (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
PopCount, WalkState, WalkState->NumOperands));
PopCount, WalkState, WalkState->NumOperands));
return (AE_OK);
}
@ -602,7 +512,7 @@ AcpiDsObjStackPop (
*
******************************************************************************/
ACPI_STATUS
void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState)
@ -614,33 +524,31 @@ AcpiDsObjStackPopAndDelete (
ACPI_FUNCTION_NAME (DsObjStackPopAndDelete);
for (i = 0; i < PopCount; i++)
if (PopCount == 0)
{
/* Check for stack underflow */
return;
}
for (i = (PopCount - 1); i >= 0; i--)
{
if (WalkState->NumOperands == 0)
{
ACPI_ERROR ((AE_INFO,
"Object stack underflow! Count=%X State=%p #Ops=%X",
PopCount, WalkState, WalkState->NumOperands));
return (AE_STACK_UNDERFLOW);
return;
}
/* Pop the stack and delete an object if present in this stack entry */
WalkState->NumOperands--;
ObjDesc = WalkState->Operands [WalkState->NumOperands];
ObjDesc = WalkState->Operands [i];
if (ObjDesc)
{
AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
WalkState->Operands [WalkState->NumOperands] = NULL;
AcpiUtRemoveReference (WalkState->Operands [i]);
WalkState->Operands [i] = NULL;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
PopCount, WalkState, WalkState->NumOperands));
return (AE_OK);
PopCount, WalkState, WalkState->NumOperands));
}
@ -660,7 +568,6 @@ AcpiDsObjStackPopAndDelete (
ACPI_WALK_STATE *
AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread)
{
ACPI_FUNCTION_NAME (DsGetCurrentWalkState);
@ -686,7 +593,7 @@ AcpiDsGetCurrentWalkState (
*
* RETURN: None
*
* DESCRIPTION: Place the Thread state at the head of the state list.
* DESCRIPTION: Place the Thread state at the head of the state list
*
******************************************************************************/
@ -698,7 +605,7 @@ AcpiDsPushWalkState (
ACPI_FUNCTION_TRACE (DsPushWalkState);
WalkState->Next = Thread->WalkStateList;
WalkState->Next = Thread->WalkStateList;
Thread->WalkStateList = WalkState;
return_VOID;
@ -772,7 +679,6 @@ AcpiDsCreateWalkState (
ACPI_THREAD_STATE *Thread)
{
ACPI_WALK_STATE *WalkState;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (DsCreateWalkState);
@ -798,15 +704,6 @@ AcpiDsCreateWalkState (
AcpiDsMethodDataInit (WalkState);
#endif
/* Create an initial result stack entry */
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (WalkState);
return_PTR (NULL);
}
/* Put the new state at the head of the walk list */
if (Thread)
@ -1027,209 +924,4 @@ AcpiDsDeleteWalkState (
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiDsResultInsert
*
* PARAMETERS: Object - Object to push
* Index - Where to insert the object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Insert an object onto this walk's result stack
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultInsert (
void *Object,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
ACPI_FUNCTION_NAME (DsResultInsert);
State = WalkState->Results;
if (!State)
{
ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p",
WalkState));
return (AE_NOT_EXIST);
}
if (Index >= ACPI_OBJ_NUM_OPERANDS)
{
ACPI_ERROR ((AE_INFO,
"Index out of range: %X Obj=%p State=%p Num=%X",
Index, Object, WalkState, State->Results.NumResults));
return (AE_BAD_PARAMETER);
}
if (!Object)
{
ACPI_ERROR ((AE_INFO,
"Null Object! Index=%X Obj=%p State=%p Num=%X",
Index, Object, WalkState, State->Results.NumResults));
return (AE_BAD_PARAMETER);
}
State->Results.ObjDesc [Index] = Object;
State->Results.NumResults++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
WalkState, State->Results.NumResults, WalkState->CurrentResult));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsObjStackDeleteAll
*
* PARAMETERS: WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Clear the object stack by deleting all objects that are on it.
* Should be used with great care, if at all!
*
******************************************************************************/
ACPI_STATUS
AcpiDsObjStackDeleteAll (
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
ACPI_FUNCTION_TRACE_PTR (DsObjStackDeleteAll, WalkState);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
{
if (WalkState->Operands[i])
{
AcpiUtRemoveReference (WalkState->Operands[i]);
WalkState->Operands[i] = NULL;
}
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsObjStackPopObject
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
* deleted by this routine.
*
******************************************************************************/
ACPI_STATUS
AcpiDsObjStackPopObject (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_NAME (DsObjStackPopObject);
/* Check for stack underflow */
if (WalkState->NumOperands == 0)
{
ACPI_ERROR ((AE_INFO,
"Missing operand/stack empty! State=%p #Ops=%X",
WalkState, WalkState->NumOperands));
*Object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
WalkState->NumOperands--;
/* Check for a valid operand */
if (!WalkState->Operands [WalkState->NumOperands])
{
ACPI_ERROR ((AE_INFO,
"Null operand! State=%p #Ops=%X",
WalkState, WalkState->NumOperands));
*Object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Get operand and set stack entry to null */
*Object = WalkState->Operands [WalkState->NumOperands];
WalkState->Operands [WalkState->NumOperands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*Object, AcpiUtGetObjectTypeName (*Object),
WalkState, WalkState->NumOperands));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsObjStackGetValue
*
* PARAMETERS: Index - Stack index whose value is desired. Based
* on the top of the stack (index=0 == top)
* WalkState - Current Walk state
*
* RETURN: Pointer to the requested operand
*
* DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
* be within the range of the current stack pointer.
*
******************************************************************************/
void *
AcpiDsObjStackGetValue (
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_TRACE_PTR (DsObjStackGetValue, WalkState);
/* Can't do it if the stack is empty */
if (WalkState->NumOperands == 0)
{
return_PTR (NULL);
}
/* or if the index is past the top of the stack */
if (Index > (WalkState->NumOperands - (UINT32) 1))
{
return_PTR (NULL);
}
return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) -
Index]);
}
#endif

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psloop - Main AML parse loop
* $Revision: 1.14 $
* $Revision: 1.15 $
*
*****************************************************************************/
@ -716,15 +716,6 @@ AcpiPsCompleteOp (
{
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
if ((*Op)->Common.AmlOpcode != AML_WHILE_OP)
{
Status2 = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
}
/* Close this iteration of the While loop */
@ -758,11 +749,6 @@ AcpiPsCompleteOp (
{
return_ACPI_STATUS (Status2);
}
Status2 = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
AcpiUtDeleteGenericState (
AcpiUtPopGenericState (&WalkState->ControlState));

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 1.170 $
* $Revision: 1.171 $
*
*****************************************************************************/
@ -434,22 +434,14 @@ AcpiPsNextParseState (
ParserState->Aml = WalkState->AmlLastWhile;
WalkState->ControlState->Common.Value = FALSE;
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_BREAK;
}
Status = AE_CTRL_BREAK;
break;
case AE_CTRL_CONTINUE:
ParserState->Aml = WalkState->AmlLastWhile;
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_CONTINUE;
}
Status = AE_CTRL_CONTINUE;
break;
@ -472,11 +464,7 @@ AcpiPsNextParseState (
* Just close out this package
*/
ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_PENDING;
}
Status = AE_CTRL_PENDING;
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 1.232 $
* $Revision: 1.233 $
*
*****************************************************************************/
@ -137,7 +137,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20070126
#define ACPI_CA_VERSION 0x20070307
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@ -226,6 +226,17 @@
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
/* Number of elements in the Result Stack frame, can be an arbitrary value */
#define ACPI_RESULTS_FRAME_OBJ_NUM 8
/*
* Maximal number of elements the Result Stack can contain,
* it may be an arbitray value not exceeding the types of
* ResultSize and ResultCount (now UINT8).
*/
#define ACPI_RESULTS_OBJ_NUM_MAX 255
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 1.74 $
* $Revision: 1.75 $
*
*****************************************************************************/
@ -471,7 +471,7 @@ AcpiDsInitAmlWalk (
ACPI_EVALUATE_INFO *Info,
UINT8 PassNumber);
ACPI_STATUS
void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState);
@ -489,14 +489,6 @@ AcpiDsPushWalkState (
ACPI_WALK_STATE *WalkState,
ACPI_THREAD_STATE *Thread);
ACPI_STATUS
AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsResultStackClear (
ACPI_WALK_STATE *WalkState);
@ -505,12 +497,6 @@ ACPI_WALK_STATE *
AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread);
ACPI_STATUS
AcpiDsResultRemove (
ACPI_OPERAND_OBJECT **Object,
UINT32 Index,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
@ -521,9 +507,4 @@ AcpiDsResultPush (
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsResultPopFromBottom (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState);
#endif /* _ACDISPAT_H_ */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 1.245 $
* $Revision: 1.246 $
*
*****************************************************************************/
@ -693,9 +693,7 @@ typedef struct acpi_thread_state
typedef struct acpi_result_values
{
ACPI_STATE_COMMON
UINT8 NumResults;
UINT8 LastInsert;
union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
} ACPI_RESULT_VALUES;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
* $Revision: 1.46 $
* $Revision: 1.47 $
*
*****************************************************************************/
@ -156,12 +156,15 @@ typedef struct acpi_walk_state
UINT16 Opcode; /* Current AML opcode */
UINT8 NextOpInfo; /* Info about NextOp */
UINT8 NumOperands; /* Stack pointer for Operands[] array */
UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
BOOLEAN LastPredicate; /* Result of last predicate */
UINT8 CurrentResult;
UINT8 ReturnUsed;
UINT8 ScopeDepth;
UINT8 PassNumber; /* Parse pass during table load */
UINT8 ResultSize; /* Total elements for the result stack */
UINT8 ResultCount; /* Current number of occupied elements of result stack */
UINT32 AmlOffset;
UINT32 ArgTypes;
UINT32 MethodBreakpoint; /* For single stepping */