Skip to content

Commit 4056a62

Browse files
committed
feat: axerrno compatibility
1 parent 5a3da2e commit 4056a62

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

Cargo.lock

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

page_table_multiarch/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ rust-version.workspace = true
1414

1515
[features]
1616
default = []
17+
axerrno = ["dep:axerrno"]
1718
copy-from = ["dep:bitmaps"]
1819

1920
[dependencies]
21+
axerrno = { version = "0.1", optional = true }
22+
bitmaps = { version = "3.2", default-features = false, optional = true }
2023
log = "0.4"
2124
memory_addr.workspace = true
2225
page_table_entry.workspace = true
23-
bitmaps = { version = "3.2", default-features = false, optional = true }
2426

2527
[target.'cfg(any(target_arch = "x86_64", doc))'.dependencies]
2628
x86 = "0.52"

page_table_multiarch/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ pub enum PagingError {
3434
MappedToHugePage,
3535
}
3636

37+
#[cfg(feature = "axerrno")]
38+
impl From<PagingError> for axerrno::AxError {
39+
fn from(value: PagingError) -> Self {
40+
match value {
41+
PagingError::NoMemory => axerrno::AxError::NoMemory,
42+
_ => axerrno::AxError::InvalidInput,
43+
}
44+
}
45+
}
46+
3747
/// The specialized `Result` type for page table operations.
3848
pub type PagingResult<T = ()> = Result<T, PagingError>;
3949

0 commit comments

Comments
 (0)