Skip to content

Commit c0f32f4

Browse files
committed
2024-08: uefi v0.31 significant changes
1 parent c67b7c1 commit c0f32f4

File tree

1 file changed

+96
-2
lines changed

1 file changed

+96
-2
lines changed

content/this-month/2024-08/index.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ date = 2024-09-03
44

55
[extra]
66
month = "August 2024"
7-
editors = ["phil-opp"]
7+
editors = ["phil-opp", "phip1611"]
88
+++
99

1010
Welcome to a new issue of _"This Month in Rust OSDev"_. In these posts, we give a regular overview of notable changes in the Rust operating system development ecosystem.
@@ -101,6 +101,101 @@ In this section, we give an overview of notable changes to the projects hosted u
101101
<<changelog, either in list or text form>>
102102
-->
103103

104+
### [`uefi`](https://github.com/rust-osdev/uefi-rs)
105+
<span class="maintainers">Maintained by [@GabrielMajeri](https://github.com/GabrielMajeri), [@nicholasbishop](https://github.com/nicholasbishop), and [@phip1611](https://github.com/phip1611)</span>
106+
107+
`uefi` makes it easy to develop Rust software that leverages safe, convenient,
108+
and performant abstractions for UEFI functionality. Recently, we released
109+
version `v0.31` with some notable changes:
110+
111+
1. We introduced a new completely API to access boot and runtime services
112+
2. We reorganized the MemoryMap-related types.
113+
3. We reorganized the repository README's and `lib.rs` files (documentation for
114+
docs.rs)
115+
4. We talk about how the `std` implementation for UEFI targets compares to
116+
`uefi` and how both can be used together.
117+
118+
### 1. New API: Freestanding Functions API Change
119+
120+
We are planning a massive API change and introduced a new replacement API in
121+
release `v0.31`. The old API co-exists and is marked as `#[deprecated]`. The
122+
new API will make it easier to call boot or runtime services without having
123+
to pass `&BootServices` around all the time.
124+
125+
The typical use-case of our library users is to write UEFI image with code
126+
leveraging boot services and exiting them. Next, control is handed over to the
127+
next step, which is typically a kernel of an OS. These UEFI images typically
128+
are "99% code" using boot services, until they are exited.
129+
130+
Although the old API design ensures via the type system that no boot
131+
service scan be called after they have been exited, the test of time has proven
132+
that this adds unjustified complexity without bringing much real value add.
133+
134+
Instead, with the new API, which we provide **additionally** at this point,
135+
one can use freestanding functions which are behind the new modules:
136+
137+
- `uefi::system`: is a new module that provides freestanding functions for
138+
accessing fields of the global system table.
139+
- `uefi::boot`:
140+
is a new module that provides freestanding functions for boot services using
141+
the global system table.
142+
- `uefi::runtime`: is a new module that provides freestanding functions for
143+
runtime services using the global system table.
144+
145+
This solves API inconsistencies and restrictions already existing so far, and
146+
makes the overall handling a lot easier. This comes with the costs that
147+
functions may panic, if the boot services were exited but one tries to use
148+
them. However, the massive API simplification justifies this.
149+
150+
Find more and follow the progress and discussions on:
151+
- [the GitHub Issue](https://github.com/rust-osdev/uefi-rs/issues/893#issuecomment-2241610633).
152+
- [The function Migration Guide](https://github.com/rust-osdev/uefi-rs/blob/main/docs/funcs_migration.md)
153+
154+
#### 2. Memory Map Refactoring
155+
156+
TL;DR: What used to return `MemoryMap<'buf>` in the API, now returns
157+
`MemoryMapOwned`. Additionally, you can parse a chunk of memory using
158+
`MemoryMapRef` or `MemoryMapRefMut`.
159+
160+
We put significant effort into refactoring our abstractions for the UEFI memory
161+
map. These started in release v0.29 and were finalized in release v0.31.
162+
Instead of one `MemoryMap<'buf>` type, we now have the traits `MemoryMap` and
163+
`MemoryMapMut` along with the implementations `MemoryMapRef`, `MemoryMapRefMut`,
164+
and `MemoryMapOwned`. It is recommended to work with the specific
165+
implementations, as the main purpose for the traits is only to enforce a
166+
consistent API for these three implementations. This gives users the
167+
flexibility to cover all possible use cases one can have with an UEFI memory
168+
map. Read more:
169+
- [#1175](https://github.com/rust-osdev/uefi-rs/pull/1175)
170+
- [#1251](https://github.com/rust-osdev/uefi-rs/pull/1251)
171+
- [#1240](https://github.com/rust-osdev/uefi-rs/pull/1240)
172+
- [#1263](https://github.com/rust-osdev/uefi-rs/pull/1263)
173+
174+
In any case, obtaining the memory map from UEFI is hidden behind the
175+
public API of the crate, but we made it very easy to read/parse it in all
176+
possible scenarios!
177+
178+
#### 3. & 4.: Documentation Reorganization
179+
180+
We put significant value into our README and `lib.rs` files to improve the
181+
structure of our documentation. The main value-add and improvement is that we
182+
clearly, directly, and precisely talk about:
183+
184+
- What is `uefi`?
185+
- Which problems does it solve?
186+
- How can it be used?
187+
- How does it compare to the ecosystem.
188+
189+
To see an example how `uefi` and `std` can be used together, please head to
190+
[our repository](https://github.com/rust-osdev/uefi-rs/tree/main/uefi-std-example).
191+
192+
### Other
193+
194+
There were also a ton of other interesting fixes, changes, and additions!
195+
Check out our [Changelog](https://github.com/rust-osdev/uefi-rs/blob/main/uefi/CHANGELOG.md).
196+
197+
We merged the following PRs this month:
198+
<!-- todo -->
104199

105200
## Other Projects
106201

@@ -115,7 +210,6 @@ In this section, we describe updates to Rust OS projects that are not directly r
115210
...<<your project updates>>...
116211
-->
117212

118-
119213
## Join Us?
120214

121215
Are you interested in Rust-based operating system development? Our `rust-osdev` organization is always open to new members and new projects. Just let us know if you want to join! A good way for getting in touch is our [Zulip chat](https://rust-osdev.zulipchat.com).

0 commit comments

Comments
 (0)