/******************************************************************************
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acdebug.h"
ACPI_MODULE_NAME ("dswexec")
/*
* Dispatch table for opcode classes
*/
{
};
/*****************************************************************************
*
* FUNCTION: AcpiDsGetPredicateValue
*
* PARAMETERS: WalkState - Current state of the parse tree walk
* ResultObj - if non-zero, pop result from result stack
*
* RETURN: Status
*
* DESCRIPTION: Get the result of a predicate evaluation
*
****************************************************************************/
{
if (ResultObj)
{
if (ACPI_FAILURE (Status))
{
"Could not get result from predicate evaluation"));
}
}
else
{
if (ACPI_FAILURE (Status))
{
}
if (ACPI_FAILURE (Status))
{
}
}
if (!ObjDesc)
{
"No predicate ObjDesc=%p State=%p",
}
/*
* Result of predicate evaluation must be an Integer
* object. Implicitly convert the argument if necessary.
*/
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
{
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
goto Cleanup;
}
/* Truncate the predicate to 32-bits if necessary */
(void) AcpiExTruncateFor32bitTable (LocalObjDesc);
/*
* Save the result of the predicate evaluation on
* the control stack
*/
{
}
else
{
/*
* Predicate is FALSE, we will just toss the
* rest of the package
*/
}
/* Predicate can be used for an implicit return value */
"Completed a predicate eval=%X Op=%p\n",
#ifdef ACPI_DEBUGGER
/* Break to debugger to display result */
#endif
/*
* Delete the predicate result object (we know that
* we don't need it anymore)
*/
if (LocalObjDesc != ObjDesc)
{
}
}
/*****************************************************************************
*
* FUNCTION: AcpiDsExecBeginOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
* OutOp - Where to return op if a new one is created
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the execution of control
* methods. This is where most operators and operands are
* dispatched to the interpreter.
*
****************************************************************************/
{
if (!Op)
{
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
{
"(%s) Popping scope for Op %p\n",
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
}
}
{
if (OutOp)
{
}
}
/*
* If the previous opcode was a conditional, this opcode
* must be the beginning of the associated predicate.
* Save this knowledge in the current scope descriptor
*/
if ((WalkState->ControlState) &&
{
"Exec predicate Op=%p State=%p\n",
/* Save start of predicate */
}
/* We want to send namepaths to the load code */
{
}
/*
* Handle the opcode based upon the opcode type
*/
switch (OpcodeClass)
{
case AML_CLASS_CONTROL:
break;
case AML_CLASS_NAMED_OBJECT:
{
/*
* Found a named object declaration during method execution;
* we must enter this object into the namespace. The created
* object is temporary and will be deleted upon completion of
* the execution of this method.
*
* Note 10/2010: Except for the Scope() op. This opcode does
* not actually create a new object, it refers to an existing
* object. However, for Scope(), we want to indeed open a
* new scope.
*/
{
}
else
{
if (ACPI_FAILURE (Status))
{
}
}
}
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
break;
default:
break;
}
/* Nothing to do here during method execution */
}
/*****************************************************************************
*
* FUNCTION: AcpiDsExecEndOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback used during the execution of control
* methods. The only thing we really need to do here is to
* notice the beginning of IF, ELSE, and WHILE blocks.
*
****************************************************************************/
{
if (OpClass == AML_CLASS_UNKNOWN)
{
}
/* Init the walk state */
WalkState->NumOperands = 0;
WalkState->OperandIndex = 0;
#ifdef ACPI_DEBUGGER
/* Call debugger for single step support (DEBUG build only) */
if (ACPI_FAILURE (Status))
{
}
#endif
/* Decode the Opcode Class */
switch (OpClass)
{
case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
{
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
}
break;
case AML_CLASS_EXECUTE: /* Most operators with arguments */
/* Build resolved operand stack */
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* All opcodes require operand resolution, with the only exceptions
* being the ObjectType and SizeOf operators.
*/
{
/* Resolve all operands */
}
if (ACPI_SUCCESS (Status))
{
/*
* Dispatch the request to the appropriate interpreter handler
* routine. There is one routine per opcode "type" based upon the
* number of opcode arguments and return type.
*/
}
else
{
/*
* Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
* Local is uninitialized.
*/
if ((Status == AE_AML_UNINITIALIZED_LOCAL) &&
{
}
else
{
"While resolving operands for [%s]",
}
}
/* Always delete the argument objects and clear the operand stack */
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (Status) &&
{
}
break;
default:
switch (OpType)
{
case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
break;
case AML_TYPE_METHOD_CALL:
/*
* If the method is referenced from within a package
* declaration, it is not a invocation of the method, just
* a reference to it.
*/
{
"Method Reference in a Package, Op=%p\n", Op));
}
"Method invocation, Op=%p\n", Op));
/*
* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
* the method Node pointer
*/
/* NextOp points to the op that holds the method name */
/* NextOp points to first argument op */
/*
* Get the method's arguments and put them on the operand stack
*/
if (ACPI_FAILURE (Status))
{
break;
}
/*
* Since the operands will be passed to another control method,
* we must resolve all local references here (Local variables,
* arguments to *this* method, etc.)
*/
if (ACPI_FAILURE (Status))
{
/* On error, clear all resolved operands */
break;
}
/*
* Tell the walk loop to preempt this running method and
* execute the new method
*/
/*
* Return now; we don't want to disturb anything,
* especially the operand count!
*/
case AML_TYPE_CREATE_FIELD:
if (ACPI_FAILURE (Status))
{
break;
}
break;
case AML_TYPE_CREATE_OBJECT:
{
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name
* of this object)
*/
if (ACPI_FAILURE (Status))
{
break;
}
/* Fall through */
/*lint -fallthrough */
case AML_INT_EVAL_SUBTREE_OP:
break;
default:
break;
}
/*
* If a result object was returned from above, push it on the
* current result stack
*/
{
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
case AML_TYPE_NAMED_NO_OBJ:
if (ACPI_FAILURE (Status))
{
break;
}
{
if (ACPI_FAILURE (Status))
{
break;
}
}
{
"Executing DataTableRegion Strings Op=%p\n", Op));
if (ACPI_FAILURE (Status))
{
break;
}
}
{
"Executing BankField Op=%p\n", Op));
if (ACPI_FAILURE (Status))
{
break;
}
}
break;
case AML_TYPE_UNDEFINED:
"Undefined opcode type Op=%p", Op));
case AML_TYPE_BOGUS:
"Internal opcode=%X type Op=%p\n",
break;
default:
"Unimplemented opcode, class=0x%X "
"type=0x%X Opcode=0x%X Op=%p",
break;
}
}
/*
* ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table
*/
/*
* Check if we just completed the evaluation of a
* conditional predicate
*/
if ((ACPI_SUCCESS (Status)) &&
(WalkState->ControlState) &&
{
}
{
#ifdef ACPI_DEBUGGER
/* Break to debugger to display result */
#endif
/*
* Delete the result op if and only if:
* Parent will not use the result -- such as any
* non-nested type2 op in a method (parent will be method)
*/
}
#ifdef _UNDER_DEVELOPMENT
{
}
#endif
/* Invoke exception handler on error */
if (ACPI_FAILURE (Status))
{
}
/* Always clear the object stack */
WalkState->NumOperands = 0;
}