Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 17e5aa0

Browse files
Merge pull request #790 from nicholasbishop/bishop-tpl
Add Tpl to uefi-raw and use it from uefi
2 parents 96fa66a + 12e59f7 commit 17e5aa0

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed

‎uefi-raw/src/table/boot.rs‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! UEFI services available during boot.
2+
3+
newtype_enum! {
4+
/// Task priority level.
5+
///
6+
/// Although the UEFI specification repeatedly states that only the variants
7+
/// specified below should be used in application-provided input, as the other
8+
/// are reserved for internal firmware use, it might still happen that the
9+
/// firmware accidentally discloses one of these internal TPLs to us.
10+
///
11+
/// Since feeding an unexpected variant to a Rust enum is UB, this means that
12+
/// this C enum must be interfaced via the newtype pattern.
13+
pub enum Tpl: usize => {
14+
/// Normal task execution level.
15+
APPLICATION = 4,
16+
/// Async interrupt-style callbacks run at this TPL.
17+
CALLBACK = 8,
18+
/// Notifications are masked at this level.
19+
///
20+
/// This is used in critical sections of code.
21+
NOTIFY = 16,
22+
/// Highest priority level.
23+
///
24+
/// Even processor interrupts are disable at this level.
25+
HIGH_LEVEL = 31,
26+
}}

‎uefi-raw/src/table/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
33
mod revision;
44

5+
pub mod boot;
6+
57
pub use revision::Revision;

‎uefi/src/table/boot.rs‎

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use {
2020
::alloc::vec::Vec,
2121
};
2222

23+
pub use uefi_raw::table::boot::Tpl;
24+
2325
// TODO: this similar to `SyncUnsafeCell`. Once that is stabilized we
2426
// can use it instead.
2527
struct GlobalImageHandle {
@@ -1673,31 +1675,6 @@ pub enum LoadImageSource<'a> {
16731675
},
16741676
}
16751677

1676-
newtype_enum! {
1677-
/// Task priority level.
1678-
///
1679-
/// Although the UEFI specification repeatedly states that only the variants
1680-
/// specified below should be used in application-provided input, as the other
1681-
/// are reserved for internal firmware use, it might still happen that the
1682-
/// firmware accidentally discloses one of these internal TPLs to us.
1683-
///
1684-
/// Since feeding an unexpected variant to a Rust enum is UB, this means that
1685-
/// this C enum must be interfaced via the newtype pattern.
1686-
pub enum Tpl: usize => {
1687-
/// Normal task execution level.
1688-
APPLICATION = 4,
1689-
/// Async interrupt-style callbacks run at this TPL.
1690-
CALLBACK = 8,
1691-
/// Notifications are masked at this level.
1692-
///
1693-
/// This is used in critical sections of code.
1694-
NOTIFY = 16,
1695-
/// Highest priority level.
1696-
///
1697-
/// Even processor interrupts are disable at this level.
1698-
HIGH_LEVEL = 31,
1699-
}}
1700-
17011678
/// RAII guard for task priority level changes
17021679
///
17031680
/// Will automatically restore the former task priority level when dropped.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /