Skip to content

Support the Match expression - #368

Merged
IsaacWoods merged 9 commits into
rust-osdev:mainfrom
martin-hughes:match-trials
Oct 18, 2026
Merged

IsaacWoods merged 9 commits into
rust-osdev:mainfrom
martin-hughes:match-trials

Conversation

@martin-hughes

Copy link
Copy Markdown
Contributor

Add support for the Match expression.

This supports only integers in the "operand" positions, and only compares against actual integers in the packages. This seems to match a strict reading of the ACPI spec, where Operand is defined to be an Integer. I'm told (but haven't checked) that these are the limitations imposed by the Windows NT interpreter as well.

This PR works by adding a new argument resolution behaviour purely for the Match opcodes - they're a bit odd because they're raw (unprefixed) bytes in the middle of the expression, and two of the opcodes overlap with others (MTR and MEQ overlaps with Zeros and Ones, respectively)

I've added a basic test to check that the newly parsed opcodes can't be used outside the Match context, plus plenty of other tests that the implemented behaviour matches (ho ho) the behaviour I've written above. The ASL match.asl script has also been checked against uACPI and ACPICA which give the same result.

I haven't squashed the commit history and there's a few low-value commits, so if you're happy to merge then feel free to squash them @IsaacWoods

Isaac I'm pretty happy this is good to go - but I've put you as the reviewer in case you want a closer look

@IsaacWoods IsaacWoods left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for working on this Martin! An elegant approach to this and nice tests :)

@IsaacWoods
IsaacWoods merged commit a69a4df into rust-osdev:main Oct 18, 2026
6 checks passed
@martin-hughes
martin-hughes deleted the match-trials branch October 25, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants