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

9 Commits

Author SHA1 Message Date
Achilleas Anagnostopoulos
f57aa9433d acpi: fix bugs discovered by fuzzing 2018-03-09 07:14:12 +00:00
Achilleas Anagnostopoulos
ddbddd2ea2 acpi: add Makefile target for fuzzing and AML parser fuzzer
The fuzzer can be invoked by running: "make test-fuzz". The AML parser
test suite has been augmented with a special "TestParserCrashers"
function that can be used to replay corpuses identified by go-fuzz as
causing parser crashes.

The test can be invoked as:

go test -v -run TestParserCrashers -aml-replace-crashers-from
$BUILD/fuzz/corpus/src_gopheros_device_acpi_aml/crashers

where $BUILD is the output directory (default: build/) defined in the
Makefile.
2018-03-09 07:14:12 +00:00
Achilleas Anagnostopoulos
d7028ed73d acpi: test the parser against actual AML dumps
All dumps are located in the tabletest package. The DSDT/SSDT dumps were
obtained by running an aml dump tool inside a virtualbox instance. The
dumps were disassembled using the iasl tool (version 20180105) from
Intel's reference ACPICA implementation.

The parser-testsuite dumps were written by hand to ensure that all
possible happy-paths in the parser were followed and then compiled into
AML using the same iasl tool.

The added TestParser function attempts to parse various sets of AML
dumps and then uses the object tree pretty-printer to obtain a dump of
the tree. The dump is then compared to an expected value (.exp files are
also placed in the tabletest package). The test code supports passing
the "-aml-regenerate-parser-exp-files" flag to update the exp files:

go test -run TestParser -aml-regenerate-parser-exp-files
2018-03-09 07:14:09 +00:00
Achilleas Anagnostopoulos
fe6c8f7293 acpi: implement AML multi-pass parser 2018-03-09 07:08:36 +00:00
Achilleas Anagnostopoulos
41eae61c9f acpi: update AML parser to use the new entities 2018-01-03 20:59:44 +00:00
Achilleas Anagnostopoulos
692155b44b acpi: refine post-parse entity processing rules
This commit updates the post-parse step so that:
- the visitor not longer recurses into method bodies. Since code inside
  methods may potentially generate dynamic/scoped entities or even use
  conditional invocations (if CondRefOf(X) { X(...) }), symbol resolution
  will be deferred to the AML interpreter.
- parent-child relationships between entities are checked and updated if
  not properly specified
2017-12-03 10:54:21 +00:00
Achilleas Anagnostopoulos
61a033e2ad acpi: tweak parser and add tests for parser errors 2017-09-30 16:40:53 +01:00
Achilleas Anagnostopoulos
d020045887 acpi: tag entities with the handle of the table that defines them
This allows us to implement the Unload opcode which given a handle,
removes all entities that are tagged by it.
2017-09-30 16:36:26 +01:00
Achilleas Anagnostopoulos
2a84c75d8e acpi: implement AML parser for all AML opcodes in the ACPI 6.2 spec 2017-09-30 16:36:22 +01:00