Skip to content

Commit bc6d753

Browse files
committed
aarch64/paging: Remove use of static_mut_refs
Signed-off-by: Akira Moroo <[email protected]>
1 parent 9930cf2 commit bc6d753

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/arch/aarch64/paging.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub mod mair {
206206
/// # Safety
207207
///
208208
/// - Supposed to land in `.bss`. Therefore, ensure that all initial member values boil down to "0".
209-
static mut KERNEL_TABLES: SyncUnsafeCell<TranslationTable> =
209+
static KERNEL_TABLES: SyncUnsafeCell<TranslationTable> =
210210
SyncUnsafeCell::new(TranslationTable::new());
211211

212212
static MMU: MemoryManagementUnit = MemoryManagementUnit;
@@ -276,18 +276,15 @@ impl interface::Mmu for MemoryManagementUnit {
276276
// Prepare the memory attribute indirection register.
277277
self.setup_mair();
278278

279+
let kernel_tables = &mut *KERNEL_TABLES.get();
280+
279281
// Populate translation tables.
280-
#[allow(static_mut_refs)]
281-
KERNEL_TABLES
282-
.get_mut()
282+
kernel_tables
283283
.populate_tt_entries()
284284
.map_err(MmuEnableError::Other)?;
285285

286286
// Set the "Translation Table Base Register".
287-
TTBR0_EL1.set_baddr(
288-
#[allow(static_mut_refs)]
289-
KERNEL_TABLES.get_mut().phys_base_address(),
290-
);
287+
TTBR0_EL1.set_baddr(kernel_tables.phys_base_address());
291288

292289
self.configure_translation_control();
293290

0 commit comments

Comments
 (0)