Skip to content

Commit e9d80e5

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

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/arch/x86_64/paging.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,23 @@ const TABLE: PageTable = PageTable::new();
1515

1616
// Put the Page Tables in static muts to make linking easier
1717
#[no_mangle]
18-
static mut L4_TABLE: SyncUnsafeCell<PageTable> = SyncUnsafeCell::new(PageTable::new());
18+
static L4_TABLE: SyncUnsafeCell<PageTable> = SyncUnsafeCell::new(PageTable::new());
1919
#[no_mangle]
20-
static mut L3_TABLE: SyncUnsafeCell<PageTable> = SyncUnsafeCell::new(PageTable::new());
20+
static L3_TABLE: SyncUnsafeCell<PageTable> = SyncUnsafeCell::new(PageTable::new());
2121
#[no_mangle]
22-
static mut L2_TABLES: SyncUnsafeCell<[PageTable; ADDRESS_SPACE_GIB]> =
22+
static L2_TABLES: SyncUnsafeCell<[PageTable; ADDRESS_SPACE_GIB]> =
2323
SyncUnsafeCell::new([TABLE; ADDRESS_SPACE_GIB]);
2424

2525
pub fn setup() {
2626
// SAFETY: This function is idempontent and only writes to static memory and
2727
// CR3. Thus, it is safe to run multiple times or on multiple threads.
28-
#[allow(static_mut_refs)]
29-
let (l4, l3, l2s) = unsafe { (L4_TABLE.get_mut(), L3_TABLE.get_mut(), L2_TABLES.get_mut()) };
28+
let (l4, l3, l2s) = unsafe {
29+
(
30+
&mut *L4_TABLE.get(),
31+
&mut *L3_TABLE.get(),
32+
&mut *L2_TABLES.get(),
33+
)
34+
};
3035
info!("Setting up {ADDRESS_SPACE_GIB} GiB identity mapping");
3136
let pt_flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
3237

0 commit comments

Comments
 (0)