PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
method.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <stdint.h>
6
7/**
8 * @brief Method Evaluation
9 * @defgroup modules_acpi_aml_method Methods
10 * @ingroup modules_acpi_aml
11 *
12 * @{
13 */
14
15/**
16 * @brief Invoke a method with the given arguments.
17 *
18 * Return values are a bit more complex then the spec suggests. The spec leaves "implicit returns", as in the method
19 * just ends without a Return statement, undefined. In practice this means we can do whatever we want.
20 *
21 * However, since ACPICA is the standard and they allow for "implicit returns" such that the last evaluated expression
22 * is returned if there is no explicit Return statement, we just do what they do. Thus the return value will be set to
23 * a a copy of the last evaluated expression or a explicitly returned object.
24 *
25 * If a method returns without implicitly or explicitly returning a value, a Integer object of value 0 with the
26 * `AML_OBJECT_EXCEPTION_ON_USE` flag set is returned.
27 *
28 * Methods return a copy of the result not a reference to the actual object. See section 19.6.120.
29 *
30 * Technically if a method is non-serialized we are not supposed to allow recursive calls to it to create named objects
31 * that where created in the previous invocation, however allowing this does not cause any issues in practice and makes
32 * the implementation a lot simpler... so i dont care.
33 *
34 * @see Section 5.2 of the ACPICA reference for more details.
35 * @see Section 19.6.85 of the ACPI specification for more details.
36 * @see aml_overlay_t for more details about the parent overlay.
37 *
38 * @param parentState The current AML state, this will not be used for anything other than getting the parent overlay.
39 * @param method Pointer to the method to invoke.
40 * @param args Array of pointers to the argument objects, can be `NULL`, must be null-terminated.
41 * @return On success, the return value of the method. On failure, `ERR` and `errno` is set.
42 */
44
45/** @} */
aml_object_t * aml_method_invoke(aml_state_t *parentState, aml_method_t *method, aml_object_t **args)
Invoke a method with the given arguments.
Definition method.c:11
Data for a method object.
Definition object.h:306
ACPI object.
Definition object.h:447
AML State.
Definition state.h:25