dswexec.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. /******************************************************************************
  2. *
  3. * Module Name: dswexec - Dispatcher method execution callbacks;
  4. * dispatch to interpreter.
  5. *
  6. *****************************************************************************/
  7. /*
  8. * Copyright (C) 2000 - 2005, R. Byron Moore
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions, and the following disclaimer,
  16. * without modification.
  17. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18. * substantially similar to the "NO WARRANTY" disclaimer below
  19. * ("Disclaimer") and any redistribution must be conditioned upon
  20. * including a substantially similar Disclaimer requirement for further
  21. * binary redistribution.
  22. * 3. Neither the names of the above-listed copyright holders nor the names
  23. * of any contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * Alternatively, this software may be distributed under the terms of the
  27. * GNU General Public License ("GPL") version 2 as published by the Free
  28. * Software Foundation.
  29. *
  30. * NO WARRANTY
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGES.
  42. */
  43. #include <acpi/acpi.h>
  44. #include <acpi/acparser.h>
  45. #include <acpi/amlcode.h>
  46. #include <acpi/acdispat.h>
  47. #include <acpi/acinterp.h>
  48. #include <acpi/acnamesp.h>
  49. #include <acpi/acdebug.h>
  50. #include <acpi/acdisasm.h>
  51. #define _COMPONENT ACPI_DISPATCHER
  52. ACPI_MODULE_NAME ("dswexec")
  53. /*
  54. * Dispatch table for opcode classes
  55. */
  56. static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
  57. acpi_ex_opcode_0A_0T_1R,
  58. acpi_ex_opcode_1A_0T_0R,
  59. acpi_ex_opcode_1A_0T_1R,
  60. acpi_ex_opcode_1A_1T_0R,
  61. acpi_ex_opcode_1A_1T_1R,
  62. acpi_ex_opcode_2A_0T_0R,
  63. acpi_ex_opcode_2A_0T_1R,
  64. acpi_ex_opcode_2A_1T_1R,
  65. acpi_ex_opcode_2A_2T_1R,
  66. acpi_ex_opcode_3A_0T_0R,
  67. acpi_ex_opcode_3A_1T_1R,
  68. acpi_ex_opcode_6A_0T_1R};
  69. /*****************************************************************************
  70. *
  71. * FUNCTION: acpi_ds_get_predicate_value
  72. *
  73. * PARAMETERS: walk_state - Current state of the parse tree walk
  74. *
  75. * RETURN: Status
  76. *
  77. * DESCRIPTION: Get the result of a predicate evaluation
  78. *
  79. ****************************************************************************/
  80. acpi_status
  81. acpi_ds_get_predicate_value (
  82. struct acpi_walk_state *walk_state,
  83. union acpi_operand_object *result_obj) {
  84. acpi_status status = AE_OK;
  85. union acpi_operand_object *obj_desc;
  86. union acpi_operand_object *local_obj_desc = NULL;
  87. ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state);
  88. walk_state->control_state->common.state = 0;
  89. if (result_obj) {
  90. status = acpi_ds_result_pop (&obj_desc, walk_state);
  91. if (ACPI_FAILURE (status)) {
  92. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  93. "Could not get result from predicate evaluation, %s\n",
  94. acpi_format_exception (status)));
  95. return_ACPI_STATUS (status);
  96. }
  97. }
  98. else {
  99. status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
  100. if (ACPI_FAILURE (status)) {
  101. return_ACPI_STATUS (status);
  102. }
  103. status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
  104. if (ACPI_FAILURE (status)) {
  105. return_ACPI_STATUS (status);
  106. }
  107. obj_desc = walk_state->operands [0];
  108. }
  109. if (!obj_desc) {
  110. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n",
  111. obj_desc, walk_state));
  112. return_ACPI_STATUS (AE_AML_NO_OPERAND);
  113. }
  114. /*
  115. * Result of predicate evaluation must be an Integer
  116. * object. Implicitly convert the argument if necessary.
  117. */
  118. status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16);
  119. if (ACPI_FAILURE (status)) {
  120. goto cleanup;
  121. }
  122. if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) {
  123. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  124. "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
  125. obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc)));
  126. status = AE_AML_OPERAND_TYPE;
  127. goto cleanup;
  128. }
  129. /* Truncate the predicate to 32-bits if necessary */
  130. acpi_ex_truncate_for32bit_table (local_obj_desc);
  131. /*
  132. * Save the result of the predicate evaluation on
  133. * the control stack
  134. */
  135. if (local_obj_desc->integer.value) {
  136. walk_state->control_state->common.value = TRUE;
  137. }
  138. else {
  139. /*
  140. * Predicate is FALSE, we will just toss the
  141. * rest of the package
  142. */
  143. walk_state->control_state->common.value = FALSE;
  144. status = AE_CTRL_FALSE;
  145. }
  146. cleanup:
  147. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
  148. walk_state->control_state->common.value, walk_state->op));
  149. /* Break to debugger to display result */
  150. ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state));
  151. /*
  152. * Delete the predicate result object (we know that
  153. * we don't need it anymore)
  154. */
  155. if (local_obj_desc != obj_desc) {
  156. acpi_ut_remove_reference (local_obj_desc);
  157. }
  158. acpi_ut_remove_reference (obj_desc);
  159. walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
  160. return_ACPI_STATUS (status);
  161. }
  162. /*****************************************************************************
  163. *
  164. * FUNCTION: acpi_ds_exec_begin_op
  165. *
  166. * PARAMETERS: walk_state - Current state of the parse tree walk
  167. * out_op - Return op if a new one is created
  168. *
  169. * RETURN: Status
  170. *
  171. * DESCRIPTION: Descending callback used during the execution of control
  172. * methods. This is where most operators and operands are
  173. * dispatched to the interpreter.
  174. *
  175. ****************************************************************************/
  176. acpi_status
  177. acpi_ds_exec_begin_op (
  178. struct acpi_walk_state *walk_state,
  179. union acpi_parse_object **out_op)
  180. {
  181. union acpi_parse_object *op;
  182. acpi_status status = AE_OK;
  183. u32 opcode_class;
  184. ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state);
  185. op = walk_state->op;
  186. if (!op) {
  187. status = acpi_ds_load2_begin_op (walk_state, out_op);
  188. if (ACPI_FAILURE (status)) {
  189. return_ACPI_STATUS (status);
  190. }
  191. op = *out_op;
  192. walk_state->op = op;
  193. walk_state->opcode = op->common.aml_opcode;
  194. walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
  195. if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
  196. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
  197. acpi_ut_get_type_name (walk_state->op_info->object_type), op));
  198. status = acpi_ds_scope_stack_pop (walk_state);
  199. if (ACPI_FAILURE (status)) {
  200. return_ACPI_STATUS (status);
  201. }
  202. }
  203. }
  204. if (op == walk_state->origin) {
  205. if (out_op) {
  206. *out_op = op;
  207. }
  208. return_ACPI_STATUS (AE_OK);
  209. }
  210. /*
  211. * If the previous opcode was a conditional, this opcode
  212. * must be the beginning of the associated predicate.
  213. * Save this knowledge in the current scope descriptor
  214. */
  215. if ((walk_state->control_state) &&
  216. (walk_state->control_state->common.state ==
  217. ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
  218. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
  219. op, walk_state));
  220. walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING;
  221. /* Save start of predicate */
  222. walk_state->control_state->control.predicate_op = op;
  223. }
  224. opcode_class = walk_state->op_info->class;
  225. /* We want to send namepaths to the load code */
  226. if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
  227. opcode_class = AML_CLASS_NAMED_OBJECT;
  228. }
  229. /*
  230. * Handle the opcode based upon the opcode type
  231. */
  232. switch (opcode_class) {
  233. case AML_CLASS_CONTROL:
  234. status = acpi_ds_result_stack_push (walk_state);
  235. if (ACPI_FAILURE (status)) {
  236. return_ACPI_STATUS (status);
  237. }
  238. status = acpi_ds_exec_begin_control_op (walk_state, op);
  239. break;
  240. case AML_CLASS_NAMED_OBJECT:
  241. if (walk_state->walk_type == ACPI_WALK_METHOD) {
  242. /*
  243. * Found a named object declaration during method
  244. * execution; we must enter this object into the
  245. * namespace. The created object is temporary and
  246. * will be deleted upon completion of the execution
  247. * of this method.
  248. */
  249. status = acpi_ds_load2_begin_op (walk_state, NULL);
  250. }
  251. if (op->common.aml_opcode == AML_REGION_OP) {
  252. status = acpi_ds_result_stack_push (walk_state);
  253. }
  254. break;
  255. case AML_CLASS_EXECUTE:
  256. case AML_CLASS_CREATE:
  257. /*
  258. * Most operators with arguments.
  259. * Start a new result/operand state
  260. */
  261. status = acpi_ds_result_stack_push (walk_state);
  262. break;
  263. default:
  264. break;
  265. }
  266. /* Nothing to do here during method execution */
  267. return_ACPI_STATUS (status);
  268. }
  269. /*****************************************************************************
  270. *
  271. * FUNCTION: acpi_ds_exec_end_op
  272. *
  273. * PARAMETERS: walk_state - Current state of the parse tree walk
  274. * Op - Op that has been just been completed in the
  275. * walk; Arguments have now been evaluated.
  276. *
  277. * RETURN: Status
  278. *
  279. * DESCRIPTION: Ascending callback used during the execution of control
  280. * methods. The only thing we really need to do here is to
  281. * notice the beginning of IF, ELSE, and WHILE blocks.
  282. *
  283. ****************************************************************************/
  284. acpi_status
  285. acpi_ds_exec_end_op (
  286. struct acpi_walk_state *walk_state)
  287. {
  288. union acpi_parse_object *op;
  289. acpi_status status = AE_OK;
  290. u32 op_type;
  291. u32 op_class;
  292. union acpi_parse_object *next_op;
  293. union acpi_parse_object *first_arg;
  294. ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state);
  295. op = walk_state->op;
  296. op_type = walk_state->op_info->type;
  297. op_class = walk_state->op_info->class;
  298. if (op_class == AML_CLASS_UNKNOWN) {
  299. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
  300. return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
  301. }
  302. first_arg = op->common.value.arg;
  303. /* Init the walk state */
  304. walk_state->num_operands = 0;
  305. walk_state->return_desc = NULL;
  306. walk_state->result_obj = NULL;
  307. /* Call debugger for single step support (DEBUG build only) */
  308. ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
  309. ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
  310. /* Decode the Opcode Class */
  311. switch (op_class) {
  312. case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
  313. break;
  314. case AML_CLASS_EXECUTE: /* most operators with arguments */
  315. /* Build resolved operand stack */
  316. status = acpi_ds_create_operands (walk_state, first_arg);
  317. if (ACPI_FAILURE (status)) {
  318. goto cleanup;
  319. }
  320. /* Done with this result state (Now that operand stack is built) */
  321. status = acpi_ds_result_stack_pop (walk_state);
  322. if (ACPI_FAILURE (status)) {
  323. goto cleanup;
  324. }
  325. /*
  326. * All opcodes require operand resolution, with the only exceptions
  327. * being the object_type and size_of operators.
  328. */
  329. if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
  330. /* Resolve all operands */
  331. status = acpi_ex_resolve_operands (walk_state->opcode,
  332. &(walk_state->operands [walk_state->num_operands -1]),
  333. walk_state);
  334. if (ACPI_SUCCESS (status)) {
  335. ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
  336. acpi_ps_get_opcode_name (walk_state->opcode),
  337. walk_state->num_operands, "after ex_resolve_operands");
  338. }
  339. }
  340. if (ACPI_SUCCESS (status)) {
  341. /*
  342. * Dispatch the request to the appropriate interpreter handler
  343. * routine. There is one routine per opcode "type" based upon the
  344. * number of opcode arguments and return type.
  345. */
  346. status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
  347. }
  348. else {
  349. /*
  350. * Treat constructs of the form "Store(local_x,local_x)" as noops when the
  351. * Local is uninitialized.
  352. */
  353. if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
  354. (walk_state->opcode == AML_STORE_OP) &&
  355. (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
  356. (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
  357. (walk_state->operands[0]->reference.opcode ==
  358. walk_state->operands[1]->reference.opcode) &&
  359. (walk_state->operands[0]->reference.offset ==
  360. walk_state->operands[1]->reference.offset)) {
  361. status = AE_OK;
  362. }
  363. else {
  364. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  365. "[%s]: Could not resolve operands, %s\n",
  366. acpi_ps_get_opcode_name (walk_state->opcode),
  367. acpi_format_exception (status)));
  368. }
  369. }
  370. /* Always delete the argument objects and clear the operand stack */
  371. acpi_ds_clear_operands (walk_state);
  372. /*
  373. * If a result object was returned from above, push it on the
  374. * current result stack
  375. */
  376. if (ACPI_SUCCESS (status) &&
  377. walk_state->result_obj) {
  378. status = acpi_ds_result_push (walk_state->result_obj, walk_state);
  379. }
  380. break;
  381. default:
  382. switch (op_type) {
  383. case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
  384. /* 1 Operand, 0 external_result, 0 internal_result */
  385. status = acpi_ds_exec_end_control_op (walk_state, op);
  386. /* Make sure to properly pop the result stack */
  387. if (ACPI_SUCCESS (status)) {
  388. status = acpi_ds_result_stack_pop (walk_state);
  389. }
  390. else if (status == AE_CTRL_PENDING) {
  391. status = acpi_ds_result_stack_pop (walk_state);
  392. if (ACPI_SUCCESS (status)) {
  393. status = AE_CTRL_PENDING;
  394. }
  395. }
  396. break;
  397. case AML_TYPE_METHOD_CALL:
  398. /*
  399. * If the method is referenced from within a package
  400. * declaration, it is not a invocation of the method, just
  401. * a reference to it.
  402. */
  403. if ((op->asl.parent) &&
  404. ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
  405. (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
  406. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op));
  407. op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
  408. acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
  409. return_ACPI_STATUS (AE_OK);
  410. }
  411. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op));
  412. /*
  413. * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
  414. * the method Node pointer
  415. */
  416. /* next_op points to the op that holds the method name */
  417. next_op = first_arg;
  418. /* next_op points to first argument op */
  419. next_op = next_op->common.next;
  420. /*
  421. * Get the method's arguments and put them on the operand stack
  422. */
  423. status = acpi_ds_create_operands (walk_state, next_op);
  424. if (ACPI_FAILURE (status)) {
  425. break;
  426. }
  427. /*
  428. * Since the operands will be passed to another control method,
  429. * we must resolve all local references here (Local variables,
  430. * arguments to *this* method, etc.)
  431. */
  432. status = acpi_ds_resolve_operands (walk_state);
  433. if (ACPI_FAILURE (status)) {
  434. /* On error, clear all resolved operands */
  435. acpi_ds_clear_operands (walk_state);
  436. break;
  437. }
  438. /*
  439. * Tell the walk loop to preempt this running method and
  440. * execute the new method
  441. */
  442. status = AE_CTRL_TRANSFER;
  443. /*
  444. * Return now; we don't want to disturb anything,
  445. * especially the operand count!
  446. */
  447. return_ACPI_STATUS (status);
  448. case AML_TYPE_CREATE_FIELD:
  449. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
  450. "Executing create_field Buffer/Index Op=%p\n", op));
  451. status = acpi_ds_load2_end_op (walk_state);
  452. if (ACPI_FAILURE (status)) {
  453. break;
  454. }
  455. status = acpi_ds_eval_buffer_field_operands (walk_state, op);
  456. break;
  457. case AML_TYPE_CREATE_OBJECT:
  458. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
  459. "Executing create_object (Buffer/Package) Op=%p\n", op));
  460. switch (op->common.parent->common.aml_opcode) {
  461. case AML_NAME_OP:
  462. /*
  463. * Put the Node on the object stack (Contains the ACPI Name of
  464. * this object)
  465. */
  466. walk_state->operands[0] = (void *) op->common.parent->common.node;
  467. walk_state->num_operands = 1;
  468. status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent);
  469. if (ACPI_FAILURE (status)) {
  470. break;
  471. }
  472. /* Fall through */
  473. /*lint -fallthrough */
  474. case AML_INT_EVAL_SUBTREE_OP:
  475. status = acpi_ds_eval_data_object_operands (walk_state, op,
  476. acpi_ns_get_attached_object (op->common.parent->common.node));
  477. break;
  478. default:
  479. status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
  480. break;
  481. }
  482. /* Done with this result state (Now that operand stack is built) */
  483. status = acpi_ds_result_stack_pop (walk_state);
  484. if (ACPI_FAILURE (status)) {
  485. goto cleanup;
  486. }
  487. /*
  488. * If a result object was returned from above, push it on the
  489. * current result stack
  490. */
  491. if (ACPI_SUCCESS (status) &&
  492. walk_state->result_obj) {
  493. status = acpi_ds_result_push (walk_state->result_obj, walk_state);
  494. }
  495. break;
  496. case AML_TYPE_NAMED_FIELD:
  497. case AML_TYPE_NAMED_COMPLEX:
  498. case AML_TYPE_NAMED_SIMPLE:
  499. case AML_TYPE_NAMED_NO_OBJ:
  500. status = acpi_ds_load2_end_op (walk_state);
  501. if (ACPI_FAILURE (status)) {
  502. break;
  503. }
  504. if (op->common.aml_opcode == AML_REGION_OP) {
  505. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
  506. "Executing op_region Address/Length Op=%p\n", op));
  507. status = acpi_ds_eval_region_operands (walk_state, op);
  508. if (ACPI_FAILURE (status)) {
  509. break;
  510. }
  511. status = acpi_ds_result_stack_pop (walk_state);
  512. }
  513. break;
  514. case AML_TYPE_UNDEFINED:
  515. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op));
  516. return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
  517. case AML_TYPE_BOGUS:
  518. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  519. "Internal opcode=%X type Op=%p\n",
  520. walk_state->opcode, op));
  521. break;
  522. default:
  523. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  524. "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
  525. op_class, op_type, op->common.aml_opcode, op));
  526. status = AE_NOT_IMPLEMENTED;
  527. break;
  528. }
  529. }
  530. /*
  531. * ACPI 2.0 support for 64-bit integers: Truncate numeric
  532. * result value if we are executing from a 32-bit ACPI table
  533. */
  534. acpi_ex_truncate_for32bit_table (walk_state->result_obj);
  535. /*
  536. * Check if we just completed the evaluation of a
  537. * conditional predicate
  538. */
  539. if ((ACPI_SUCCESS (status)) &&
  540. (walk_state->control_state) &&
  541. (walk_state->control_state->common.state ==
  542. ACPI_CONTROL_PREDICATE_EXECUTING) &&
  543. (walk_state->control_state->control.predicate_op == op)) {
  544. status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj);
  545. walk_state->result_obj = NULL;
  546. }
  547. cleanup:
  548. /* Invoke exception handler on error */
  549. if (ACPI_FAILURE (status) &&
  550. acpi_gbl_exception_handler &&
  551. !(status & AE_CODE_CONTROL)) {
  552. acpi_ex_exit_interpreter ();
  553. status = acpi_gbl_exception_handler (status,
  554. walk_state->method_node->name.integer, walk_state->opcode,
  555. walk_state->aml_offset, NULL);
  556. acpi_ex_enter_interpreter ();
  557. }
  558. if (walk_state->result_obj) {
  559. /* Break to debugger to display result */
  560. ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state));
  561. /*
  562. * Delete the result op if and only if:
  563. * Parent will not use the result -- such as any
  564. * non-nested type2 op in a method (parent will be method)
  565. */
  566. acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state);
  567. }
  568. #ifdef _UNDER_DEVELOPMENT
  569. if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
  570. acpi_db_method_end (walk_state);
  571. }
  572. #endif
  573. /* Always clear the object stack */
  574. walk_state->num_operands = 0;
  575. #ifdef ACPI_DISASSEMBLER
  576. /* On error, display method locals/args */
  577. if (ACPI_FAILURE (status)) {
  578. acpi_dm_dump_method_info (status, walk_state, op);
  579. }
  580. #endif
  581. return_ACPI_STATUS (status);
  582. }