|
PatchworkOS
|
Term Objects Encoding. More...
Data Structures | |
| struct | aml_term_list_ctx_t |
| Context for reading a TermList. More... | |
Enumerations | |
| enum | aml_stop_reason_t { AML_STOP_REASON_NONE , AML_STOP_REASON_RETURN , AML_STOP_REASON_BREAK , AML_STOP_REASON_CONTINUE } |
| Stop reason. More... | |
Functions | |
| aml_object_t * | aml_term_arg_read (aml_term_list_ctx_t *ctx, aml_type_t allowedTypes) |
| Reads an TermArg structure from the AML byte stream. | |
| uint64_t | aml_term_arg_read_integer (aml_term_list_ctx_t *ctx, aml_integer_t *out) |
Wrapper around aml_term_arg_read() that converts the result to an integer. | |
| aml_string_obj_t * | aml_term_arg_read_string (aml_term_list_ctx_t *ctx) |
Wrapper around aml_term_arg_read() that converts the result to a string. | |
| aml_buffer_obj_t * | aml_term_arg_read_buffer (aml_term_list_ctx_t *ctx) |
Wrapper around aml_term_arg_read() that converts the result to a buffer. | |
| aml_package_obj_t * | aml_term_arg_read_package (aml_term_list_ctx_t *ctx) |
Wrapper around aml_term_arg_read() that converts the result to a package. | |
| uint64_t | aml_object_read (aml_term_list_ctx_t *ctx) |
| Reads an Object structure from the AML byte stream. | |
| uint64_t | aml_term_obj_read (aml_term_list_ctx_t *ctx) |
| Reads a TermObj structure from the AML byte stream. | |
| uint64_t | aml_term_list_read (aml_state_t *state, aml_object_t *scope, const uint8_t *start, const uint8_t *end, aml_term_list_ctx_t *parentCtx) |
| Reads a TermList structure from the AML byte stream. | |
Term Objects Encoding.
| enum aml_stop_reason_t |
| uint64_t aml_object_read | ( | aml_term_list_ctx_t * | ctx | ) |
Reads an Object structure from the AML byte stream.
An Object is defined as Object := NameSpaceModifierObj | NamedObj.
| ctx | The context of the TermList that this structure is part of. |
0. On failure, ERR and errno is set. Definition at line 147 of file term.c.
References AML_DEBUG_ERROR, aml_named_obj_read(), aml_namespace_modifier_obj_read(), aml_token_peek(), AML_TOKEN_TYPE_NAMED, AML_TOKEN_TYPE_NAMESPACE_MODIFIER, aml_token_type_to_string(), EILSEQ, ERR, errno, aml_token_t::props, and aml_token_props_t::type.
Referenced by aml_term_obj_read().
| aml_object_t * aml_term_arg_read | ( | aml_term_list_ctx_t * | ctx, |
| aml_type_t | allowedTypes | ||
| ) |
Reads an TermArg structure from the AML byte stream.
A TermArg is defined as TermArg := ExpressionOpcode | DataObject | ArgObj | LocalObj.
| ctx | The context of the TermList that this structure is part of. |
| allowedTypes | Bitmask of allowed types for the TermArg, the will be evaluated to one of these types. |
NULL and errno is set. Definition at line 20 of file term.c.
References aml_arg_obj_read(), aml_convert_source(), aml_data_object_read(), AML_DEBUG_ERROR, aml_expression_opcode_read(), aml_local_obj_read(), aml_object_exception_check(), aml_object_new(), aml_token_peek(), AML_TOKEN_TYPE_ARG, AML_TOKEN_TYPE_EXPRESSION, AML_TOKEN_TYPE_LOCAL, AML_TOKEN_TYPE_NAME, assert, DEREF, DEREF_DEFER, ERR, aml_token_props_t::name, NULL, aml_token_t::props, aml_term_list_ctx_t::state, and aml_token_props_t::type.
Referenced by aml_arg_object_read(), aml_buff_pkg_str_obj_read(), aml_data_read(), aml_obj_reference_read(), aml_op_termarg_simplename_read(), aml_op_termarg_supername_read(), aml_operand_read(), aml_source_buff_read(), aml_term_arg_list_read(), aml_term_arg_read_buffer(), aml_term_arg_read_integer(), aml_term_arg_read_package(), and aml_term_arg_read_string().
| aml_buffer_obj_t * aml_term_arg_read_buffer | ( | aml_term_list_ctx_t * | ctx | ) |
Wrapper around aml_term_arg_read() that converts the result to a buffer.
| ctx | The context of the TermList that this structure is part of. |
NULL and errno is set. Definition at line 119 of file term.c.
References AML_BUFFER, AML_DEBUG_ERROR, aml_term_arg_read(), assert, aml_object_t::buffer, and NULL.
Referenced by aml_def_to_string_read().
| uint64_t aml_term_arg_read_integer | ( | aml_term_list_ctx_t * | ctx, |
| aml_integer_t * | out | ||
| ) |
Wrapper around aml_term_arg_read() that converts the result to an integer.
| ctx | The context of the TermList that this structure is part of. |
| out | The output buffer to store the integer value of the TermArg. |
0. On failure, ERR and errno is set. Definition at line 89 of file term.c.
References AML_DEBUG_ERROR, AML_INTEGER, aml_term_arg_read(), assert, DEREF, ERR, aml_object_t::integer, NULL, and aml_integer_obj_t::value.
Referenced by aml_bank_value_read(), aml_bit_index_read(), aml_buffer_size_read(), aml_byte_index_read(), aml_def_var_num_elements_read(), aml_dividend_read(), aml_divisor_read(), aml_index_value_read(), aml_length_arg_read(), aml_num_bits_read(), aml_predicate_read(), aml_region_len_read(), aml_region_offset_read(), aml_shift_count_read(), and aml_start_index_read().
| aml_package_obj_t * aml_term_arg_read_package | ( | aml_term_list_ctx_t * | ctx | ) |
Wrapper around aml_term_arg_read() that converts the result to a package.
| ctx | The context of the TermList that this structure is part of. |
NULL and errno is set. Definition at line 133 of file term.c.
References AML_DEBUG_ERROR, AML_PACKAGE, aml_term_arg_read(), assert, NULL, and aml_object_t::package.
Referenced by aml_search_pkg_read().
| aml_string_obj_t * aml_term_arg_read_string | ( | aml_term_list_ctx_t * | ctx | ) |
Wrapper around aml_term_arg_read() that converts the result to a string.
| ctx | The context of the TermList that this structure is part of. |
NULL and errno is set. Definition at line 105 of file term.c.
References AML_DEBUG_ERROR, AML_STRING, aml_term_arg_read(), assert, NULL, and aml_object_t::string.
Referenced by aml_def_data_region_read().
| uint64_t aml_term_list_read | ( | aml_state_t * | state, |
| aml_object_t * | scope, | ||
| const uint8_t * | start, | ||
| const uint8_t * | end, | ||
| aml_term_list_ctx_t * | parentCtx | ||
| ) |
Reads a TermList structure from the AML byte stream.
A TermList structure is defined as TermList := Nothing | <termobj termlist>.
This is the biggest "structure" in AML, and the entry point for AML execution.
Will not advance the parent TermLists current pointer.
| state | Pointer to the current AML state. |
| scope | The location in the namespace from which names will be resolved. |
| start | Pointer to the start of the TermList in the AML byte stream. |
| end | Pointer to the end of the TermList in the AML byte stream. |
| parentCtx | The previous TermList context, or NULL if this is the top-level TermList, used to propagate stop reasons. |
0. On failure, ERR and errno is set. Definition at line 216 of file term.c.
References AML_STOP_REASON_NONE, aml_term_obj_read(), aml_term_list_ctx_t::current, EINVAL, aml_term_list_ctx_t::end, ERR, errno, NULL, start(), aml_term_list_ctx_t::state, and aml_term_list_ctx_t::stopReason.
Referenced by aml_def_device_read(), aml_def_else_read(), aml_def_if_else_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_scope_read(), aml_def_thermal_zone_read(), aml_def_while_read(), aml_method_evaluate(), and aml_parse().
| uint64_t aml_term_obj_read | ( | aml_term_list_ctx_t * | ctx | ) |
Reads a TermObj structure from the AML byte stream.
A TermObj is defined as TermObj := Object | StatementOpcode | ExpressionOpcode.
| ctx | The context of the TermList that this structure is part of. |
0. On failure, ERR and errno is set. Definition at line 165 of file term.c.
References AML_DEBUG_ERROR, aml_expression_opcode_read(), aml_object_read(), aml_statement_opcode_read(), aml_token_peek(), AML_TOKEN_TYPE_EXPRESSION, AML_TOKEN_TYPE_NAME, AML_TOKEN_TYPE_STATEMENT, DEREF, ERR, aml_token_props_t::name, NULL, aml_token_t::num, aml_token_t::props, and aml_token_props_t::type.
Referenced by aml_term_list_read().