-
-
Notifications
You must be signed in to change notification settings - Fork 82
Allow BufferField -> Integer conversion #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
IsaacWoods
merged 7 commits into
rust-osdev:main
from
martin-hughes:i272-deref-of-reference
May 15, 2026
+149
−85
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
67af636
Allow BufferField -> Integer conversion
martin-hughes 87b306f
Buffer[Field] -> Integer tests & fixes
martin-hughes 7bd1197
Remove possible overflow during conversion
martin-hughes 7d8590a
Reinstate failing tests
martin-hughes 554b719
Add integer size type
martin-hughes ffd52f3
Remove unused error code
martin-hughes 4b81eba
Move IntegerSize back to mod.rs
martin-hughes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| use aml_test_tools::handlers::null_handler::NullHandler; | ||
|
|
||
| mod test_infra; | ||
|
|
||
| #[test] | ||
| fn test_deref_of_buffer_field() { | ||
| const AML: &str = r#" | ||
| DefinitionBlock ("", "SSDT", 2, "RSACPI", "DerefOf", 0x00000002) { | ||
| Scope (\_SB) { | ||
| Name (ADAT, Buffer (0x0010) { | ||
| /* 0000 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| /* 0008 */ 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| }) | ||
| } | ||
|
|
||
| Method(MAIN, 0, NotSerialized) { | ||
| Local0 = (DerefOf(\_SB.ADAT[0x09])) | ||
| // This relies on subtraction rather than equality as logical ops on BufferFields don't work | ||
| // yet. | ||
| // TODO: Use logical ops for clarity, when available. | ||
| return (Local0 - 0xaa) | ||
| } | ||
| } | ||
| "#; | ||
|
|
||
| let handler = NullHandler {}; | ||
| test_infra::run_aml_test(AML, handler); | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn't work because we're still not handling derefs of index operations correctly -
Local0should end up as anIntegerrather than aBufferFieldI'm pretty sure. If convenient, could you add aTODOto fix this in future?