checkdirs() was being passed the wrong mount point, resulting in a panic
[dragonfly.git] / sys / contrib / dev / acpica-unix-20050309 / interpreter / dispatcher / dsutils.c
blob2b4af25c8338a4b7b7da83d43f0a2ee7305b076d
1 /*******************************************************************************
3 * Module Name: dsutils - Dispatcher utilities
4 * $Revision: 111 $
6 ******************************************************************************/
8 /******************************************************************************
10 * 1. Copyright Notice
12 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13 * All rights reserved.
15 * 2. License
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
41 * 3. Conditions
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #define __DSUTILS_C__
119 #include "acpi.h"
120 #include "acparser.h"
121 #include "amlcode.h"
122 #include "acdispat.h"
123 #include "acinterp.h"
124 #include "acnamesp.h"
125 #include "acdebug.h"
127 #define _COMPONENT ACPI_DISPATCHER
128 ACPI_MODULE_NAME ("dsutils")
131 /*******************************************************************************
133 * FUNCTION: AcpiDsClearImplicitReturn
135 * PARAMETERS: WalkState - Current State
137 * RETURN: None.
139 * DESCRIPTION: Clear and remove a reference on an implicit return value. Used
140 * to delete "stale" return values (if enabled, the return value
141 * from every operator is saved at least momentarily, in case the
142 * parent method exits.)
144 ******************************************************************************/
146 void
147 AcpiDsClearImplicitReturn (
148 ACPI_WALK_STATE *WalkState)
150 ACPI_FUNCTION_NAME ("DsClearImplicitReturn");
154 * Slack must be enabled for this feature
156 if (!AcpiGbl_EnableInterpreterSlack)
158 return;
161 if (WalkState->ImplicitReturnObj)
164 * Delete any "stale" implicit return. However, in
165 * complex statements, the implicit return value can be
166 * bubbled up several levels.
168 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
169 "Removing reference on stale implicit return obj %p\n",
170 WalkState->ImplicitReturnObj));
172 AcpiUtRemoveReference (WalkState->ImplicitReturnObj);
173 WalkState->ImplicitReturnObj = NULL;
178 #ifndef ACPI_NO_METHOD_EXECUTION
180 /*******************************************************************************
182 * FUNCTION: AcpiDsDoImplicitReturn
184 * PARAMETERS: ReturnDesc - The return value
185 * WalkState - Current State
186 * AddReference - True if a reference should be added to the
187 * return object
189 * RETURN: TRUE if implicit return enabled, FALSE otherwise
191 * DESCRIPTION: Implements the optional "implicit return". We save the result
192 * of every ASL operator and control method invocation in case the
193 * parent method exit. Before storing a new return value, we
194 * delete the previous return value.
196 ******************************************************************************/
198 BOOLEAN
199 AcpiDsDoImplicitReturn (
200 ACPI_OPERAND_OBJECT *ReturnDesc,
201 ACPI_WALK_STATE *WalkState,
202 BOOLEAN AddReference)
204 ACPI_FUNCTION_NAME ("DsDoImplicitReturn");
208 * Slack must be enabled for this feature, and we must
209 * have a valid return object
211 if ((!AcpiGbl_EnableInterpreterSlack) ||
212 (!ReturnDesc))
214 return (FALSE);
217 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
218 "Result %p will be implicitly returned; Prev=%p\n",
219 ReturnDesc,
220 WalkState->ImplicitReturnObj));
223 * Delete any "stale" implicit return value first. However, in
224 * complex statements, the implicit return value can be
225 * bubbled up several levels, so we don't clear the value if it
226 * is the same as the ReturnDesc.
228 if (WalkState->ImplicitReturnObj)
230 if (WalkState->ImplicitReturnObj == ReturnDesc)
232 return (TRUE);
234 AcpiDsClearImplicitReturn (WalkState);
237 /* Save the implicit return value, add a reference if requested */
239 WalkState->ImplicitReturnObj = ReturnDesc;
240 if (AddReference)
242 AcpiUtAddReference (ReturnDesc);
245 return (TRUE);
249 /*******************************************************************************
251 * FUNCTION: AcpiDsIsResultUsed
253 * PARAMETERS: Op - Current Op
254 * WalkState - Current State
256 * RETURN: TRUE if result is used, FALSE otherwise
258 * DESCRIPTION: Check if a result object will be used by the parent
260 ******************************************************************************/
262 BOOLEAN
263 AcpiDsIsResultUsed (
264 ACPI_PARSE_OBJECT *Op,
265 ACPI_WALK_STATE *WalkState)
267 const ACPI_OPCODE_INFO *ParentInfo;
269 ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
272 /* Must have both an Op and a Result Object */
274 if (!Op)
276 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
277 return_VALUE (TRUE);
281 * We know that this operator is not a
282 * Return() operator (would not come here.) The following code is the
283 * optional support for a so-called "implicit return". Some AML code
284 * assumes that the last value of the method is "implicitly" returned
285 * to the caller. Just save the last result as the return value.
286 * NOTE: this is optional because the ASL language does not actually
287 * support this behavior.
289 AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE);
292 * Now determine if the parent will use the result
294 * If there is no parent, or the parent is a ScopeOp, we are executing
295 * at the method level. An executing method typically has no parent,
296 * since each method is parsed separately. A method invoked externally
297 * via ExecuteControlMethod has a ScopeOp as the parent.
299 if ((!Op->Common.Parent) ||
300 (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))
302 /* No parent, the return value cannot possibly be used */
304 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n",
305 AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
306 return_VALUE (FALSE);
309 /* Get info on the parent. The RootOp is AML_SCOPE */
311 ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
312 if (ParentInfo->Class == AML_CLASS_UNKNOWN)
314 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op));
315 return_VALUE (FALSE);
319 * Decide what to do with the result based on the parent. If
320 * the parent opcode will not use the result, delete the object.
321 * Otherwise leave it as is, it will be deleted when it is used
322 * as an operand later.
324 switch (ParentInfo->Class)
326 case AML_CLASS_CONTROL:
328 switch (Op->Common.Parent->Common.AmlOpcode)
330 case AML_RETURN_OP:
332 /* Never delete the return value associated with a return opcode */
334 goto ResultUsed;
336 case AML_IF_OP:
337 case AML_WHILE_OP:
340 * If we are executing the predicate AND this is the predicate op,
341 * we will use the return value
343 if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&
344 (WalkState->ControlState->Control.PredicateOp == Op))
346 goto ResultUsed;
348 break;
350 default:
351 /* Ignore other control opcodes */
352 break;
355 /* The general control opcode returns no result */
357 goto ResultNotUsed;
360 case AML_CLASS_CREATE:
363 * These opcodes allow TermArg(s) as operands and therefore
364 * the operands can be method calls. The result is used.
366 goto ResultUsed;
369 case AML_CLASS_NAMED_OBJECT:
371 if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
372 (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
373 (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
374 (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
375 (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
376 (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP))
379 * These opcodes allow TermArg(s) as operands and therefore
380 * the operands can be method calls. The result is used.
382 goto ResultUsed;
385 goto ResultNotUsed;
388 default:
391 * In all other cases. the parent will actually use the return
392 * object, so keep it.
394 goto ResultUsed;
398 ResultUsed:
399 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
400 AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
401 AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
403 return_VALUE (TRUE);
406 ResultNotUsed:
407 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
408 AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
409 AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
411 return_VALUE (FALSE);
415 /*******************************************************************************
417 * FUNCTION: AcpiDsDeleteResultIfNotUsed
419 * PARAMETERS: Op - Current parse Op
420 * ResultObj - Result of the operation
421 * WalkState - Current state
423 * RETURN: Status
425 * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
426 * result descriptor, check if the parent opcode will actually use
427 * this result. If not, delete the result now so that it will
428 * not become orphaned.
430 ******************************************************************************/
432 void
433 AcpiDsDeleteResultIfNotUsed (
434 ACPI_PARSE_OBJECT *Op,
435 ACPI_OPERAND_OBJECT *ResultObj,
436 ACPI_WALK_STATE *WalkState)
438 ACPI_OPERAND_OBJECT *ObjDesc;
439 ACPI_STATUS Status;
442 ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
445 if (!Op)
447 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
448 return_VOID;
451 if (!ResultObj)
453 return_VOID;
456 if (!AcpiDsIsResultUsed (Op, WalkState))
458 /* Must pop the result stack (ObjDesc should be equal to ResultObj) */
460 Status = AcpiDsResultPop (&ObjDesc, WalkState);
461 if (ACPI_SUCCESS (Status))
463 AcpiUtRemoveReference (ResultObj);
467 return_VOID;
471 /*******************************************************************************
473 * FUNCTION: AcpiDsResolveOperands
475 * PARAMETERS: WalkState - Current walk state with operands on stack
477 * RETURN: Status
479 * DESCRIPTION: Resolve all operands to their values. Used to prepare
480 * arguments to a control method invocation (a call from one
481 * method to another.)
483 ******************************************************************************/
485 ACPI_STATUS
486 AcpiDsResolveOperands (
487 ACPI_WALK_STATE *WalkState)
489 UINT32 i;
490 ACPI_STATUS Status = AE_OK;
493 ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
497 * Attempt to resolve each of the valid operands
498 * Method arguments are passed by reference, not by value. This means
499 * that the actual objects are passed, not copies of the objects.
501 for (i = 0; i < WalkState->NumOperands; i++)
503 Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
504 if (ACPI_FAILURE (Status))
506 break;
510 return_ACPI_STATUS (Status);
514 /*******************************************************************************
516 * FUNCTION: AcpiDsClearOperands
518 * PARAMETERS: WalkState - Current walk state with operands on stack
520 * RETURN: None
522 * DESCRIPTION: Clear all operands on the current walk state operand stack.
524 ******************************************************************************/
526 void
527 AcpiDsClearOperands (
528 ACPI_WALK_STATE *WalkState)
530 UINT32 i;
533 ACPI_FUNCTION_TRACE_PTR ("DsClearOperands", WalkState);
536 /* Remove a reference on each operand on the stack */
538 for (i = 0; i < WalkState->NumOperands; i++)
541 * Remove a reference to all operands, including both
542 * "Arguments" and "Targets".
544 AcpiUtRemoveReference (WalkState->Operands[i]);
545 WalkState->Operands[i] = NULL;
548 WalkState->NumOperands = 0;
549 return_VOID;
551 #endif
554 /*******************************************************************************
556 * FUNCTION: AcpiDsCreateOperand
558 * PARAMETERS: WalkState - Current walk state
559 * Arg - Parse object for the argument
560 * ArgIndex - Which argument (zero based)
562 * RETURN: Status
564 * DESCRIPTION: Translate a parse tree object that is an argument to an AML
565 * opcode to the equivalent interpreter object. This may include
566 * looking up a name or entering a new name into the internal
567 * namespace.
569 ******************************************************************************/
571 ACPI_STATUS
572 AcpiDsCreateOperand (
573 ACPI_WALK_STATE *WalkState,
574 ACPI_PARSE_OBJECT *Arg,
575 UINT32 ArgIndex)
577 ACPI_STATUS Status = AE_OK;
578 char *NameString;
579 UINT32 NameLength;
580 ACPI_OPERAND_OBJECT *ObjDesc;
581 ACPI_PARSE_OBJECT *ParentOp;
582 UINT16 Opcode;
583 ACPI_INTERPRETER_MODE InterpreterMode;
584 const ACPI_OPCODE_INFO *OpInfo;
587 ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
590 /* A valid name must be looked up in the namespace */
592 if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
593 (Arg->Common.Value.String))
595 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
597 /* Get the entire name string from the AML stream */
599 Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer,
600 &NameString, &NameLength);
602 if (ACPI_FAILURE (Status))
604 return_ACPI_STATUS (Status);
607 /* All prefixes have been handled, and the name is in NameString */
610 * Special handling for BufferField declarations. This is a deferred
611 * opcode that unfortunately defines the field name as the last
612 * parameter instead of the first. We get here when we are performing
613 * the deferred execution, so the actual name of the field is already
614 * in the namespace. We don't want to attempt to look it up again
615 * because we may be executing in a different scope than where the
616 * actual opcode exists.
618 if ((WalkState->DeferredNode) &&
619 (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&
620 (ArgIndex != 0))
622 ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
623 Status = AE_OK;
625 else /* All other opcodes */
628 * Differentiate between a namespace "create" operation
629 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
630 * IMODE_EXECUTE) in order to support the creation of
631 * namespace objects during the execution of control methods.
633 ParentOp = Arg->Common.Parent;
634 OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
635 if ((OpInfo->Flags & AML_NSNODE) &&
636 (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
637 (ParentOp->Common.AmlOpcode != AML_REGION_OP) &&
638 (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
640 /* Enter name into namespace if not found */
642 InterpreterMode = ACPI_IMODE_LOAD_PASS2;
644 else
646 /* Return a failure if name not found */
648 InterpreterMode = ACPI_IMODE_EXECUTE;
651 Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
652 ACPI_TYPE_ANY, InterpreterMode,
653 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
654 WalkState,
655 ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));
657 * The only case where we pass through (ignore) a NOT_FOUND
658 * error is for the CondRefOf opcode.
660 if (Status == AE_NOT_FOUND)
662 if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)
665 * For the Conditional Reference op, it's OK if
666 * the name is not found; We just need a way to
667 * indicate this to the interpreter, set the
668 * object to the root
670 ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
671 Status = AE_OK;
673 else
676 * We just plain didn't find it -- which is a
677 * very serious error at this point
679 Status = AE_AML_NAME_NOT_FOUND;
683 if (ACPI_FAILURE (Status))
685 ACPI_REPORT_NSERROR (NameString, Status);
689 /* Free the namestring created above */
691 ACPI_MEM_FREE (NameString);
693 /* Check status from the lookup */
695 if (ACPI_FAILURE (Status))
697 return_ACPI_STATUS (Status);
700 /* Put the resulting object onto the current object stack */
702 Status = AcpiDsObjStackPush (ObjDesc, WalkState);
703 if (ACPI_FAILURE (Status))
705 return_ACPI_STATUS (Status);
707 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
709 else
711 /* Check for null name case */
713 if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
716 * If the name is null, this means that this is an
717 * optional result parameter that was not specified
718 * in the original ASL. Create a Zero Constant for a
719 * placeholder. (Store to a constant is a Noop.)
721 Opcode = AML_ZERO_OP; /* Has no arguments! */
723 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg));
725 else
727 Opcode = Arg->Common.AmlOpcode;
730 /* Get the object type of the argument */
732 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
733 if (OpInfo->ObjectType == ACPI_TYPE_INVALID)
735 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
738 if (OpInfo->Flags & AML_HAS_RETVAL)
740 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
741 "Argument previously created, already stacked \n"));
743 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
744 WalkState->Operands [WalkState->NumOperands - 1], WalkState));
747 * Use value that was already previously returned
748 * by the evaluation of this argument
750 Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
751 if (ACPI_FAILURE (Status))
754 * Only error is underflow, and this indicates
755 * a missing or null operand!
757 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
758 AcpiFormatException (Status)));
759 return_ACPI_STATUS (Status);
762 else
764 /* Create an ACPI_INTERNAL_OBJECT for the argument */
766 ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);
767 if (!ObjDesc)
769 return_ACPI_STATUS (AE_NO_MEMORY);
772 /* Initialize the new object */
774 Status = AcpiDsInitObjectFromOp (WalkState, Arg,
775 Opcode, &ObjDesc);
776 if (ACPI_FAILURE (Status))
778 AcpiUtDeleteObjectDesc (ObjDesc);
779 return_ACPI_STATUS (Status);
783 /* Put the operand object on the object stack */
785 Status = AcpiDsObjStackPush (ObjDesc, WalkState);
786 if (ACPI_FAILURE (Status))
788 return_ACPI_STATUS (Status);
791 ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
794 return_ACPI_STATUS (AE_OK);
798 /*******************************************************************************
800 * FUNCTION: AcpiDsCreateOperands
802 * PARAMETERS: WalkState - Current state
803 * FirstArg - First argument of a parser argument tree
805 * RETURN: Status
807 * DESCRIPTION: Convert an operator's arguments from a parse tree format to
808 * namespace objects and place those argument object on the object
809 * stack in preparation for evaluation by the interpreter.
811 ******************************************************************************/
813 ACPI_STATUS
814 AcpiDsCreateOperands (
815 ACPI_WALK_STATE *WalkState,
816 ACPI_PARSE_OBJECT *FirstArg)
818 ACPI_STATUS Status = AE_OK;
819 ACPI_PARSE_OBJECT *Arg;
820 UINT32 ArgCount = 0;
823 ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
826 /* For all arguments in the list... */
828 Arg = FirstArg;
829 while (Arg)
831 Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
832 if (ACPI_FAILURE (Status))
834 goto Cleanup;
837 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
838 ArgCount, Arg, FirstArg));
840 /* Move on to next argument, if any */
842 Arg = Arg->Common.Next;
843 ArgCount++;
846 return_ACPI_STATUS (Status);
849 Cleanup:
851 * We must undo everything done above; meaning that we must
852 * pop everything off of the operand stack and delete those
853 * objects
855 (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
857 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
858 (ArgCount + 1), AcpiFormatException (Status)));
859 return_ACPI_STATUS (Status);