Skip to content

Commit 7fcc50f

Browse files
committed
Remove unused error mapping and add SEV C-Bit debug log
Eliminates an obsolete error mapping function to simplify error handling. Adds debug logging for SEV C-Bit mask and page table root to aid in diagnosis and validation of early memory management initialization.
1 parent d2489fb commit 7fcc50f

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

modules/axmm/src/lib.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,15 @@ pub mod backend;
1313
pub use self::aspace::AddrSpace;
1414
pub use self::backend::Backend;
1515

16-
use axerrno::{AxError, AxResult};
16+
use axerrno::AxResult;
1717
use axhal::mem::{MemRegionFlags, phys_to_virt};
1818
use axhal::paging::MappingFlags;
1919
use kspin::SpinNoIrq;
2020
use lazyinit::LazyInit;
2121
use memory_addr::{MemoryAddr, PhysAddr, VirtAddr, va};
22-
use memory_set::MappingError;
2322

2423
static KERNEL_ASPACE: LazyInit<SpinNoIrq<AddrSpace>> = LazyInit::new();
2524

26-
fn mapping_err_to_ax_err(err: MappingError) -> AxError {
27-
if !matches!(err, MappingError::AlreadyExists) {
28-
warn!("Mapping error: {err:?}");
29-
}
30-
match err {
31-
MappingError::InvalidParam => AxError::InvalidInput,
32-
MappingError::AlreadyExists => AxError::AlreadyExists,
33-
MappingError::BadState => AxError::BadState,
34-
}
35-
}
36-
3725
fn reg_flag_to_map_flag(f: MemRegionFlags) -> MappingFlags {
3826
let mut ret = MappingFlags::empty();
3927
if f.contains(MemRegionFlags::READ) {
@@ -116,6 +104,7 @@ pub fn init_memory_management() {
116104
KERNEL_ASPACE.init_once(SpinNoIrq::new(kernel_aspace));
117105
let mut root = kernel_page_table_root();
118106
let cbit_mask = sev_cbit_mask();
107+
debug!("SEV C-Bit mask = {:#x}, ROOT = {:#x}", cbit_mask, root);
119108
if cbit_mask != 0 {
120109
root = PhysAddr::from(root.as_usize() | cbit_mask);
121110
}

0 commit comments

Comments
 (0)