Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
0002 /******************************************************************************
0003  *
0004  * Module Name: dswexec - Dispatcher method execution callbacks;
0005  *                        dispatch to interpreter.
0006  *
0007  * Copyright (C) 2000 - 2022, Intel Corp.
0008  *
0009  *****************************************************************************/
0010 
0011 #include <acpi/acpi.h>
0012 #include "accommon.h"
0013 #include "acparser.h"
0014 #include "amlcode.h"
0015 #include "acdispat.h"
0016 #include "acinterp.h"
0017 #include "acnamesp.h"
0018 #include "acdebug.h"
0019 #ifdef ACPI_EXEC_APP
0020 #include "aecommon.h"
0021 #endif
0022 
0023 #define _COMPONENT          ACPI_DISPATCHER
0024 ACPI_MODULE_NAME("dswexec")
0025 
0026 /*
0027  * Dispatch table for opcode classes
0028  */
0029 static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
0030     acpi_ex_opcode_0A_0T_1R,
0031     acpi_ex_opcode_1A_0T_0R,
0032     acpi_ex_opcode_1A_0T_1R,
0033     NULL,           /* Was: acpi_ex_opcode_1A_0T_0R (Was for Load operator) */
0034     acpi_ex_opcode_1A_1T_1R,
0035     acpi_ex_opcode_2A_0T_0R,
0036     acpi_ex_opcode_2A_0T_1R,
0037     acpi_ex_opcode_2A_1T_1R,
0038     acpi_ex_opcode_2A_2T_1R,
0039     acpi_ex_opcode_3A_0T_0R,
0040     acpi_ex_opcode_3A_1T_1R,
0041     acpi_ex_opcode_6A_0T_1R
0042 };
0043 
0044 /*****************************************************************************
0045  *
0046  * FUNCTION:    acpi_ds_get_predicate_value
0047  *
0048  * PARAMETERS:  walk_state      - Current state of the parse tree walk
0049  *              result_obj      - if non-zero, pop result from result stack
0050  *
0051  * RETURN:      Status
0052  *
0053  * DESCRIPTION: Get the result of a predicate evaluation
0054  *
0055  ****************************************************************************/
0056 
0057 acpi_status
0058 acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
0059                 union acpi_operand_object *result_obj)
0060 {
0061     acpi_status status = AE_OK;
0062     union acpi_operand_object *obj_desc;
0063     union acpi_operand_object *local_obj_desc = NULL;
0064 
0065     ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state);
0066 
0067     walk_state->control_state->common.state = 0;
0068 
0069     if (result_obj) {
0070         status = acpi_ds_result_pop(&obj_desc, walk_state);
0071         if (ACPI_FAILURE(status)) {
0072             ACPI_EXCEPTION((AE_INFO, status,
0073                     "Could not get result from predicate evaluation"));
0074 
0075             return_ACPI_STATUS(status);
0076         }
0077     } else {
0078         status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
0079         if (ACPI_FAILURE(status)) {
0080             return_ACPI_STATUS(status);
0081         }
0082 
0083         status =
0084             acpi_ex_resolve_to_value(&walk_state->operands[0],
0085                          walk_state);
0086         if (ACPI_FAILURE(status)) {
0087             return_ACPI_STATUS(status);
0088         }
0089 
0090         obj_desc = walk_state->operands[0];
0091     }
0092 
0093     if (!obj_desc) {
0094         ACPI_ERROR((AE_INFO,
0095                 "No predicate ObjDesc=%p State=%p",
0096                 obj_desc, walk_state));
0097 
0098         return_ACPI_STATUS(AE_AML_NO_OPERAND);
0099     }
0100 
0101     /*
0102      * Result of predicate evaluation must be an Integer
0103      * object. Implicitly convert the argument if necessary.
0104      */
0105     status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc,
0106                         ACPI_IMPLICIT_CONVERSION);
0107     if (ACPI_FAILURE(status)) {
0108         goto cleanup;
0109     }
0110 
0111     if (local_obj_desc->common.type != ACPI_TYPE_INTEGER) {
0112         ACPI_ERROR((AE_INFO,
0113                 "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
0114                 obj_desc, walk_state, obj_desc->common.type));
0115 
0116         status = AE_AML_OPERAND_TYPE;
0117         goto cleanup;
0118     }
0119 
0120     /* Truncate the predicate to 32-bits if necessary */
0121 
0122     (void)acpi_ex_truncate_for32bit_table(local_obj_desc);
0123 
0124     /*
0125      * Save the result of the predicate evaluation on
0126      * the control stack
0127      */
0128     if (local_obj_desc->integer.value) {
0129         walk_state->control_state->common.value = TRUE;
0130     } else {
0131         /*
0132          * Predicate is FALSE, we will just toss the
0133          * rest of the package
0134          */
0135         walk_state->control_state->common.value = FALSE;
0136         status = AE_CTRL_FALSE;
0137     }
0138 
0139     /* Predicate can be used for an implicit return value */
0140 
0141     (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE);
0142 
0143 cleanup:
0144 
0145     ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0146               "Completed a predicate eval=%X Op=%p\n",
0147               walk_state->control_state->common.value,
0148               walk_state->op));
0149 
0150     /* Break to debugger to display result */
0151 
0152     acpi_db_display_result_object(local_obj_desc, walk_state);
0153 
0154     /*
0155      * Delete the predicate result object (we know that
0156      * we don't need it anymore)
0157      */
0158     if (local_obj_desc != obj_desc) {
0159         acpi_ut_remove_reference(local_obj_desc);
0160     }
0161     acpi_ut_remove_reference(obj_desc);
0162 
0163     walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
0164     return_ACPI_STATUS(status);
0165 }
0166 
0167 /*****************************************************************************
0168  *
0169  * FUNCTION:    acpi_ds_exec_begin_op
0170  *
0171  * PARAMETERS:  walk_state      - Current state of the parse tree walk
0172  *              out_op          - Where to return op if a new one is created
0173  *
0174  * RETURN:      Status
0175  *
0176  * DESCRIPTION: Descending callback used during the execution of control
0177  *              methods. This is where most operators and operands are
0178  *              dispatched to the interpreter.
0179  *
0180  ****************************************************************************/
0181 
0182 acpi_status
0183 acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
0184               union acpi_parse_object **out_op)
0185 {
0186     union acpi_parse_object *op;
0187     acpi_status status = AE_OK;
0188     u32 opcode_class;
0189 
0190     ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state);
0191 
0192     op = walk_state->op;
0193     if (!op) {
0194         status = acpi_ds_load2_begin_op(walk_state, out_op);
0195         if (ACPI_FAILURE(status)) {
0196             goto error_exit;
0197         }
0198 
0199         op = *out_op;
0200         walk_state->op = op;
0201         walk_state->opcode = op->common.aml_opcode;
0202         walk_state->op_info =
0203             acpi_ps_get_opcode_info(op->common.aml_opcode);
0204 
0205         if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
0206             ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
0207                       "(%s) Popping scope for Op %p\n",
0208                       acpi_ut_get_type_name(walk_state->
0209                                 op_info->
0210                                 object_type),
0211                       op));
0212 
0213             status = acpi_ds_scope_stack_pop(walk_state);
0214             if (ACPI_FAILURE(status)) {
0215                 goto error_exit;
0216             }
0217         }
0218     }
0219 
0220     if (op == walk_state->origin) {
0221         if (out_op) {
0222             *out_op = op;
0223         }
0224 
0225         return_ACPI_STATUS(AE_OK);
0226     }
0227 
0228     /*
0229      * If the previous opcode was a conditional, this opcode
0230      * must be the beginning of the associated predicate.
0231      * Save this knowledge in the current scope descriptor
0232      */
0233     if ((walk_state->control_state) &&
0234         (walk_state->control_state->common.state ==
0235          ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
0236         ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0237                   "Exec predicate Op=%p State=%p\n",
0238                   op, walk_state));
0239 
0240         walk_state->control_state->common.state =
0241             ACPI_CONTROL_PREDICATE_EXECUTING;
0242 
0243         /* Save start of predicate */
0244 
0245         walk_state->control_state->control.predicate_op = op;
0246     }
0247 
0248     opcode_class = walk_state->op_info->class;
0249 
0250     /* We want to send namepaths to the load code */
0251 
0252     if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
0253         opcode_class = AML_CLASS_NAMED_OBJECT;
0254     }
0255 
0256     /*
0257      * Handle the opcode based upon the opcode type
0258      */
0259     switch (opcode_class) {
0260     case AML_CLASS_CONTROL:
0261 
0262         status = acpi_ds_exec_begin_control_op(walk_state, op);
0263         break;
0264 
0265     case AML_CLASS_NAMED_OBJECT:
0266 
0267         if (walk_state->walk_type & ACPI_WALK_METHOD) {
0268             /*
0269              * Found a named object declaration during method execution;
0270              * we must enter this object into the namespace. The created
0271              * object is temporary and will be deleted upon completion of
0272              * the execution of this method.
0273              *
0274              * Note 10/2010: Except for the Scope() op. This opcode does
0275              * not actually create a new object, it refers to an existing
0276              * object. However, for Scope(), we want to indeed open a
0277              * new scope.
0278              */
0279             if (op->common.aml_opcode != AML_SCOPE_OP) {
0280                 status =
0281                     acpi_ds_load2_begin_op(walk_state, NULL);
0282             } else {
0283                 status =
0284                     acpi_ds_scope_stack_push(op->named.node,
0285                                  op->named.node->
0286                                  type, walk_state);
0287                 if (ACPI_FAILURE(status)) {
0288                     return_ACPI_STATUS(status);
0289                 }
0290             }
0291         }
0292         break;
0293 
0294     case AML_CLASS_EXECUTE:
0295     case AML_CLASS_CREATE:
0296 
0297         break;
0298 
0299     default:
0300 
0301         break;
0302     }
0303 
0304     /* Nothing to do here during method execution */
0305 
0306     return_ACPI_STATUS(status);
0307 
0308 error_exit:
0309     status = acpi_ds_method_error(status, walk_state);
0310     return_ACPI_STATUS(status);
0311 }
0312 
0313 /*****************************************************************************
0314  *
0315  * FUNCTION:    acpi_ds_exec_end_op
0316  *
0317  * PARAMETERS:  walk_state      - Current state of the parse tree walk
0318  *
0319  * RETURN:      Status
0320  *
0321  * DESCRIPTION: Ascending callback used during the execution of control
0322  *              methods. The only thing we really need to do here is to
0323  *              notice the beginning of IF, ELSE, and WHILE blocks.
0324  *
0325  ****************************************************************************/
0326 
0327 acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
0328 {
0329     union acpi_parse_object *op;
0330     acpi_status status = AE_OK;
0331     u32 op_type;
0332     u32 op_class;
0333     union acpi_parse_object *next_op;
0334     union acpi_parse_object *first_arg;
0335 #ifdef ACPI_EXEC_APP
0336     char *namepath;
0337     union acpi_operand_object *obj_desc;
0338 #endif
0339 
0340     ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state);
0341 
0342     op = walk_state->op;
0343     op_type = walk_state->op_info->type;
0344     op_class = walk_state->op_info->class;
0345 
0346     if (op_class == AML_CLASS_UNKNOWN) {
0347         ACPI_ERROR((AE_INFO, "Unknown opcode 0x%X",
0348                 op->common.aml_opcode));
0349         return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
0350     }
0351 
0352     first_arg = op->common.value.arg;
0353 
0354     /* Init the walk state */
0355 
0356     walk_state->num_operands = 0;
0357     walk_state->operand_index = 0;
0358     walk_state->return_desc = NULL;
0359     walk_state->result_obj = NULL;
0360 
0361     /* Call debugger for single step support (DEBUG build only) */
0362 
0363     status = acpi_db_single_step(walk_state, op, op_class);
0364     if (ACPI_FAILURE(status)) {
0365         return_ACPI_STATUS(status);
0366     }
0367 
0368     /* Decode the Opcode Class */
0369 
0370     switch (op_class) {
0371     case AML_CLASS_ARGUMENT:    /* Constants, literals, etc. */
0372 
0373         if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
0374             status = acpi_ds_evaluate_name_path(walk_state);
0375             if (ACPI_FAILURE(status)) {
0376                 goto cleanup;
0377             }
0378         }
0379         break;
0380 
0381     case AML_CLASS_EXECUTE: /* Most operators with arguments */
0382 
0383         /* Build resolved operand stack */
0384 
0385         status = acpi_ds_create_operands(walk_state, first_arg);
0386         if (ACPI_FAILURE(status)) {
0387             goto cleanup;
0388         }
0389 
0390         /*
0391          * All opcodes require operand resolution, with the only exceptions
0392          * being the object_type and size_of operators.
0393          */
0394         if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
0395 
0396             /* Resolve all operands */
0397 
0398             status = acpi_ex_resolve_operands(walk_state->opcode,
0399                               &(walk_state->
0400                                 operands
0401                                 [walk_state->
0402                                  num_operands - 1]),
0403                               walk_state);
0404         }
0405 
0406         if (ACPI_SUCCESS(status)) {
0407             /*
0408              * Dispatch the request to the appropriate interpreter handler
0409              * routine. There is one routine per opcode "type" based upon the
0410              * number of opcode arguments and return type.
0411              */
0412             status =
0413                 acpi_gbl_op_type_dispatch[op_type] (walk_state);
0414         } else {
0415             /*
0416              * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
0417              * Local is uninitialized.
0418              */
0419             if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
0420                 (walk_state->opcode == AML_STORE_OP) &&
0421                 (walk_state->operands[0]->common.type ==
0422                  ACPI_TYPE_LOCAL_REFERENCE)
0423                 && (walk_state->operands[1]->common.type ==
0424                 ACPI_TYPE_LOCAL_REFERENCE)
0425                 && (walk_state->operands[0]->reference.class ==
0426                 walk_state->operands[1]->reference.class)
0427                 && (walk_state->operands[0]->reference.value ==
0428                 walk_state->operands[1]->reference.value)) {
0429                 status = AE_OK;
0430             } else {
0431                 ACPI_EXCEPTION((AE_INFO, status,
0432                         "While resolving operands for [%s]",
0433                         acpi_ps_get_opcode_name
0434                         (walk_state->opcode)));
0435             }
0436         }
0437 
0438         /* Always delete the argument objects and clear the operand stack */
0439 
0440         acpi_ds_clear_operands(walk_state);
0441 
0442         /*
0443          * If a result object was returned from above, push it on the
0444          * current result stack
0445          */
0446         if (ACPI_SUCCESS(status) && walk_state->result_obj) {
0447             status =
0448                 acpi_ds_result_push(walk_state->result_obj,
0449                         walk_state);
0450         }
0451         break;
0452 
0453     default:
0454 
0455         switch (op_type) {
0456         case AML_TYPE_CONTROL:  /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
0457 
0458             /* 1 Operand, 0 external_result, 0 internal_result */
0459 
0460             status = acpi_ds_exec_end_control_op(walk_state, op);
0461 
0462             break;
0463 
0464         case AML_TYPE_METHOD_CALL:
0465             /*
0466              * If the method is referenced from within a package
0467              * declaration, it is not a invocation of the method, just
0468              * a reference to it.
0469              */
0470             if ((op->asl.parent) &&
0471                 ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
0472                  || (op->asl.parent->asl.aml_opcode ==
0473                  AML_VARIABLE_PACKAGE_OP))) {
0474                 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
0475                           "Method Reference in a Package, Op=%p\n",
0476                           op));
0477 
0478                 op->common.node = (struct acpi_namespace_node *)
0479                     op->asl.value.arg->asl.node;
0480                 acpi_ut_add_reference(op->asl.value.arg->asl.
0481                               node->object);
0482                 return_ACPI_STATUS(AE_OK);
0483             }
0484 
0485             ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
0486                       "Method invocation, Op=%p\n", op));
0487 
0488             /*
0489              * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
0490              * the method Node pointer
0491              */
0492             /* next_op points to the op that holds the method name */
0493 
0494             next_op = first_arg;
0495 
0496             /* next_op points to first argument op */
0497 
0498             next_op = next_op->common.next;
0499 
0500             /*
0501              * Get the method's arguments and put them on the operand stack
0502              */
0503             status = acpi_ds_create_operands(walk_state, next_op);
0504             if (ACPI_FAILURE(status)) {
0505                 break;
0506             }
0507 
0508             /*
0509              * Since the operands will be passed to another control method,
0510              * we must resolve all local references here (Local variables,
0511              * arguments to *this* method, etc.)
0512              */
0513             status = acpi_ds_resolve_operands(walk_state);
0514             if (ACPI_FAILURE(status)) {
0515 
0516                 /* On error, clear all resolved operands */
0517 
0518                 acpi_ds_clear_operands(walk_state);
0519                 break;
0520             }
0521 
0522             /*
0523              * Tell the walk loop to preempt this running method and
0524              * execute the new method
0525              */
0526             status = AE_CTRL_TRANSFER;
0527 
0528             /*
0529              * Return now; we don't want to disturb anything,
0530              * especially the operand count!
0531              */
0532             return_ACPI_STATUS(status);
0533 
0534         case AML_TYPE_CREATE_FIELD:
0535 
0536             ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0537                       "Executing CreateField Buffer/Index Op=%p\n",
0538                       op));
0539 
0540             status = acpi_ds_load2_end_op(walk_state);
0541             if (ACPI_FAILURE(status)) {
0542                 break;
0543             }
0544 
0545             status =
0546                 acpi_ds_eval_buffer_field_operands(walk_state, op);
0547             if (ACPI_FAILURE(status)) {
0548                 break;
0549             }
0550 #ifdef ACPI_EXEC_APP
0551             /*
0552              * acpi_exec support for namespace initialization file (initialize
0553              * buffer_fields in this code.)
0554              */
0555             namepath =
0556                 acpi_ns_get_external_pathname(op->common.node);
0557             status = ae_lookup_init_file_entry(namepath, &obj_desc);
0558             if (ACPI_SUCCESS(status)) {
0559                 status =
0560                     acpi_ex_write_data_to_field(obj_desc,
0561                                 op->common.
0562                                 node->object,
0563                                 NULL);
0564                 if (ACPI_FAILURE(status)) {
0565                     ACPI_EXCEPTION((AE_INFO, status,
0566                             "While writing to buffer field"));
0567                 }
0568             }
0569             ACPI_FREE(namepath);
0570             status = AE_OK;
0571 #endif
0572             break;
0573 
0574         case AML_TYPE_CREATE_OBJECT:
0575 
0576             ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0577                       "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
0578                       op, op->named.value.arg,
0579                       op->common.parent->common.
0580                       aml_opcode));
0581 
0582             switch (op->common.parent->common.aml_opcode) {
0583             case AML_NAME_OP:
0584                 /*
0585                  * Put the Node on the object stack (Contains the ACPI Name
0586                  * of this object)
0587                  */
0588                 walk_state->operands[0] = (void *)
0589                     op->common.parent->common.node;
0590                 walk_state->num_operands = 1;
0591 
0592                 status = acpi_ds_create_node(walk_state,
0593                                  op->common.parent->
0594                                  common.node,
0595                                  op->common.parent);
0596                 if (ACPI_FAILURE(status)) {
0597                     break;
0598                 }
0599 
0600                 ACPI_FALLTHROUGH;
0601 
0602             case AML_INT_EVAL_SUBTREE_OP:
0603 
0604                 status =
0605                     acpi_ds_eval_data_object_operands
0606                     (walk_state, op,
0607                      acpi_ns_get_attached_object(op->common.
0608                                  parent->common.
0609                                  node));
0610                 break;
0611 
0612             default:
0613 
0614                 status =
0615                     acpi_ds_eval_data_object_operands
0616                     (walk_state, op, NULL);
0617                 break;
0618             }
0619 
0620             /*
0621              * If a result object was returned from above, push it on the
0622              * current result stack
0623              */
0624             if (walk_state->result_obj) {
0625                 status =
0626                     acpi_ds_result_push(walk_state->result_obj,
0627                             walk_state);
0628             }
0629             break;
0630 
0631         case AML_TYPE_NAMED_FIELD:
0632         case AML_TYPE_NAMED_COMPLEX:
0633         case AML_TYPE_NAMED_SIMPLE:
0634         case AML_TYPE_NAMED_NO_OBJ:
0635 
0636             status = acpi_ds_load2_end_op(walk_state);
0637             if (ACPI_FAILURE(status)) {
0638                 break;
0639             }
0640 
0641             if (op->common.aml_opcode == AML_REGION_OP) {
0642                 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0643                           "Executing OpRegion Address/Length Op=%p\n",
0644                           op));
0645 
0646                 status =
0647                     acpi_ds_eval_region_operands(walk_state,
0648                                  op);
0649                 if (ACPI_FAILURE(status)) {
0650                     break;
0651                 }
0652             } else if (op->common.aml_opcode == AML_DATA_REGION_OP) {
0653                 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0654                           "Executing DataTableRegion Strings Op=%p\n",
0655                           op));
0656 
0657                 status =
0658                     acpi_ds_eval_table_region_operands
0659                     (walk_state, op);
0660                 if (ACPI_FAILURE(status)) {
0661                     break;
0662                 }
0663             } else if (op->common.aml_opcode == AML_BANK_FIELD_OP) {
0664                 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0665                           "Executing BankField Op=%p\n",
0666                           op));
0667 
0668                 status =
0669                     acpi_ds_eval_bank_field_operands(walk_state,
0670                                      op);
0671                 if (ACPI_FAILURE(status)) {
0672                     break;
0673                 }
0674             }
0675             break;
0676 
0677         case AML_TYPE_UNDEFINED:
0678 
0679             ACPI_ERROR((AE_INFO,
0680                     "Undefined opcode type Op=%p", op));
0681             return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
0682 
0683         case AML_TYPE_BOGUS:
0684 
0685             ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
0686                       "Internal opcode=%X type Op=%p\n",
0687                       walk_state->opcode, op));
0688             break;
0689 
0690         default:
0691 
0692             ACPI_ERROR((AE_INFO,
0693                     "Unimplemented opcode, class=0x%X "
0694                     "type=0x%X Opcode=0x%X Op=%p",
0695                     op_class, op_type, op->common.aml_opcode,
0696                     op));
0697 
0698             status = AE_NOT_IMPLEMENTED;
0699             break;
0700         }
0701     }
0702 
0703     /*
0704      * ACPI 2.0 support for 64-bit integers: Truncate numeric
0705      * result value if we are executing from a 32-bit ACPI table
0706      */
0707     (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj);
0708 
0709     /*
0710      * Check if we just completed the evaluation of a
0711      * conditional predicate
0712      */
0713     if ((ACPI_SUCCESS(status)) &&
0714         (walk_state->control_state) &&
0715         (walk_state->control_state->common.state ==
0716          ACPI_CONTROL_PREDICATE_EXECUTING) &&
0717         (walk_state->control_state->control.predicate_op == op)) {
0718         status =
0719             acpi_ds_get_predicate_value(walk_state,
0720                         walk_state->result_obj);
0721         walk_state->result_obj = NULL;
0722     }
0723 
0724 cleanup:
0725 
0726     if (walk_state->result_obj) {
0727 
0728         /* Break to debugger to display result */
0729 
0730         acpi_db_display_result_object(walk_state->result_obj,
0731                           walk_state);
0732 
0733         /*
0734          * Delete the result op if and only if:
0735          * Parent will not use the result -- such as any
0736          * non-nested type2 op in a method (parent will be method)
0737          */
0738         acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
0739                           walk_state);
0740     }
0741 #ifdef _UNDER_DEVELOPMENT
0742 
0743     if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
0744         acpi_db_method_end(walk_state);
0745     }
0746 #endif
0747 
0748     /* Invoke exception handler on error */
0749 
0750     if (ACPI_FAILURE(status)) {
0751         status = acpi_ds_method_error(status, walk_state);
0752     }
0753 
0754     /* Always clear the object stack */
0755 
0756     walk_state->num_operands = 0;
0757     return_ACPI_STATUS(status);
0758 }