lace-util: Introduce basic ACPI and ELF64 parsers#43
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds CBFS/ACPI/ELF64 parsing support to lace-util for upcoming VM firmware work, and introduces a new flashedit tool to create/list CBFS flash images.
Changes:
- Add a minimal ELF64 parser (headers + program header iteration).
- Add CBFS on-flash structs plus a read-only CBFS parser.
- Add a
flasheditCLI tool and wire it into the Cargo workspace.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
tools/flashedit/src/main.rs |
New CLI for creating and listing CBFS images. |
tools/flashedit/Cargo.toml |
New tool crate definition and dependencies. |
lace-util/src/lib.rs |
Expose new acpi, cbfs, and elf64 modules. |
lace-util/src/elf64.rs |
New minimal ELF64 parser + unit tests. |
lace-util/src/cbfs.rs |
New CBFS structs/parser + unit tests. |
lace-util/src/acpi/mod.rs |
New minimal RSDP + XSDT/RSDT table locator + tests. |
lace-util/src/acpi/mcfg.rs |
New MCFG table parser. |
lace-util/src/acpi/fadt.rs |
New FADT/FACS parsing helper + tests. |
Cargo.toml |
Add tools/flashedit to workspace members. |
Cargo.lock |
Lockfile update including the new flashedit package. |
5f48d9b to
1c32823
Compare
1c32823 to
9094725
Compare
9094725 to
e18fa5d
Compare
This will be used to gate parsers that are only use by lace firmware and should be compiled out from BIOS, EFI, etc bootloader builds.
e18fa5d to
1295092
Compare
1295092 to
4a412bc
Compare
New `lace_util::acpi` module with: - `RsdpV1` / `RsdpV2` structs and a `Rsdp::parse` helper that accepts either revision and validates the signature. - `SdtHeader` — the 36-byte header shared by all ACPI description tables. - `find_table` — walks the XSDT (or RSDT on v1) and returns the physical address of the first entry whose signature matches. The caller supplies a safe pointer-to-slice dereference closure, so the search logic can be unit-tested without any `unsafe`. New `lace_util::acpi::mcfg` module with the `McfgEntry` wire layout and a `parse_mcfg` helper that pulls the first segment's PCI ECAM base out of a raw MCFG table pointer. Together with `acpi::find_table` this is enough to locate the ECAM region on platforms that publish one. New `lace_util::acpi::fadt` module with the `Fadt` and `Facs` wire layouts. These are the tables the virt platform's S3 resume path uses to find Linux's waking vector, so they need to be parsable from bare-metal firmware before a real heap is available. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4a412bc to
7910eba
Compare
New `lace_util::elf64` module. Parses the ELF64 file header and program-header table, exposing `Elf64::parse`, `entry()`, and a `for_each_phdr` visitor that skips non-`PT_LOAD` segments. This is what the bare-metal firmware uses to load its own payload out of CBFS — it doesn't need section parsing or relocation, just "iterate the loadable segments and copy them to their physical addresses". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7910eba to
7047e80
Compare
julian-klode
approved these changes
Apr 29, 2026
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.
This pull requests adds basic ACPI and ELF64 parsers to lace-util for the upcoming lace VM firmware implementation.