The PI spec defines EFI_PROCESSOR_INFORMATION with a trailing EXTENDED_PROCESSOR_INFORMATION member (a union whose only member is the 24-byte EFI_CPU_PHYSICAL_LOCATION2), making the struct 48 bytes. The Rust struct was only 24 bytes. get_processor_info passes the processor number through unvalidated, so a caller could already set CPU_V2_EXTENDED_TOPOLOGY (bit 24) and make the firmware write the extended topology 24 bytes past the stack-allocated struct. Firmware performing a whole-struct copy overflowed it even without that flag. Add the missing field plus the CPU_V2_EXTENDED_TOPOLOGY constant so the extended topology is actually usable. |
||
|---|---|---|
| .cargo | ||
| .github | ||
| book | ||
| docs | ||
| template | ||
| uefi | ||
| uefi-macros | ||
| uefi-raw | ||
| uefi-std-example | ||
| uefi-test-runner | ||
| xtask | ||
| .editorconfig | ||
| .envrc | ||
| .gitattributes | ||
| .gitignore | ||
| .typos.toml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| PUBLISHING.md | ||
| README.md | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
uefi-rs
Rusty wrapper for the Unified Extensible Firmware Interface.
This crate makes it easy to develop Rust software that leverages safe, convenient, and performant abstractions for UEFI functionality.
Screenshot of an application running in QEMU on an UEFI firmware that leverages
our Rust library.
API and User Documentation
The main contribution of this project is the uefi crate.
Please refer to docs.rs for comprehensive documentation
of the latest stable release. The latest not necessarily yet published
documentation can be found in src/lib.rs, which can also
be locally viewed by running $ cargo xtask doc --open.
Developer Guide
Repository Structure
This repository provides various crates:
uefi: High-level wrapper around various low-level UEFI APIs. This crate makes it easy to develop Rust software that leverages safe, convenient, and performant abstractions for UEFI functionality. This is the main contribution of this project.uefi-raw: Raw ABI-compatible types that closely match the definitions in the UEFI Specification. They are suitable for implementing UEFI firmware or creating interfaces to it.uefi-macros: Helper macros used byuefi.uefi-test-runner: A UEFI application that runs our integration tests.uefi-std-example: Example UEFI app but as Rust standard binary.
Building and testing uefi-rs
Use the cargo xtask command to build and test the crate.
Available commands:
build: build all the UEFI packages--release: build in release mode--target {x86_64,ia32,aarch64}: choose target UEFI arch
clippy: run clippy on all the packages--target {x86_64,ia32,aarch64}: choose target UEFI arch--warnings-as-errors: treat warnings as errors
doc: build the docs for the UEFI packages--open: open the docs in a browser--warnings-as-errors: treat warnings as errors
run: builduefi-test-runnerand run it in QEMU--ci: disable some tests that don't work in the CI--disable-kvm: disable hardware accelerated virtualization support in QEMU. Especially useful if you want to run the tests under WSL on Windows.--example <NAME>: run an example instead of the main binary.--headless: run QEMU without a GUI--ovmf-code <PATH>: path of an OVMF code file--ovmf-vars <PATH>: path of an OVMF vars file--release: build in release mode--target {x86_64,ia32,aarch64}: choose target UEFI arch
test: run unit tests and doctests on the host
The uefi-test-runner directory contains a sample UEFI app which exercises
most of the library's functionality.
Check out the testing project's README.md for
prerequisites for running the tests.
Showcases
Selected showcases from community. Feel free to raise a PR and add yours!
ratatuefiprovides a Ratatui backend for the UEFI environment usinguefi.efimuxis an EFI application for booting other EFI applications, written with the aforementionedratatuefiand therefore alsouefi.uefircis a graphical UEFI IRC client to connect to an IRC server, chat, and read messages, all from the comfort of your motherboard's pre-boot environment.
Discuss and Contribute
For general discussions, feel free to join us in our Zulip and ask your questions there.
Further, you can submit bugs and also ask questions in our [issue tracker]. Contributions in the form of a PR are also highly welcome. Check our contributing guide for details.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.