1#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
3pub enum CpuLocalError {
4 #[error("CPU-local area is not installed")]
6 AreaNotInstalled,
7 #[error("CPU-local area base {base:#x} is null or misaligned")]
9 InvalidAreaBase {
10 base: usize,
12 },
13 #[error("CPU-local prefix address calculation overflowed")]
15 AddressOverflow,
16 #[error("CPU-local area header does not match its runtime address")]
18 AreaIdentityMismatch,
19 #[error("CPU-local registers do not support host exception level {level}")]
21 UnsupportedHostLevel {
22 level: usize,
24 },
25 #[error("current-context source does not identify this CPU's execution context")]
27 CurrentContextMismatch,
28}
29
30#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
32pub enum ContextSwitchError {
33 #[error(transparent)]
35 CpuLocal(#[from] CpuLocalError),
36 #[error("outgoing context does not match the selected current context")]
38 CurrentContextMismatch,
39 #[error("previous-context token does not match the supplied context header")]
41 PreviousContextMismatch,
42 #[error("next context is already bound to a CPU")]
44 NextContextAlreadyBound,
45 #[error("previous-context binding epoch is stale")]
47 StalePreviousBinding,
48}