📄 dswexec.c
字号:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } first_arg = op->common.value.arg; /* Init the walk state */ walk_state->num_operands = 0; walk_state->return_desc = NULL; walk_state->result_obj = NULL; /* Call debugger for single step support (DEBUG build only) */ ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class)); ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);}); /* Decode the Opcode Class */ switch (op_class) { case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ break; case AML_CLASS_EXECUTE: /* most operators with arguments */ /* Build resolved operand stack */ status = acpi_ds_create_operands (walk_state, first_arg); if (ACPI_FAILURE (status)) { goto cleanup; } /* Done with this result state (Now that operand stack is built) */ status = acpi_ds_result_stack_pop (walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } /* * All opcodes require operand resolution, with the only exceptions * being the object_type and size_of operators. */ if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { /* Resolve all operands */ status = acpi_ex_resolve_operands (walk_state->opcode, &(walk_state->operands [walk_state->num_operands -1]), walk_state); if (ACPI_SUCCESS (status)) { ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, acpi_ps_get_opcode_name (walk_state->opcode), walk_state->num_operands, "after ex_resolve_operands"); } } if (ACPI_SUCCESS (status)) { /* * Dispatch the request to the appropriate interpreter handler * routine. There is one routine per opcode "type" based upon the * number of opcode arguments and return type. */ status = acpi_gbl_op_type_dispatch[op_type] (walk_state); } else { /* * Treat constructs of the form "Store(local_x,local_x)" as noops when the * Local is uninitialized. */ if ((status == AE_AML_UNINITIALIZED_LOCAL) && (walk_state->opcode == AML_STORE_OP) && (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && (walk_state->operands[0]->reference.opcode == walk_state->operands[1]->reference.opcode) && (walk_state->operands[0]->reference.offset == walk_state->operands[1]->reference.offset)) { status = AE_OK; } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n", acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception (status))); } } /* Always delete the argument objects and clear the operand stack */ acpi_ds_clear_operands (walk_state); /* * If a result object was returned from above, push it on the * current result stack */ if (ACPI_SUCCESS (status) && walk_state->result_obj) { status = acpi_ds_result_push (walk_state->result_obj, walk_state); } break; default: switch (op_type) { case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ /* 1 Operand, 0 external_result, 0 internal_result */ status = acpi_ds_exec_end_control_op (walk_state, op); if (ACPI_FAILURE (status)) { break; } status = acpi_ds_result_stack_pop (walk_state); break; case AML_TYPE_METHOD_CALL: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op)); /* * (AML_METHODCALL) Op->Value->Arg->Node contains * the method Node pointer */ /* next_op points to the op that holds the method name */ next_op = first_arg; /* next_op points to first argument op */ next_op = next_op->common.next; /* * Get the method's arguments and put them on the operand stack */ status = acpi_ds_create_operands (walk_state, next_op); if (ACPI_FAILURE (status)) { break; } /* * Since the operands will be passed to another control method, * we must resolve all local references here (Local variables, * arguments to *this* method, etc.) */ status = acpi_ds_resolve_operands (walk_state); if (ACPI_FAILURE (status)) { /* On error, clear all resolved operands */ acpi_ds_clear_operands (walk_state); break; } /* * Tell the walk loop to preempt this running method and * execute the new method */ status = AE_CTRL_TRANSFER; /* * Return now; we don't want to disturb anything, * especially the operand count! */ return_ACPI_STATUS (status); case AML_TYPE_CREATE_FIELD: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing create_field Buffer/Index Op=%p\n", op)); status = acpi_ds_load2_end_op (walk_state); if (ACPI_FAILURE (status)) { break; } status = acpi_ds_eval_buffer_field_operands (walk_state, op); break; case AML_TYPE_CREATE_OBJECT: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing create_object (Buffer/Package) Op=%p\n", op)); switch (op->common.parent->common.aml_opcode) { case AML_NAME_OP: /* * Put the Node on the object stack (Contains the ACPI Name of * this object) */ walk_state->operands[0] = (void *) op->common.parent->common.node; walk_state->num_operands = 1; status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); if (ACPI_FAILURE (status)) { break; } /* Fall through */ /*lint -fallthrough */ case AML_INT_EVAL_SUBTREE_OP: status = acpi_ds_eval_data_object_operands (walk_state, op, acpi_ns_get_attached_object (op->common.parent->common.node)); break; default: status = acpi_ds_eval_data_object_operands (walk_state, op, NULL); break; } /* Done with this result state (Now that operand stack is built) */ status = acpi_ds_result_stack_pop (walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } /* * If a result object was returned from above, push it on the * current result stack */ if (ACPI_SUCCESS (status) && walk_state->result_obj) { status = acpi_ds_result_push (walk_state->result_obj, walk_state); } break; case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_SIMPLE: case AML_TYPE_NAMED_NO_OBJ: status = acpi_ds_load2_end_op (walk_state); if (ACPI_FAILURE (status)) { break; } if (op->common.aml_opcode == AML_REGION_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing op_region Address/Length Op=%p\n", op)); status = acpi_ds_eval_region_operands (walk_state, op); if (ACPI_FAILURE (status)) { break; } status = acpi_ds_result_stack_pop (walk_state); } break; case AML_TYPE_UNDEFINED: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%p\n", walk_state->opcode, op)); break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", op_class, op_type, op->common.aml_opcode, op)); status = AE_NOT_IMPLEMENTED; break; } } /* * ACPI 2.0 support for 64-bit integers: Truncate numeric * result value if we are executing from a 32-bit ACPI table */ acpi_ex_truncate_for32bit_table (walk_state->result_obj); /* * Check if we just completed the evaluation of a * conditional predicate */ if ((ACPI_SUCCESS (status)) && (walk_state->control_state) && (walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) && (walk_state->control_state->control.predicate_op == op)) { status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj); walk_state->result_obj = NULL; }cleanup: /* Invoke exception handler on error */ if (ACPI_FAILURE (status) && acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { acpi_ex_exit_interpreter (); status = acpi_gbl_exception_handler (status, walk_state->method_node->name.integer, walk_state->opcode, walk_state->aml_offset, NULL); acpi_ex_enter_interpreter (); } if (walk_state->result_obj) { /* Break to debugger to display result */ ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); /* * Delete the result op if and only if: * Parent will not use the result -- such as any * non-nested type2 op in a method (parent will be method) */ acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state); }#ifdef _UNDER_DEVELOPMENT if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { acpi_db_method_end (walk_state); }#endif /* Always clear the object stack */ walk_state->num_operands = 0;#ifdef ACPI_DISASSEMBLER /* On error, display method locals/args */ if (ACPI_FAILURE (status)) { acpi_dm_dump_method_info (status, walk_state, op); }#endif return_ACPI_STATUS (status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -