Skip to content

lace-util: Introduce basic ACPI and ELF64 parsers#43

Merged
julian-klode merged 3 commits into
mainfrom
lace-util-parsers
Apr 29, 2026
Merged

lace-util: Introduce basic ACPI and ELF64 parsers#43
julian-klode merged 3 commits into
mainfrom
lace-util-parsers

Conversation

@kukrimate
Copy link
Copy Markdown
Member

@kukrimate kukrimate commented Apr 23, 2026

This pull requests adds basic ACPI and ELF64 parsers to lace-util for the upcoming lace VM firmware implementation.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 flashedit CLI 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.

Comment thread tools/flashedit/src/main.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread lace-util/src/cbfs.rs Outdated
Comment thread lace-util/src/acpi/mod.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread lace-util/src/cbfs.rs Outdated
Comment thread lace-util/src/acpi/mod.rs Outdated
Comment thread lace-util/src/elf64.rs Outdated
Comment thread lace-util/src/acpi/fadt.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.

Comment thread tools/flashedit/src/main.rs Outdated
Comment thread lace-util/src/acpi/mod.rs
Comment thread lace-util/src/elf64.rs
Comment thread lace-util/src/elf64.rs Outdated
Comment thread lace-util/src/cbfs.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread lace-util/src/cbfs.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@kukrimate kukrimate requested a review from Copilot April 23, 2026 15:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Comment thread lace-util/src/cbfs.rs Outdated
Comment thread lace-util/src/cbfs.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Comment thread tools/flashedit/src/main.rs Outdated
Comment thread tools/flashedit/src/main.rs Outdated
Comment thread lace-util/src/acpi/mod.rs
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.
@kukrimate kukrimate changed the title Lace firmware batch 1: lace-util changes and flashedit tool lace-util: Introduce basic ACPI and ELF64 parsers Apr 29, 2026
@kukrimate kukrimate requested a review from Copilot April 29, 2026 10:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread lace-util/src/elf64.rs Outdated
Comment thread lace-util/src/acpi/mod.rs Outdated
Comment thread lace-util/src/acpi/mcfg.rs
Comment thread lace-util/src/acpi/fadt.rs
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread lace-util/src/elf64.rs
Comment thread lace-util/src/elf64.rs
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>
@julian-klode julian-klode merged commit 2e0ad13 into main Apr 29, 2026
17 checks passed
@julian-klode julian-klode deleted the lace-util-parsers branch April 29, 2026 10:53
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.

3 participants