PatchworkOS
Loading...
Searching...
No Matches
Statement Opcodes

Statement Opcodes Encoding. More...

Functions

uint64_t aml_predicate_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a Predicate structure from the AML byte stream.
 
uint64_t aml_def_else_read (aml_term_list_ctx_t *ctx, bool shouldExecute)
 Reads a DefElse structure from the AML byte stream.
 
uint64_t aml_def_if_else_read (aml_term_list_ctx_t *ctx)
 Reads an DefIfElse structure from the AML byte stream.
 
uint64_t aml_def_noop_read (aml_term_list_ctx_t *ctx)
 Reads a DefNoop structure from the AML byte stream.
 
aml_object_taml_arg_object_read (aml_term_list_ctx_t *ctx)
 Reads an ArgObject structure from the AML byte stream.
 
uint64_t aml_def_return_read (aml_term_list_ctx_t *ctx)
 Reads a DefReturn structure from the AML byte stream.
 
uint64_t aml_def_break_read (aml_term_list_ctx_t *ctx)
 Reads a DefBreak structure from the AML byte stream.
 
uint64_t aml_def_continue_read (aml_term_list_ctx_t *ctx)
 Reads a DefContinue structure from the AML byte stream.
 
uint64_t aml_def_release_read (aml_term_list_ctx_t *ctx)
 Reads a DefRelease structure from the AML byte stream.
 
uint64_t aml_def_while_read (aml_term_list_ctx_t *ctx)
 Reads a DefWhile structure from the AML byte stream.
 
uint64_t aml_statement_opcode_read (aml_term_list_ctx_t *ctx)
 Reads an StatementOpcode structure from the AML byte stream.
 

Detailed Description

Statement Opcodes Encoding.

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

Function Documentation

◆ aml_arg_object_read()

aml_object_t * aml_arg_object_read ( aml_term_list_ctx_t ctx)

Reads an ArgObject structure from the AML byte stream.

An ArgObject structure is defined as ArgObject := TermArg => DataRefObject.

See also
Section 19.6.119 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, the ArgObject. On failure, NULL and errno is set.

Definition at line 128 of file statement.c.

References AML_DATA_REF_OBJECTS, AML_DEBUG_ERROR, aml_term_arg_read(), and NULL.

Referenced by aml_def_return_read().

◆ aml_def_break_read()

uint64_t aml_def_break_read ( aml_term_list_ctx_t ctx)

Reads a DefBreak structure from the AML byte stream.

A DefBreak structure is defined as DefBreak := BreakOp.

See also
Section 19.6.8 of the ACPI specification for more details.
Parameters
statePointer to the current AML state.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 189 of file statement.c.

References AML_BREAK_OP, AML_DEBUG_ERROR, AML_STOP_REASON_BREAK, aml_token_expect(), ERR, and aml_term_list_ctx_t::stopReason.

Referenced by aml_statement_opcode_read().

◆ aml_def_continue_read()

uint64_t aml_def_continue_read ( aml_term_list_ctx_t ctx)

Reads a DefContinue structure from the AML byte stream.

A DefContinue structure is defined as DefContinue := ContinueOp.

See also
Section 19.6.16 of the ACPI specification for more details.
Parameters
statePointer to the current AML state.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 201 of file statement.c.

References AML_CONTINUE_OP, AML_DEBUG_ERROR, AML_STOP_REASON_CONTINUE, aml_token_expect(), ERR, and aml_term_list_ctx_t::stopReason.

Referenced by aml_statement_opcode_read().

◆ aml_def_else_read()

uint64_t aml_def_else_read ( aml_term_list_ctx_t ctx,
bool  shouldExecute 
)

Reads a DefElse structure from the AML byte stream.

A DefElse structure is defined as DefElse := Nothing | <elseop pkglength termlist>.

See also
Section 19.6.39 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
shouldExecuteWhether the TermList should be executed or skipped.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 22 of file statement.c.

References AML_DEBUG_ERROR, AML_ELSE_OP, aml_pkg_length_read(), aml_term_list_read(), aml_token_expect(), aml_term_list_ctx_t::current, ERR, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_def_if_else_read().

◆ aml_def_if_else_read()

uint64_t aml_def_if_else_read ( aml_term_list_ctx_t ctx)

Reads an DefIfElse structure from the AML byte stream.

A DefIfElse structure is defined as DefIfElse := IfOp PkgLength Predicate TermList DefElse.

Note that the the DefIfElse structure is also used for normal If statements, just without a "Else" part, this is because the DefElse part is optional.

See also
Section 19.6.60 of the ACPI specification for more details.
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 56 of file statement.c.

References AML_DEBUG_ERROR, aml_def_else_read(), AML_ELSE_OP, AML_FALSE, AML_IF_OP, aml_pkg_length_read(), aml_predicate_read(), AML_STOP_REASON_NONE, aml_term_list_read(), aml_token_expect(), aml_token_peek(), aml_term_list_ctx_t::current, ERR, aml_token_t::num, aml_term_list_ctx_t::scope, start(), aml_term_list_ctx_t::state, and aml_term_list_ctx_t::stopReason.

Referenced by aml_statement_opcode_read().

◆ aml_def_noop_read()

uint64_t aml_def_noop_read ( aml_term_list_ctx_t ctx)

Reads a DefNoop structure from the AML byte stream.

A DefNoop structure is defined as DefNoop := NoopOp.

A Noop does nothing.

Parameters
statePointer to the current AML state.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 117 of file statement.c.

References AML_DEBUG_ERROR, AML_NOOP_OP, aml_token_expect(), and ERR.

Referenced by aml_statement_opcode_read().

◆ aml_def_release_read()

uint64_t aml_def_release_read ( aml_term_list_ctx_t ctx)

Reads a DefRelease structure from the AML byte stream.

A DefRelease structure is defined as DefRelease := ReleaseOp MutexObject.

See also
Section 19.6.117 of the ACPI specification for more details.
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 162 of file statement.c.

References AML_DEBUG_ERROR, AML_MUTEX, aml_mutex_object_read(), aml_mutex_release(), AML_RELEASE_OP, aml_token_expect(), assert, DEREF_DEFER, ERR, aml_mutex_obj_t::mutex, aml_object_t::mutex, and NULL.

Referenced by aml_statement_opcode_read().

◆ aml_def_return_read()

uint64_t aml_def_return_read ( aml_term_list_ctx_t ctx)

Reads a DefReturn structure from the AML byte stream.

A DefReturn structure is defined as DefReturn := ReturnOp ArgObject.

See also
Section 19.6.120 of the ACPI specification for more details.
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 140 of file statement.c.

References aml_arg_object_read(), AML_DEBUG_ERROR, AML_RETURN_OP, aml_state_result_set(), AML_STOP_REASON_RETURN, aml_token_expect(), DEREF_DEFER, ERR, NULL, aml_term_list_ctx_t::state, and aml_term_list_ctx_t::stopReason.

Referenced by aml_statement_opcode_read().

◆ aml_def_while_read()

uint64_t aml_def_while_read ( aml_term_list_ctx_t ctx)

Reads a DefWhile structure from the AML byte stream.

A DefWhile structure is defined as DefWhile := WhileOp PkgLength Predicate TermList.

The While statement works by evaluating the Predicate, if it is a non-zero integer, the TermList following the Predicate is executed, then the Predicate is evaluated again, this continues until the Predicate evaluates to zero.

See also
Section 19.6.158 of the ACPI specification for more details.
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 213 of file statement.c.

References AML_DEBUG_ERROR, AML_FALSE, aml_pkg_length_read(), aml_predicate_read(), AML_STOP_REASON_BREAK, AML_STOP_REASON_CONTINUE, AML_STOP_REASON_NONE, AML_STOP_REASON_RETURN, aml_term_list_read(), aml_token_expect(), AML_WHILE_OP, aml_term_list_ctx_t::current, EILSEQ, ERR, errno, aml_term_list_ctx_t::scope, start(), aml_term_list_ctx_t::state, and aml_term_list_ctx_t::stopReason.

Referenced by aml_statement_opcode_read().

◆ aml_predicate_read()

uint64_t aml_predicate_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a Predicate structure from the AML byte stream.

A Predicate structure is defined as Predicate := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe destination buffer to store the integer value of the Predicate.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 12 of file statement.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_if_else_read(), and aml_def_while_read().

◆ aml_statement_opcode_read()

uint64_t aml_statement_opcode_read ( aml_term_list_ctx_t ctx)

Reads an StatementOpcode structure from the AML byte stream.

A StatementOpcode structure is defined as StatementOpcode := DefBreak | DefBreakPoint | DefContinue | DefFatal | DefIfElse | DefNoop | DefNotify | DefRelease | DefReset | DefReturn | DefSignal | DefSleep | DefStall | DefWhile.

Currently unimplemented Opcodes are:

  • DefBreakPoint
  • DefFatal
  • DefNotify
  • DefReset
  • DefSignal
  • DefSleep
  • DefStall
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 285 of file statement.c.

References AML_BREAK_OP, AML_CONTINUE_OP, AML_DEBUG_ERROR, aml_def_break_read(), aml_def_continue_read(), aml_def_if_else_read(), aml_def_noop_read(), aml_def_release_read(), aml_def_return_read(), aml_def_while_read(), AML_IF_OP, AML_NOOP_OP, AML_RELEASE_OP, AML_RETURN_OP, aml_token_peek(), AML_WHILE_OP, ENOSYS, ERR, errno, aml_token_props_t::name, aml_token_t::num, and aml_token_t::props.

Referenced by aml_term_obj_read().