2024-01-03 03:22:36 +00:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2024-05-26 17:53:44 +00:00
|
|
|
use crate::mm::page_table::PageTableError;
|
2024-04-22 07:05:50 +00:00
|
|
|
|
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.
|
2022-10-06 04:56:06 +00:00
|
|
|
NotEnoughResources,
|
2024-05-23 08:55:39 +00:00
|
|
|
/// Arithmetic Overflow occurred.
|
2024-03-25 07:49:02 +00:00
|
|
|
Overflow,
|
2024-05-23 08:55:39 +00:00
|
|
|
/// Memory mapping already exists for the given virtual address.
|
2024-04-22 07:05:50 +00:00
|
|
|
MapAlreadyMappedVaddr,
|
2024-09-24 06:09:15 +00:00
|
|
|
/// Error when allocating kernel virtual memory.
|
2024-09-24 19:02:26 +00:00
|
|
|
KVirtAreaAllocError,
|
2024-04-22 07:05:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<PageTableError> for Error {
|
|
|
|
|
fn from(_err: PageTableError) -> Error {
|
|
|
|
|
Error::AccessDenied
|
|
|
|
|
}
|
2022-08-08 01:01:42 +00:00
|
|
|
}
|