Skip to content

Add BufferField support for Increment/Decrement. - #351

Merged
martin-hughes merged 2 commits into
rust-osdev:mainfrom
dewyatt:dewyatt-increment-decrement-bufferfield
Oct 25, 2026
Merged

martin-hughes merged 2 commits into
rust-osdev:mainfrom
dewyatt:dewyatt-increment-decrement-bufferfield

Conversation

@dewyatt

@dewyatt dewyatt commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Feedback welcome, probably room for improvement here (new to the codebase).

The PCI bus _CRS on my machine requires this in a couple places like:

                CreateDWordField (RES0, 0xB4, GSLN)
                GSMN = ^VLVC.BDSM /* \_SB_.PCI0.VLVC.BDSM */
                GSMX = (^VLVC.TOLD & 0xFFFFF000)
                GSMX--
                GSLN = ((GSMX - GSMN) + One)

    0F63: 8A 52 45 53 30 0A B4 47 53 4C 4E 70 5E 2E 56 4C  // .RES0..GSLNp^.VL
    0F73: 56 43 42 44 53 4D 47 53 4D 4E 7B 5E 2E 56 4C 56  // VCBDSMGSMN{^.VLV
    0F83: 43 54 4F 4C 44 0C 00 F0 FF FF 47 53 4D 58 76 47  // CTOLD.....GSMXvG
    0F93: 53 4D 58 72 74 47 53 4D 58 47 53 4D 4E 00 01 47  // SMXrtGSMXGSMN..G
    0FA3: 53 4C 4E                                         // SLN

(full tables here)

@martin-hughes

Copy link
Copy Markdown
Contributor

Looks all good so far. Would you mind adding a test case for it? I don't think you could just write a ASL file for it, because aml-tester returns all reads as zero. Instead I think you probably need to copy one of the integration-style tests. The easiest examples to base it on are probably in tests/normal_fields.rs.

Take a look at the "standard handler" in that file - you'll need to provide values for the reads and checked values for the writes, but the test harness will assert that everything is correct.

@martin-hughes
martin-hughes force-pushed the dewyatt-increment-decrement-bufferfield branch from 67628eb to 1825d11 Compare October 24, 2026 20:15
@martin-hughes

Copy link
Copy Markdown
Contributor

I've rebased this in preparation for merging, although I'd still like to add a test or two. That'll have to wait for another day, sadly.

@martin-hughes
martin-hughes merged commit 4841ccb into rust-osdev:main Oct 25, 2026
6 checks passed
@martin-hughes

Copy link
Copy Markdown
Contributor

Merged - thanks for the fix @dewyatt. If you do choose to continue with this branch, just be aware of my force-push to it.

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