ReactOS  0.4.15-dev-439-g292f67a
dswexec.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acdebug.h"
Include dependency graph for dswexec.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_DISPATCHER
 

Functions

ACPI_STATUS AcpiDsGetPredicateValue (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ResultObj)
 
ACPI_STATUS AcpiDsExecBeginOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
 
ACPI_STATUS AcpiDsExecEndOp (ACPI_WALK_STATE *WalkState)
 

Variables

static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch []
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_DISPATCHER

Definition at line 57 of file dswexec.c.

Function Documentation

◆ AcpiDsExecBeginOp()

ACPI_STATUS AcpiDsExecBeginOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT **  OutOp 
)

Definition at line 234 of file dswexec.c.

237 {
238  ACPI_PARSE_OBJECT *Op;
240  UINT32 OpcodeClass;
241 
242 
243  ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
244 
245 
246  Op = WalkState->Op;
247  if (!Op)
248  {
249  Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
250  if (ACPI_FAILURE (Status))
251  {
252  goto ErrorExit;
253  }
254 
255  Op = *OutOp;
256  WalkState->Op = Op;
257  WalkState->Opcode = Op->Common.AmlOpcode;
258  WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
259 
260  if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
261  {
263  "(%s) Popping scope for Op %p\n",
264  AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
265 
266  Status = AcpiDsScopeStackPop (WalkState);
267  if (ACPI_FAILURE (Status))
268  {
269  goto ErrorExit;
270  }
271  }
272  }
273 
274  if (Op == WalkState->Origin)
275  {
276  if (OutOp)
277  {
278  *OutOp = Op;
279  }
280 
282  }
283 
284  /*
285  * If the previous opcode was a conditional, this opcode
286  * must be the beginning of the associated predicate.
287  * Save this knowledge in the current scope descriptor
288  */
289  if ((WalkState->ControlState) &&
290  (WalkState->ControlState->Common.State ==
292  {
294  "Exec predicate Op=%p State=%p\n",
295  Op, WalkState));
296 
297  WalkState->ControlState->Common.State =
299 
300  /* Save start of predicate */
301 
302  WalkState->ControlState->Control.PredicateOp = Op;
303  }
304 
305 
306  OpcodeClass = WalkState->OpInfo->Class;
307 
308  /* We want to send namepaths to the load code */
309 
310  if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
311  {
312  OpcodeClass = AML_CLASS_NAMED_OBJECT;
313  }
314 
315  /*
316  * Handle the opcode based upon the opcode type
317  */
318  switch (OpcodeClass)
319  {
320  case AML_CLASS_CONTROL:
321 
322  Status = AcpiDsExecBeginControlOp (WalkState, Op);
323  break;
324 
326 
327  if (WalkState->WalkType & ACPI_WALK_METHOD)
328  {
329  /*
330  * Found a named object declaration during method execution;
331  * we must enter this object into the namespace. The created
332  * object is temporary and will be deleted upon completion of
333  * the execution of this method.
334  *
335  * Note 10/2010: Except for the Scope() op. This opcode does
336  * not actually create a new object, it refers to an existing
337  * object. However, for Scope(), we want to indeed open a
338  * new scope.
339  */
340  if (Op->Common.AmlOpcode != AML_SCOPE_OP)
341  {
342  Status = AcpiDsLoad2BeginOp (WalkState, NULL);
343  }
344  else
345  {
347  Op->Named.Node, Op->Named.Node->Type, WalkState);
348  if (ACPI_FAILURE (Status))
349  {
351  }
352  }
353  }
354  break;
355 
356  case AML_CLASS_EXECUTE:
357  case AML_CLASS_CREATE:
358 
359  break;
360 
361  default:
362 
363  break;
364  }
365 
366  /* Nothing to do here during method execution */
367 
369 
370 
371 ErrorExit:
372  Status = AcpiDsMethodError (Status, WalkState);
374 }
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiDsScopeStackPop(ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:192
#define AML_CLASS_EXECUTE
Definition: amlcode.h:400
ACPI_STATUS AcpiDsLoad2BeginOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dswload2.c:74
#define AML_CLASS_CREATE
Definition: amlcode.h:401
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
UINT8 ObjectType
Definition: aclocal.h:874
#define AML_CLASS_CONTROL
Definition: amlcode.h:404
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_WALK_METHOD
Definition: acstruct.h:69
#define AML_CLASS_NAMED_OBJECT
Definition: amlcode.h:403
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
unsigned int UINT32
union acpi_parse_object * PredicateOp
Definition: aclocal.h:726
smooth NULL
Definition: ftsmooth.c:416
UINT8 WalkType
Definition: acstruct.h:77
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
UINT32 AcpiNsOpensScope(ACPI_OBJECT_TYPE Type)
Definition: nsutils.c:736
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_SCOPE_OP
Definition: amlcode.h:60
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
ACPI_STATUS AcpiDsExecBeginControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:71
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
Status
Definition: gdiplustypes.h:24
ACPI_PARSE_OBJECT * Origin
Definition: acstruct.h:120
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
UINT16 Opcode
Definition: acstruct.h:78
#define ACPI_CONTROL_CONDITIONAL_EXECUTING
Definition: aclocal.h:670
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsInitCallbacks(), and AcpiDsLoad2BeginOp().

◆ AcpiDsExecEndOp()

ACPI_STATUS AcpiDsExecEndOp ( ACPI_WALK_STATE WalkState)

Definition at line 392 of file dswexec.c.

394 {
395  ACPI_PARSE_OBJECT *Op;
397  UINT32 OpType;
398  UINT32 OpClass;
399  ACPI_PARSE_OBJECT *NextOp;
400  ACPI_PARSE_OBJECT *FirstArg;
401 #ifdef ACPI_EXEC_APP
402  char *Namepath;
403  ACPI_OPERAND_OBJECT *ObjDesc;
404 #endif
405 
406  ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
407 
408 
409  Op = WalkState->Op;
410  OpType = WalkState->OpInfo->Type;
411  OpClass = WalkState->OpInfo->Class;
412 
413  if (OpClass == AML_CLASS_UNKNOWN)
414  {
415  ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
417  }
418 
419  FirstArg = Op->Common.Value.Arg;
420 
421  /* Init the walk state */
422 
423  WalkState->NumOperands = 0;
424  WalkState->OperandIndex = 0;
425  WalkState->ReturnDesc = NULL;
426  WalkState->ResultObj = NULL;
427 
428  /* Call debugger for single step support (DEBUG build only) */
429 
430  Status = AcpiDbSingleStep (WalkState, Op, OpClass);
431  if (ACPI_FAILURE (Status))
432  {
434  }
435 
436  /* Decode the Opcode Class */
437 
438  switch (OpClass)
439  {
440  case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
441 
442  if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
443  {
444  Status = AcpiDsEvaluateNamePath (WalkState);
445  if (ACPI_FAILURE (Status))
446  {
447  goto Cleanup;
448  }
449  }
450  break;
451 
452  case AML_CLASS_EXECUTE: /* Most operators with arguments */
453 
454  /* Build resolved operand stack */
455 
456  Status = AcpiDsCreateOperands (WalkState, FirstArg);
457  if (ACPI_FAILURE (Status))
458  {
459  goto Cleanup;
460  }
461 
462  /*
463  * All opcodes require operand resolution, with the only exceptions
464  * being the ObjectType and SizeOf operators.
465  */
466  if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
467  {
468  /* Resolve all operands */
469 
470  Status = AcpiExResolveOperands (WalkState->Opcode,
471  &(WalkState->Operands [WalkState->NumOperands -1]),
472  WalkState);
473  }
474 
475  if (ACPI_SUCCESS (Status))
476  {
477  /*
478  * Dispatch the request to the appropriate interpreter handler
479  * routine. There is one routine per opcode "type" based upon the
480  * number of opcode arguments and return type.
481  */
482  Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
483  }
484  else
485  {
486  /*
487  * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
488  * Local is uninitialized.
489  */
491  (WalkState->Opcode == AML_STORE_OP) &&
492  (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
493  (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
494  (WalkState->Operands[0]->Reference.Class ==
495  WalkState->Operands[1]->Reference.Class) &&
496  (WalkState->Operands[0]->Reference.Value ==
497  WalkState->Operands[1]->Reference.Value))
498  {
499  Status = AE_OK;
500  }
501  else
502  {
504  "While resolving operands for [%s]",
505  AcpiPsGetOpcodeName (WalkState->Opcode)));
506  }
507  }
508 
509  /* Always delete the argument objects and clear the operand stack */
510 
511  AcpiDsClearOperands (WalkState);
512 
513  /*
514  * If a result object was returned from above, push it on the
515  * current result stack
516  */
517  if (ACPI_SUCCESS (Status) &&
518  WalkState->ResultObj)
519  {
520  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
521  }
522  break;
523 
524  default:
525 
526  switch (OpType)
527  {
528  case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
529 
530  /* 1 Operand, 0 ExternalResult, 0 InternalResult */
531 
532  Status = AcpiDsExecEndControlOp (WalkState, Op);
533 
534  break;
535 
537  /*
538  * If the method is referenced from within a package
539  * declaration, it is not a invocation of the method, just
540  * a reference to it.
541  */
542  if ((Op->Asl.Parent) &&
543  ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
544  (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
545  {
547  "Method Reference in a Package, Op=%p\n", Op));
548 
549  Op->Common.Node = (ACPI_NAMESPACE_NODE *)
550  Op->Asl.Value.Arg->Asl.Node;
551  AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
553  }
554 
556  "Method invocation, Op=%p\n", Op));
557 
558  /*
559  * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
560  * the method Node pointer
561  */
562  /* NextOp points to the op that holds the method name */
563 
564  NextOp = FirstArg;
565 
566  /* NextOp points to first argument op */
567 
568  NextOp = NextOp->Common.Next;
569 
570  /*
571  * Get the method's arguments and put them on the operand stack
572  */
573  Status = AcpiDsCreateOperands (WalkState, NextOp);
574  if (ACPI_FAILURE (Status))
575  {
576  break;
577  }
578 
579  /*
580  * Since the operands will be passed to another control method,
581  * we must resolve all local references here (Local variables,
582  * arguments to *this* method, etc.)
583  */
584  Status = AcpiDsResolveOperands (WalkState);
585  if (ACPI_FAILURE (Status))
586  {
587  /* On error, clear all resolved operands */
588 
589  AcpiDsClearOperands (WalkState);
590  break;
591  }
592 
593  /*
594  * Tell the walk loop to preempt this running method and
595  * execute the new method
596  */
598 
599  /*
600  * Return now; we don't want to disturb anything,
601  * especially the operand count!
602  */
604 
606 
608  "Executing CreateField Buffer/Index Op=%p\n", Op));
609 
610  Status = AcpiDsLoad2EndOp (WalkState);
611  if (ACPI_FAILURE (Status))
612  {
613  break;
614  }
615 
616  Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
617  if (ACPI_FAILURE (Status))
618  {
619  break;
620  }
621 
622 #ifdef ACPI_EXEC_APP
623  /*
624  * AcpiExec support for namespace initialization file (initialize
625  * BufferFields in this code.)
626  */
627  Namepath = AcpiNsGetExternalPathname (Op->Common.Node);
628  Status = AeLookupInitFileEntry (Namepath, &ObjDesc);
629  if (ACPI_SUCCESS (Status))
630  {
631  Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL);
632  if ACPI_FAILURE (Status)
633  {
634  ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field"));
635  }
636  }
637  ACPI_FREE (Namepath);
638  Status = AE_OK;
639 #endif
640  break;
641 
642 
644 
646  "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
647  Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));
648 
649  switch (Op->Common.Parent->Common.AmlOpcode)
650  {
651  case AML_NAME_OP:
652  /*
653  * Put the Node on the object stack (Contains the ACPI Name
654  * of this object)
655  */
656  WalkState->Operands[0] = (void *)
657  Op->Common.Parent->Common.Node;
658  WalkState->NumOperands = 1;
659 
660  Status = AcpiDsCreateNode (WalkState,
661  Op->Common.Parent->Common.Node, Op->Common.Parent);
662  if (ACPI_FAILURE (Status))
663  {
664  break;
665  }
666 
667  /* Fall through */
668  /*lint -fallthrough */
669 
671 
672  Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
673  AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
674  break;
675 
676  default:
677 
678  Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
679  break;
680  }
681 
682  /*
683  * If a result object was returned from above, push it on the
684  * current result stack
685  */
686  if (WalkState->ResultObj)
687  {
688  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
689  }
690  break;
691 
696 
697  Status = AcpiDsLoad2EndOp (WalkState);
698  if (ACPI_FAILURE (Status))
699  {
700  break;
701  }
702 
703  if (Op->Common.AmlOpcode == AML_REGION_OP)
704  {
706  "Executing OpRegion Address/Length Op=%p\n", Op));
707 
708  Status = AcpiDsEvalRegionOperands (WalkState, Op);
709  if (ACPI_FAILURE (Status))
710  {
711  break;
712  }
713  }
714  else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
715  {
717  "Executing DataTableRegion Strings Op=%p\n", Op));
718 
719  Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
720  if (ACPI_FAILURE (Status))
721  {
722  break;
723  }
724  }
725  else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
726  {
728  "Executing BankField Op=%p\n", Op));
729 
730  Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
731  if (ACPI_FAILURE (Status))
732  {
733  break;
734  }
735  }
736  break;
737 
738  case AML_TYPE_UNDEFINED:
739 
741  "Undefined opcode type Op=%p", Op));
743 
744  case AML_TYPE_BOGUS:
745 
747  "Internal opcode=%X type Op=%p\n",
748  WalkState->Opcode, Op));
749  break;
750 
751  default:
752 
754  "Unimplemented opcode, class=0x%X "
755  "type=0x%X Opcode=0x%X Op=%p",
756  OpClass, OpType, Op->Common.AmlOpcode, Op));
757 
759  break;
760  }
761  }
762 
763  /*
764  * ACPI 2.0 support for 64-bit integers: Truncate numeric
765  * result value if we are executing from a 32-bit ACPI table
766  */
768 
769  /*
770  * Check if we just completed the evaluation of a
771  * conditional predicate
772  */
773  if ((ACPI_SUCCESS (Status)) &&
774  (WalkState->ControlState) &&
775  (WalkState->ControlState->Common.State ==
777  (WalkState->ControlState->Control.PredicateOp == Op))
778  {
779  Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
780  WalkState->ResultObj = NULL;
781  }
782 
783 
784 Cleanup:
785 
786  if (WalkState->ResultObj)
787  {
788  /* Break to debugger to display result */
789 
790  AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
791 
792  /*
793  * Delete the result op if and only if:
794  * Parent will not use the result -- such as any
795  * non-nested type2 op in a method (parent will be method)
796  */
797  AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
798  }
799 
800 #ifdef _UNDER_DEVELOPMENT
801 
802  if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
803  {
804  AcpiDbMethodEnd (WalkState);
805  }
806 #endif
807 
808  /* Invoke exception handler on error */
809 
810  if (ACPI_FAILURE (Status))
811  {
812  Status = AcpiDsMethodError (Status, WalkState);
813  }
814 
815  /* Always clear the object stack */
816 
817  WalkState->NumOperands = 0;
819 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_STATUS AcpiDsEvalRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:408
void AcpiDsDeleteResultIfNotUsed(ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:359
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:747
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define AML_INT_EVAL_SUBTREE_OP
Definition: amlcode.h:212
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AML_CLASS_UNKNOWN
Definition: amlcode.h:410
#define AML_TYPE_METHOD_CALL
Definition: amlcode.h:375
UINT8 OperandIndex
Definition: acstruct.h:81
#define AML_CLASS_EXECUTE
Definition: amlcode.h:400
UINT8 NumOperands
Definition: acstruct.h:80
ACPI_STATUS AcpiDsEvaluateNamePath(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:845
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:711
#define AE_CTRL_TRANSFER
Definition: acexcep.h:231
union acpi_operand_object * ReturnDesc
Definition: acstruct.h:123
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_REGION_OP
Definition: amlcode.h:180
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
ACPI_STATUS AcpiDsResultPush(ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:160
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_NAME_OP
Definition: amlcode.h:54
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
#define AML_TYPE_NAMED_SIMPLE
Definition: amlcode.h:384
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:441
unsigned int UINT32
#define AE_AML_UNINITIALIZED_LOCAL
Definition: acexcep.h:184
union acpi_parse_object * PredicateOp
Definition: aclocal.h:726
ACPI_STATUS AcpiDsEvalBufferFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:321
ACPI_STATUS AcpiExWriteDataToField(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exfield.c:315
ACPI_STATUS AcpiDsResolveOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:412
ACPI_STATUS AcpiDsExecEndControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:177
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
ACPI_PARSE_OBJ_ASL Asl
Definition: aclocal.h:1080
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:538
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
UINT8 * AmlEnd
Definition: aclocal.h:1103
#define AML_STORE_OP
Definition: amlcode.h:88
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
ACPI_STATUS AcpiDsEvalBankFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:754
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
char * AcpiNsGetExternalPathname(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:70
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
ACPI_STATUS AcpiDsLoad2EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload2.c:418
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_STATUS AcpiDsCreateNode(ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op)
Definition: dsobject.c:302
#define AML_CLASS_ARGUMENT
Definition: amlcode.h:402
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
ACPI_STATUS AcpiDsEvalDataObjectOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsopcode.c:636
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
ACPI_STATUS AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:519
#define AML_TYPE_CREATE_OBJECT
Definition: amlcode.h:380
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
#define AML_TYPE_NAMED_NO_OBJ
Definition: amlcode.h:382
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
void AcpiDsClearOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:453
#define AML_TYPE_BOGUS
Definition: amlcode.h:388
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
#define AML_TYPE_UNDEFINED
Definition: amlcode.h:387
#define AML_NO_OPERAND_RESOLVE
Definition: amlcode.h:331
#define AML_TYPE_NAMED_COMPLEX
Definition: amlcode.h:385
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_TYPE_NAMED_FIELD
Definition: amlcode.h:383
#define AML_TYPE_CREATE_FIELD
Definition: amlcode.h:379
ACPI_STATUS AcpiDsGetPredicateValue(ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ResultObj)
Definition: dswexec.c:94
UINT16 Opcode
Definition: acstruct.h:78
static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
Definition: dswexec.c:63
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define AML_TYPE_CONTROL
Definition: amlcode.h:381
#define AML_DATA_REGION_OP
Definition: amlcode.h:188
#define AE_OK
Definition: acexcep.h:97
UINT16 Flags
Definition: aclocal.h:873
#define AML_PACKAGE_OP
Definition: amlcode.h:62

Referenced by AcpiDsInitCallbacks().

◆ AcpiDsGetPredicateValue()

ACPI_STATUS AcpiDsGetPredicateValue ( ACPI_WALK_STATE WalkState,
ACPI_OPERAND_OBJECT ResultObj 
)

Definition at line 94 of file dswexec.c.

97 {
99  ACPI_OPERAND_OBJECT *ObjDesc;
100  ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
101 
102 
103  ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
104 
105 
106  WalkState->ControlState->Common.State = 0;
107 
108  if (ResultObj)
109  {
110  Status = AcpiDsResultPop (&ObjDesc, WalkState);
111  if (ACPI_FAILURE (Status))
112  {
114  "Could not get result from predicate evaluation"));
115 
117  }
118  }
119  else
120  {
121  Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
122  if (ACPI_FAILURE (Status))
123  {
125  }
126 
127  Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
128  if (ACPI_FAILURE (Status))
129  {
131  }
132 
133  ObjDesc = WalkState->Operands [0];
134  }
135 
136  if (!ObjDesc)
137  {
139  "No predicate ObjDesc=%p State=%p",
140  ObjDesc, WalkState));
141 
143  }
144 
145  /*
146  * Result of predicate evaluation must be an Integer
147  * object. Implicitly convert the argument if necessary.
148  */
149  Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
151  if (ACPI_FAILURE (Status))
152  {
153  goto Cleanup;
154  }
155 
156  if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
157  {
159  "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
160  ObjDesc, WalkState, ObjDesc->Common.Type));
161 
163  goto Cleanup;
164  }
165 
166  /* Truncate the predicate to 32-bits if necessary */
167 
168  (void) AcpiExTruncateFor32bitTable (LocalObjDesc);
169 
170  /*
171  * Save the result of the predicate evaluation on
172  * the control stack
173  */
174  if (LocalObjDesc->Integer.Value)
175  {
176  WalkState->ControlState->Common.Value = TRUE;
177  }
178  else
179  {
180  /*
181  * Predicate is FALSE, we will just toss the
182  * rest of the package
183  */
184  WalkState->ControlState->Common.Value = FALSE;
186  }
187 
188  /* Predicate can be used for an implicit return value */
189 
190  (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
191 
192 
193 Cleanup:
194 
196  "Completed a predicate eval=%X Op=%p\n",
197  WalkState->ControlState->Common.Value, WalkState->Op));
198 
199  /* Break to debugger to display result */
200 
201  AcpiDbDisplayResultObject (LocalObjDesc, WalkState);
202 
203  /*
204  * Delete the predicate result object (we know that
205  * we don't need it anymore)
206  */
207  if (LocalObjDesc != ObjDesc)
208  {
209  AcpiUtRemoveReference (LocalObjDesc);
210  }
211  AcpiUtRemoveReference (ObjDesc);
212 
213  WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
215 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
BOOLEAN AcpiDsDoImplicitReturn(ACPI_OPERAND_OBJECT *ReturnDesc, ACPI_WALK_STATE *WalkState, BOOLEAN AddReference)
Definition: dsutils.c:123
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_CTRL_FALSE
Definition: acexcep.h:228
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
#define ACPI_CONTROL_NORMAL
Definition: aclocal.h:669
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_STATUS AcpiDsResultPop(ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:78
#define AE_OK
Definition: acexcep.h:97
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:144

Referenced by AcpiDsExecEndOp(), and AcpiPsParseLoop().

Variable Documentation

◆ AcpiGbl_OpTypeDispatch

ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
static
Initial value:
=
{
}
ACPI_STATUS AcpiExOpcode_3A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg3.c:91
ACPI_STATUS AcpiExOpcode_1A_1T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:232
ACPI_STATUS AcpiExOpcode_1A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:624
ACPI_STATUS AcpiExOpcode_1A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:161
ACPI_STATUS AcpiExOpcode_2A_2T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:169
ACPI_STATUS AcpiExOpcode_0A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:92
ACPI_STATUS AcpiExOpcode_3A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg3.c:173
ACPI_STATUS AcpiExOpcode_2A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:279
ACPI_STATUS AcpiExOpcode_2A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:540
ACPI_STATUS AcpiExOpcode_6A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg6.c:221
ACPI_STATUS AcpiExOpcode_1A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:281
ACPI_STATUS AcpiExOpcode_2A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:95

Definition at line 63 of file dswexec.c.

Referenced by AcpiDsExecEndOp().