Repository navigation
Align more of the interpreter with NT & fix a few more bugs - #169
Merged
Merged
Conversation
NT never replaces a field unit or a buffer field: a store or a CopyObject to one writes to it with implicit conversion, also when it's reached via an ArgX that holds a reference. Increment and Decrement work on fields behind any number of references as well. Firmware relies on this, e.g. EC helpers that take RefOf (Field) and do Arg1 = Arg0. Until now the field got replaced by the value instead, so the write never reached the EC, and an EC command loop waiting for the field to clear could hang. A field that is being accessed can't be overwritten anymore, so drop the cases that did that from field-io-vs-copy-object.asl. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
NT treats an Index() as a reference to where it points, wherever it's kept: - A store, CopyObject or Increment via an ArgX or a LocalX that holds an Index() of a buffer writes the byte, instead of replacing the ArgX or the LocalX. - An Index() of a package keeps referring to the slot that the element is stored in, also once it's passed to a method or stored to a LocalX. Until now those got a copy that only referred to the element, so a store via such an ArgX was lost, and a later replacement of the element wasn't seen. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
A store through an ArgX reference only overwrites data on NT, it's an error for a Device, Event, Method, Mutex, OperationRegion, PowerResource, Processor or ThermalZone. CopyObject is still allowed to overwrite them. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
A name can end up holding a reference, via CopyObject (RefOf (X), N) or a store of a RefOf() through an ArgX that refers to N. NT treats such a name as an alias of what it refers to: reading N reads X, and a CopyObject to N overwrites X, unless N holds an Index() of a package. Until now reading N produced the reference itself, which most operators then rejected. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Concatenating two empty buffers allocated 0 bytes, and so did converting an empty buffer to a string for Concatenate, as buffer_to_string() counted one comma less than there are values. Give both a byte like make_null_buffer() does and have buffer_to_string() write the null terminator itself, so that ToHexString() and ToDecimalString() don't need a special case for empty buffers anymore. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Commit 7f4c9ce forbade Buffer (0) {} on the grounds that NT and ACPICA do too, but both actually create an empty buffer for it. Do the same, giving it a byte of storage like the empty buffers that make_null_buffer() makes. More initializers than the size is still an error, as on NT. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
NT accepts a length of 0, the result is a buffer field that writes don't change anything through. Do the same instead of aborting the method, and make sure nothing tries to read from or write to such a field. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
The AML can declare a field with a length of 0. NT never accesses one, reading it returns 0 without touching the region, writing it does nothing, and it doesn't even write the index register of an index field. Do the same. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
NT doesn't truncate a String or a Buffer that's stored to a smaller field. It writes it one field-sized chunk at a time, every chunk being a complete write of the field, the last one zero-extended. An 8-bit field over a debug port prints the whole string that way, and anything that's backed by memory is left with the last chunk. An empty String or Buffer isn't written at all. Integers are still written in one go. Buffer fields and buffer indices work the same way, so only their last chunk is written, as that's all that can be observed. GenericSerialBus and the other fields that take a buffer as a whole aren't affected. The answers of the generated buffer field write test come from acpiexec, which truncates, so only give it the last chunk. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
NT does exactly that for every AnyAcc field, whatever its size and alignment, in SystemIO, PCI_Config and SystemMemory alike. Replace the TODO that suggested picking a wider access with a comment saying so. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.