ReactOS  0.4.13-dev-99-g7e18b6d
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 55 of file dswexec.c.

Function Documentation

◆ AcpiDsExecBeginOp()

ACPI_STATUS AcpiDsExecBeginOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT **  OutOp 
)

Definition at line 232 of file dswexec.c.

235 {
236  ACPI_PARSE_OBJECT *Op;
238  UINT32 OpcodeClass;
239 
240 
241  ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
242 
243 
244  Op = WalkState->Op;
245  if (!Op)
246  {
247  Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
248  if (ACPI_FAILURE (Status))
249  {
250  goto ErrorExit;
251  }
252 
253  Op = *OutOp;
254  WalkState->Op = Op;
255  WalkState->Opcode = Op->Common.AmlOpcode;
256  WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
257 
258  if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
259  {
261  "(%s) Popping scope for Op %p\n",
262  AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
263 
264  Status = AcpiDsScopeStackPop (WalkState);
265  if (ACPI_FAILURE (Status))
266  {
267  goto ErrorExit;
268  }
269  }
270  }
271 
272  if (Op == WalkState->Origin)
273  {
274  if (OutOp)
275  {
276  *OutOp = Op;
277  }
278 
280  }
281 
282  /*
283  * If the previous opcode was a conditional, this opcode
284  * must be the beginning of the associated predicate.
285  * Save this knowledge in the current scope descriptor
286  */
287  if ((WalkState->ControlState) &&
288  (WalkState->ControlState->Common.State ==
290  {
292  "Exec predicate Op=%p State=%p\n",
293  Op, WalkState));
294 
295  WalkState->ControlState->Common.State =
297 
298  /* Save start of predicate */
299 
300  WalkState->ControlState->Control.PredicateOp = Op;
301  }
302 
303 
304  OpcodeClass = WalkState->OpInfo->Class;
305 
306  /* We want to send namepaths to the load code */
307 
308  if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
309  {
310  OpcodeClass = AML_CLASS_NAMED_OBJECT;
311  }
312 
313  /*
314  * Handle the opcode based upon the opcode type
315  */
316  switch (OpcodeClass)
317  {
318  case AML_CLASS_CONTROL:
319 
320  Status = AcpiDsExecBeginControlOp (WalkState, Op);
321  break;
322 
324 
325  if (WalkState->WalkType & ACPI_WALK_METHOD)
326  {
327  /*
328  * Found a named object declaration during method execution;
329  * we must enter this object into the namespace. The created
330  * object is temporary and will be deleted upon completion of
331  * the execution of this method.
332  *
333  * Note 10/2010: Except for the Scope() op. This opcode does
334  * not actually create a new object, it refers to an existing
335  * object. However, for Scope(), we want to indeed open a
336  * new scope.
337  */
338  if (Op->Common.AmlOpcode != AML_SCOPE_OP)
339  {
340  Status = AcpiDsLoad2BeginOp (WalkState, NULL);
341  }
342  else
343  {
345  Op->Named.Node, Op->Named.Node->Type, WalkState);
346  if (ACPI_FAILURE (Status))
347  {
349  }
350  }
351  }
352  break;
353 
354  case AML_CLASS_EXECUTE:
355  case AML_CLASS_CREATE:
356 
357  break;
358 
359  default:
360 
361  break;
362  }
363 
364  /* Nothing to do here during method execution */
365 
367 
368 
369 ErrorExit:
370  Status = AcpiDsMethodError (Status, WalkState);
372 }
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:71
#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:749
#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:249
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 390 of file dswexec.c.

392 {
393  ACPI_PARSE_OBJECT *Op;
395  UINT32 OpType;
396  UINT32 OpClass;
397  ACPI_PARSE_OBJECT *NextOp;
398  ACPI_PARSE_OBJECT *FirstArg;
399 
400 
401  ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
402 
403 
404  Op = WalkState->Op;
405  OpType = WalkState->OpInfo->Type;
406  OpClass = WalkState->OpInfo->Class;
407 
408  if (OpClass == AML_CLASS_UNKNOWN)
409  {
410  ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
412  }
413 
414  FirstArg = Op->Common.Value.Arg;
415 
416  /* Init the walk state */
417 
418  WalkState->NumOperands = 0;
419  WalkState->OperandIndex = 0;
420  WalkState->ReturnDesc = NULL;
421  WalkState->ResultObj = NULL;
422 
423  /* Call debugger for single step support (DEBUG build only) */
424 
425  Status = AcpiDbSingleStep (WalkState, Op, OpClass);
426  if (ACPI_FAILURE (Status))
427  {
429  }
430 
431  /* Decode the Opcode Class */
432 
433  switch (OpClass)
434  {
435  case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
436 
437  if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
438  {
439  Status = AcpiDsEvaluateNamePath (WalkState);
440  if (ACPI_FAILURE (Status))
441  {
442  goto Cleanup;
443  }
444  }
445  break;
446 
447  case AML_CLASS_EXECUTE: /* Most operators with arguments */
448 
449  /* Build resolved operand stack */
450 
451  Status = AcpiDsCreateOperands (WalkState, FirstArg);
452  if (ACPI_FAILURE (Status))
453  {
454  goto Cleanup;
455  }
456 
457  /*
458  * All opcodes require operand resolution, with the only exceptions
459  * being the ObjectType and SizeOf operators.
460  */
461  if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
462  {
463  /* Resolve all operands */
464 
465  Status = AcpiExResolveOperands (WalkState->Opcode,
466  &(WalkState->Operands [WalkState->NumOperands -1]),
467  WalkState);
468  }
469 
470  if (ACPI_SUCCESS (Status))
471  {
472  /*
473  * Dispatch the request to the appropriate interpreter handler
474  * routine. There is one routine per opcode "type" based upon the
475  * number of opcode arguments and return type.
476  */
477  Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
478  }
479  else
480  {
481  /*
482  * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
483  * Local is uninitialized.
484  */
486  (WalkState->Opcode == AML_STORE_OP) &&
487  (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
488  (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
489  (WalkState->Operands[0]->Reference.Class ==
490  WalkState->Operands[1]->Reference.Class) &&
491  (WalkState->Operands[0]->Reference.Value ==
492  WalkState->Operands[1]->Reference.Value))
493  {
494  Status = AE_OK;
495  }
496  else
497  {
499  "While resolving operands for [%s]",
500  AcpiPsGetOpcodeName (WalkState->Opcode)));
501  }
502  }
503 
504  /* Always delete the argument objects and clear the operand stack */
505 
506  AcpiDsClearOperands (WalkState);
507 
508  /*
509  * If a result object was returned from above, push it on the
510  * current result stack
511  */
512  if (ACPI_SUCCESS (Status) &&
513  WalkState->ResultObj)
514  {
515  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
516  }
517  break;
518 
519  default:
520 
521  switch (OpType)
522  {
523  case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
524 
525  /* 1 Operand, 0 ExternalResult, 0 InternalResult */
526 
527  Status = AcpiDsExecEndControlOp (WalkState, Op);
528 
529  break;
530 
532  /*
533  * If the method is referenced from within a package
534  * declaration, it is not a invocation of the method, just
535  * a reference to it.
536  */
537  if ((Op->Asl.Parent) &&
538  ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
539  (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
540  {
542  "Method Reference in a Package, Op=%p\n", Op));
543 
544  Op->Common.Node = (ACPI_NAMESPACE_NODE *)
545  Op->Asl.Value.Arg->Asl.Node;
546  AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
548  }
549 
551  "Method invocation, Op=%p\n", Op));
552 
553  /*
554  * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
555  * the method Node pointer
556  */
557  /* NextOp points to the op that holds the method name */
558 
559  NextOp = FirstArg;
560 
561  /* NextOp points to first argument op */
562 
563  NextOp = NextOp->Common.Next;
564 
565  /*
566  * Get the method's arguments and put them on the operand stack
567  */
568  Status = AcpiDsCreateOperands (WalkState, NextOp);
569  if (ACPI_FAILURE (Status))
570  {
571  break;
572  }
573 
574  /*
575  * Since the operands will be passed to another control method,
576  * we must resolve all local references here (Local variables,
577  * arguments to *this* method, etc.)
578  */
579  Status = AcpiDsResolveOperands (WalkState);
580  if (ACPI_FAILURE (Status))
581  {
582  /* On error, clear all resolved operands */
583 
584  AcpiDsClearOperands (WalkState);
585  break;
586  }
587 
588  /*
589  * Tell the walk loop to preempt this running method and
590  * execute the new method
591  */
593 
594  /*
595  * Return now; we don't want to disturb anything,
596  * especially the operand count!
597  */
599 
601 
603  "Executing CreateField Buffer/Index Op=%p\n", Op));
604 
605  Status = AcpiDsLoad2EndOp (WalkState);
606  if (ACPI_FAILURE (Status))
607  {
608  break;
609  }
610 
611  Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
612  break;
613 
614 
616 
618  "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
619  Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));
620 
621  switch (Op->Common.Parent->Common.AmlOpcode)
622  {
623  case AML_NAME_OP:
624  /*
625  * Put the Node on the object stack (Contains the ACPI Name
626  * of this object)
627  */
628  WalkState->Operands[0] = (void *)
629  Op->Common.Parent->Common.Node;
630  WalkState->NumOperands = 1;
631 
632  Status = AcpiDsCreateNode (WalkState,
633  Op->Common.Parent->Common.Node, Op->Common.Parent);
634  if (ACPI_FAILURE (Status))
635  {
636  break;
637  }
638 
639  /* Fall through */
640  /*lint -fallthrough */
641 
643 
644  Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
645  AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
646  break;
647 
648  default:
649 
650  Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
651  break;
652  }
653 
654  /*
655  * If a result object was returned from above, push it on the
656  * current result stack
657  */
658  if (WalkState->ResultObj)
659  {
660  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
661  }
662  break;
663 
668 
669  Status = AcpiDsLoad2EndOp (WalkState);
670  if (ACPI_FAILURE (Status))
671  {
672  break;
673  }
674 
675  if (Op->Common.AmlOpcode == AML_REGION_OP)
676  {
678  "Executing OpRegion Address/Length Op=%p\n", Op));
679 
680  Status = AcpiDsEvalRegionOperands (WalkState, Op);
681  if (ACPI_FAILURE (Status))
682  {
683  break;
684  }
685  }
686  else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
687  {
689  "Executing DataTableRegion Strings Op=%p\n", Op));
690 
691  Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
692  if (ACPI_FAILURE (Status))
693  {
694  break;
695  }
696  }
697  else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
698  {
700  "Executing BankField Op=%p\n", Op));
701 
702  Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
703  if (ACPI_FAILURE (Status))
704  {
705  break;
706  }
707  }
708  break;
709 
710  case AML_TYPE_UNDEFINED:
711 
713  "Undefined opcode type Op=%p", Op));
715 
716  case AML_TYPE_BOGUS:
717 
719  "Internal opcode=%X type Op=%p\n",
720  WalkState->Opcode, Op));
721  break;
722 
723  default:
724 
726  "Unimplemented opcode, class=0x%X "
727  "type=0x%X Opcode=0x%X Op=%p",
728  OpClass, OpType, Op->Common.AmlOpcode, Op));
729 
731  break;
732  }
733  }
734 
735  /*
736  * ACPI 2.0 support for 64-bit integers: Truncate numeric
737  * result value if we are executing from a 32-bit ACPI table
738  */
740 
741  /*
742  * Check if we just completed the evaluation of a
743  * conditional predicate
744  */
745  if ((ACPI_SUCCESS (Status)) &&
746  (WalkState->ControlState) &&
747  (WalkState->ControlState->Common.State ==
749  (WalkState->ControlState->Control.PredicateOp == Op))
750  {
751  Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
752  WalkState->ResultObj = NULL;
753  }
754 
755 
756 Cleanup:
757 
758  if (WalkState->ResultObj)
759  {
760  /* Break to debugger to display result */
761 
762  AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
763 
764  /*
765  * Delete the result op if and only if:
766  * Parent will not use the result -- such as any
767  * non-nested type2 op in a method (parent will be method)
768  */
769  AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
770  }
771 
772 #ifdef _UNDER_DEVELOPMENT
773 
774  if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
775  {
776  AcpiDbMethodEnd (WalkState);
777  }
778 #endif
779 
780  /* Invoke exception handler on error */
781 
782  if (ACPI_FAILURE (Status))
783  {
784  Status = AcpiDsMethodError (Status, WalkState);
785  }
786 
787  /* Always clear the object stack */
788 
789  WalkState->NumOperands = 0;
791 }
#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:407
void AcpiDsDeleteResultIfNotUsed(ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:359
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
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:710
#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:440
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:320
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:537
#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:753
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
ACPI_STATUS AcpiDsLoad2EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload2.c:415
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:635
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
ACPI_STATUS AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:518
#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:516
#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:92
UINT16 Opcode
Definition: acstruct.h:78
static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
Definition: dswexec.c:61
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 92 of file dswexec.c.

95 {
97  ACPI_OPERAND_OBJECT *ObjDesc;
98  ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
99 
100 
101  ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
102 
103 
104  WalkState->ControlState->Common.State = 0;
105 
106  if (ResultObj)
107  {
108  Status = AcpiDsResultPop (&ObjDesc, WalkState);
109  if (ACPI_FAILURE (Status))
110  {
112  "Could not get result from predicate evaluation"));
113 
115  }
116  }
117  else
118  {
119  Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
120  if (ACPI_FAILURE (Status))
121  {
123  }
124 
125  Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
126  if (ACPI_FAILURE (Status))
127  {
129  }
130 
131  ObjDesc = WalkState->Operands [0];
132  }
133 
134  if (!ObjDesc)
135  {
137  "No predicate ObjDesc=%p State=%p",
138  ObjDesc, WalkState));
139 
141  }
142 
143  /*
144  * Result of predicate evaluation must be an Integer
145  * object. Implicitly convert the argument if necessary.
146  */
147  Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
149  if (ACPI_FAILURE (Status))
150  {
151  goto Cleanup;
152  }
153 
154  if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
155  {
157  "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
158  ObjDesc, WalkState, ObjDesc->Common.Type));
159 
161  goto Cleanup;
162  }
163 
164  /* Truncate the predicate to 32-bits if necessary */
165 
166  (void) AcpiExTruncateFor32bitTable (LocalObjDesc);
167 
168  /*
169  * Save the result of the predicate evaluation on
170  * the control stack
171  */
172  if (LocalObjDesc->Integer.Value)
173  {
174  WalkState->ControlState->Common.Value = TRUE;
175  }
176  else
177  {
178  /*
179  * Predicate is FALSE, we will just toss the
180  * rest of the package
181  */
182  WalkState->ControlState->Common.Value = FALSE;
184  }
185 
186  /* Predicate can be used for an implicit return value */
187 
188  (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
189 
190 
191 Cleanup:
192 
194  "Completed a predicate eval=%X Op=%p\n",
195  WalkState->ControlState->Common.Value, WalkState->Op));
196 
197  /* Break to debugger to display result */
198 
199  AcpiDbDisplayResultObject (LocalObjDesc, WalkState);
200 
201  /*
202  * Delete the predicate result object (we know that
203  * we don't need it anymore)
204  */
205  if (LocalObjDesc != ObjDesc)
206  {
207  AcpiUtRemoveReference (LocalObjDesc);
208  }
209  AcpiUtRemoveReference (ObjDesc);
210 
211  WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
213 }
#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:679
#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:517
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:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#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 61 of file dswexec.c.

Referenced by AcpiDsExecEndOp().