|
PatchworkOS
|
Method Evaluation. More...
Functions | |
| aml_object_t * | aml_method_evaluate (aml_state_t *parentState, aml_method_obj_t *method, aml_object_t **args) |
| Evaluate a method with the given arguments. | |
| uint64_t | aml_method_evaluate_integer (aml_state_t *parentState, aml_object_t *object, aml_integer_t *out) |
| Wrapper around aml_method_evaluate for zero argument methods that return an integer or nothing and for integer objects. | |
Method Evaluation.
| aml_object_t * aml_method_evaluate | ( | aml_state_t * | parentState, |
| aml_method_obj_t * | method, | ||
| aml_object_t ** | args | ||
| ) |
Evaluate a method with the given arguments.
This function evaluates a method object with the provided arguments and stores the return value in the specified returnValue object.
Return values are a bit more complex then the spec suggests. The spec leaves "implicit returns", as in the method just ends without a Return statement, undefined. In practice this means we can do whatever we want.
However, since ACPICA is the standard and they allow for "implicit returns" such that the last evaluated expression is returned if there is no explicit Return statement, we just do what they do. Thus the return value will be set to a a copy of the last evaluated expression or a explicitly returned object.
If a method returns without implicitly or explicitly returning a value, a Integer object of value 0 with the AML_OBJECT_EXCEPTION_ON_USE flag set is returned.
Methods return a copy of the result not a reference to the actual object. See section 19.6.120.
| parentState | The current AML state, this will not be used for anything other than getting the parent overlay. |
| method | Pointer to the method to evaluate. |
| args | Array of pointers to the argument objects, can be NULL, must be null-terminated. |
ERR and errno is set. Definition at line 11 of file method.c.
References AML_MAX_ARGS, aml_mutex_acquire(), aml_mutex_release(), AML_NAME_TO_STRING, aml_namespace_overlay_get_highest_that_contains(), aml_namespace_overlay_set_parent(), aml_state_deinit(), aml_state_init(), aml_state_result_get(), aml_term_list_read(), aml_method_flags_t::argCount, CLOCKS_NEVER, CONTAINER_OF, E2BIG, EINVAL, EIO, aml_method_obj_t::end, ERR, errno, aml_method_obj_t::implementation, aml_method_flags_t::isSerialized, LOG_ERR, aml_method_obj_t::methodFlags, aml_method_obj_t::mutex, NULL, aml_state_t::overlay, aml_method_obj_t::start, and aml_method_flags_t::syncLevel.
Referenced by aml_method_evaluate_integer(), and aml_method_invocation_read().
| uint64_t aml_method_evaluate_integer | ( | aml_state_t * | parentState, |
| aml_object_t * | object, | ||
| aml_integer_t * | out | ||
| ) |
Wrapper around aml_method_evaluate for zero argument methods that return an integer or nothing and for integer objects.
| parentState | The current AML state, this will not be used for anything other than getting the parent overlay. |
| method | Pointer to the method or integer object to evaluate. |
| out | Pointer to the variable where the integer return value will be stored, can be NULL. |
0. On failure, ERR and errno is set. Definition at line 124 of file method.c.
References AML_INTEGER, AML_METHOD, aml_method_evaluate(), aml_type_to_string(), DEREF_DEFER, EINVAL, ERR, errno, aml_object_t::integer, LOG_ERR, aml_object_t::method, NULL, and aml_integer_obj_t::value.
Referenced by acpi_devices_init(), acpi_devices_init_children(), acpi_sta_get_flags(), and aml_pci_get_params().