asterinas/ostd/src/error.rs

33 lines
869 B
Rust
Raw Normal View History

2024-01-03 03:22:36 +00:00
// SPDX-License-Identifier: MPL-2.0
use crate::mm::page_table::PageTableError;
2022-08-08 01:01:42 +00:00
/// The error type which is returned from the APIs of this crate.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Error {
2024-05-23 08:55:39 +00:00
/// Invalid arguments provided.
2022-08-08 01:01:42 +00:00
InvalidArgs,
2024-05-23 08:55:39 +00:00
/// Insufficient memory available.
2022-08-08 01:01:42 +00:00
NoMemory,
2024-05-23 08:55:39 +00:00
/// Page fault occurred.
2022-08-08 01:01:42 +00:00
PageFault,
2024-05-23 08:55:39 +00:00
/// Access to a resource is denied.
2022-08-08 01:01:42 +00:00
AccessDenied,
2024-05-23 08:55:39 +00:00
/// Input/output error.
2022-09-21 04:26:11 +00:00
IoError,
2024-05-23 08:55:39 +00:00
/// Insufficient system resources.
NotEnoughResources,
2024-05-23 08:55:39 +00:00
/// Arithmetic Overflow occurred.
Overflow,
2024-05-23 08:55:39 +00:00
/// Memory mapping already exists for the given virtual address.
MapAlreadyMappedVaddr,
/// Error when allocating kernel virtual memory.
KVirtAreaAllocError,
}
impl From<PageTableError> for Error {
fn from(_err: PageTableError) -> Error {
Error::AccessDenied
}
2022-08-08 01:01:42 +00:00
}