1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

10 Commits

Author SHA1 Message Date
Achilleas Anagnostopoulos
2be5b9d224 acpi: add VM-support for AML bitwise opcodes 2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
38b2a3e4e2 acpi: add VM-support for AML arithmetic opcodes 2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
a172621af7 acpi: implement string <=> int converter
The converter is pretty basic at the moment and it only supports
converting to/from Integer and String types. This commit also includes
some argument => uint64 conversion helpers that will serve as the basis
for implementing the ALU opcodes.
2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
dfaf068735 acpi: implement vmStore/Copy for local/method args and references
The vmStore implementation does not support storing data to other AML
entities such as Buffers, Fields or Regions. Support for these entities
will be included in a separate commit.

The current vmCopyObject implementation is as simple as possible for
now; only copying of strings and uint64 values is supported. This
matches the behavior of vmLoad.

Both vmLoad/Store functions support reading/writing to/from object
references following the ACPI spec rules about automatic dereferencing.
2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
1a2d075aa2 acpi: implement minimal helper for reading AML operand values
The helper only supports reading a subset of the available AML operands:
- constants (uint64, strings and bools; bools are auto-casted to uint64)
- local and method args

The implementation will recursively drill down into the operand values
till it reaches a value that can be mapped to a Go uint64 or string
type. For example, if arg0 contains a constant with the value "foo",
vmRead will recurse into the arg0 value and return "foo"
2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
fd2f4a72ad acpi: instanciate AML interpreter when the ACPI driver is initialized 2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
63c69fe8d3 acpi: implement internal VM method for executing AML blocks
The execBlock method supports the various control flows defined by the
ACPI standard (next instr, continue, break and return). It is designed
so that it can be recursively invoked both AML methods and various
flow-altering opcodes (e.g. opIf, opWhile e.t.c.)
2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
718006f4e4 acpi: define AML opcode jumptable and populate with placeholder function
Due to the large number of opcodes that the AML VM needs to support,
using a long switch statement will not be as performant as setting up a
jump table due to the way that the go compiler generates code for long
switch statements on integer values (asm code indicates that binary
search is used to select the switch target).

For the time being, the populateJumpTable method will assign a
placeholder function to each jump table entry that just returns a
"opcode X not implemented error".
2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
1d5d1dc3ec acpi: implement VM entity lookup and visit wrappers 2017-12-04 06:35:26 +00:00
Achilleas Anagnostopoulos
64f3dae485 acpi: define VM type and structs to maintain execution state 2017-12-04 06:35:26 +00:00