Skip to content

Commit 26a6aee

Browse files
committed
Use ptr::write for writing page table
1 parent 2550267 commit 26a6aee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bios/stage-4/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ fn create_page_tables(frame_allocator: &mut impl FrameAllocator<Size4KiB>) -> Pa
157157
// get the corresponding virtual address
158158
let addr = phys_offset + frame.start_address().as_u64();
159159
// initialize a new page table
160-
let ptr = addr.as_mut_ptr();
161-
unsafe { *ptr = PageTable::new() };
160+
let ptr: *mut PageTable = addr.as_mut_ptr();
161+
unsafe { ptr.write(PageTable::new()) };
162162
let level_4_table = unsafe { &mut *ptr };
163163
(
164164
unsafe { OffsetPageTable::new(level_4_table, phys_offset) },

0 commit comments

Comments
 (0)