Skip to content

Commit

Permalink
fix more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aarkegz committed Dec 5, 2024
1 parent 1823279 commit 2c7ab80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/axhal/src/platform/riscv64_qemu_virt/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ static mut BOOT_STACK: [u8; TASK_STACK_SIZE] = [0; TASK_STACK_SIZE];
#[link_section = ".data.boot_page_table"]
static mut BOOT_PT_SV39: [u64; 512] = [0; 512];

#[warn(clippy::identity_op)] // (0x0 << 10) here makes sense because it's an address
unsafe fn init_boot_page_table() {
// 0x0000_0000..0x4000_0000, VRWX_GAD, 1G block
BOOT_PT_SV39[0] = (0x0 << 10) | 0xef;
Expand All @@ -19,6 +20,7 @@ unsafe fn init_boot_page_table() {
BOOT_PT_SV39[0x102] = (0x80000 << 10) | 0xef;
}

#[allow(static_mut_refs)] // It's safe here because we're just writing its address to satp
unsafe fn init_mmu() {
let page_table_root = BOOT_PT_SV39.as_ptr() as usize;
satp::set(satp::Mode::Sv39, 0, page_table_root >> 12);
Expand Down
5 changes: 4 additions & 1 deletion modules/axhal/src/platform/x86_pc/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ pub fn dispatch_irq(vector: usize) {

pub(super) fn local_apic<'a>() -> &'a mut LocalApic {
// It's safe as LAPIC is per-cpu.
unsafe { LOCAL_APIC.as_mut().unwrap() }
#[allow(static_mut_refs)]
unsafe {
LOCAL_APIC.as_mut().unwrap()
}
}

pub(super) fn raw_apic_id(id_u8: u8) -> u32 {
Expand Down

0 comments on commit 2c7ab80

Please sign in to comment.