PatchworkOS
Loading...
Searching...
No Matches
Term Objects

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_taml_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_taml_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_taml_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_taml_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.
 

Detailed Description

Term Objects Encoding.

See also
Section 20.2.5 of the ACPI specification for more details.

Enumeration Type Documentation

◆ aml_stop_reason_t

Stop reason.

Enumerator
AML_STOP_REASON_NONE 

No stop reason, continue execution or has reached the end of the TermList.

AML_STOP_REASON_RETURN 

A Return statement was hit.

AML_STOP_REASON_BREAK 

A Break statement was hit.

AML_STOP_REASON_CONTINUE 

A Continue statement was hit.

Definition at line 23 of file term.h.

Function Documentation

◆ aml_object_read()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 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_term_arg_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.

Parameters
ctxThe context of the TermList that this structure is part of.
allowedTypesBitmask of allowed types for the TermArg, the will be evaluated to one of these types.
Returns
On success, the TermArg object. On failure, 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_term_arg_read_buffer()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, the buffer. On failure, 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().

◆ aml_term_arg_read_integer()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the integer value of the TermArg.
Returns
On success, 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_term_arg_read_package()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, the package. On failure, 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_term_arg_read_string()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, the string. On failure, 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().

◆ aml_term_list_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.

Parameters
statePointer to the current AML state.
scopeThe location in the namespace from which names will be resolved.
startPointer to the start of the TermList in the AML byte stream.
endPointer to the end of the TermList in the AML byte stream.
parentCtxThe previous TermList context, or NULL if this is the top-level TermList, used to propagate stop reasons.
Returns
On success, 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().

◆ aml_term_obj_read()

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.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 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().