Fix a bunch of warnings masked by #[allow(unused)]

This commit is contained in:
bjorn3
2026-03-31 22:48:40 +02:00
parent d835a3d8f0
commit 2ce7621a80
9 changed files with 68 additions and 88 deletions
+40 -36
View File
@@ -147,21 +147,23 @@ unsafe fn instr_trapped_msr_mrs_inner(
}
exception_stack!(synchronous_exception_at_el1_with_spx, |stack| {
if !pf_inner(
stack,
exception_code(stack.iret.esr_el1),
"sync_exc_el1_spx",
) {
println!("Synchronous exception at EL1 with SPx");
if exception_code(stack.iret.esr_el1) == 0b100101 {
let far_el1 = far_el1();
println!("FAR_EL1 = 0x{:08x}", far_el1);
} else if exception_code(stack.iret.esr_el1) == 0b100100 {
let far_el1 = far_el1();
println!("USER FAR_EL1 = 0x{:08x}", far_el1);
unsafe {
if !pf_inner(
stack,
exception_code(stack.iret.esr_el1),
"sync_exc_el1_spx",
) {
println!("Synchronous exception at EL1 with SPx");
if exception_code(stack.iret.esr_el1) == 0b100101 {
let far_el1 = far_el1();
println!("FAR_EL1 = 0x{:08x}", far_el1);
} else if exception_code(stack.iret.esr_el1) == 0b100100 {
let far_el1 = far_el1();
println!("USER FAR_EL1 = 0x{:08x}", far_el1);
}
stack.trace();
loop {}
}
stack.trace();
loop {}
}
});
unsafe fn pf_inner(stack: &mut InterruptStack, ty: u8, from: &str) -> bool {
@@ -184,29 +186,31 @@ unsafe fn pf_inner(stack: &mut InterruptStack, ty: u8, from: &str) -> bool {
}
exception_stack!(synchronous_exception_at_el0, |stack| {
match exception_code(stack.iret.esr_el1) {
0b010101 => {
let scratch = &stack.scratch;
let mut token = unsafe { CleanLockToken::new() };
let ret = syscall::syscall(
scratch.x8, scratch.x0, scratch.x1, scratch.x2, scratch.x3, scratch.x4, scratch.x5,
&mut token,
);
stack.scratch.x0 = ret;
}
ty => {
if !pf_inner(stack, ty as u8, "sync_exc_el0") {
error!(
"FATAL: Not an SVC induced synchronous exception (ty={:b})",
ty
unsafe {
match exception_code(stack.iret.esr_el1) {
0b010101 => {
let scratch = &stack.scratch;
let mut token = CleanLockToken::new();
let ret = syscall::syscall(
scratch.x8, scratch.x0, scratch.x1, scratch.x2, scratch.x3, scratch.x4,
scratch.x5, &mut token,
);
println!("FAR_EL1: {:#0x}", far_el1());
//crate::debugger::debugger(None);
stack.trace();
excp_handler(Exception {
kind: 0, // TODO
});
stack.scratch.x0 = ret;
}
ty => {
if !pf_inner(stack, ty as u8, "sync_exc_el0") {
error!(
"FATAL: Not an SVC induced synchronous exception (ty={:b})",
ty
);
println!("FAR_EL1: {:#0x}", far_el1());
//crate::debugger::debugger(None);
stack.trace();
excp_handler(Exception {
kind: 0, // TODO
});
}
}
}
}
+2 -8
View File
@@ -26,12 +26,6 @@ pub struct ScratchRegisters {
}
impl ScratchRegisters {
pub fn a(&self) -> usize {
self.x0
}
pub fn b(&self) -> usize {
self.x1
}
pub fn dump(&self) {
println!("X0: {:>016X}", { self.x0 });
println!("X1: {:>016X}", { self.x1 });
@@ -387,9 +381,9 @@ macro_rules! exception_stack {
#[unsafe(naked)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn $name(stack: &mut $crate::arch::aarch64::interrupt::InterruptStack) {
unsafe extern "C" fn inner($stack: &mut $crate::arch::aarch64::interrupt::InterruptStack) { unsafe {
unsafe extern "C" fn inner($stack: &mut $crate::arch::aarch64::interrupt::InterruptStack) {
$code
}}
}
core::arch::naked_asm!(
// Backup all userspace registers to stack
push_preserved!(),
+20 -16
View File
@@ -15,26 +15,30 @@ unsafe fn irq_ack() -> (u32, Option<usize>) {
}
exception_stack!(irq_at_el0, |_stack| {
let mut token = unsafe { CleanLockToken::new() };
let (irq, virq) = irq_ack();
if let Some(virq) = virq
&& virq < 1024
{
IRQ_CHIP.trigger_virq(virq as u32, &mut token);
} else {
println!("unexpected irq num {}", irq);
unsafe {
let mut token = CleanLockToken::new();
let (irq, virq) = irq_ack();
if let Some(virq) = virq
&& virq < 1024
{
IRQ_CHIP.trigger_virq(virq as u32, &mut token);
} else {
println!("unexpected irq num {}", irq);
}
}
});
exception_stack!(irq_at_el1, |_stack| {
let mut token = unsafe { CleanLockToken::new() };
let (irq, virq) = irq_ack();
if let Some(virq) = virq
&& virq < 1024
{
IRQ_CHIP.trigger_virq(virq as u32, &mut token);
} else {
println!("unexpected irq num {}", irq);
unsafe {
let mut token = CleanLockToken::new();
let (irq, virq) = irq_ack();
if let Some(virq) = virq
&& virq < 1024
{
IRQ_CHIP.trigger_virq(virq as u32, &mut token);
} else {
println!("unexpected irq num {}", irq);
}
}
});
+4 -6
View File
@@ -76,12 +76,10 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs) -> ! {
// Get hardware descriptor data
//TODO: use env {DTB,RSDT}_{BASE,SIZE}?
let hwdesc_data = if args.hwdesc_base != 0 {
Some(unsafe {
slice::from_raw_parts(
(crate::PHYS_OFFSET + args.hwdesc_base as usize) as *const u8,
args.hwdesc_size as usize,
)
})
Some(slice::from_raw_parts(
(crate::PHYS_OFFSET + args.hwdesc_base as usize) as *const u8,
args.hwdesc_size as usize,
))
} else {
None
};
+1 -1
View File
@@ -21,7 +21,7 @@ pub unsafe fn emergency_reset() -> ! {
}
}
pub unsafe fn kstop(token: &mut CleanLockToken) -> ! {
pub unsafe fn kstop(_token: &mut CleanLockToken) -> ! {
unsafe {
println!("kstop");
-6
View File
@@ -16,12 +16,6 @@ pub unsafe fn disable() {
unsafe { asm!("csrci sstatus, 1 << 1") }
}
/// Set interrupts
#[inline(always)]
pub unsafe fn enable() {
unsafe { asm!("csrsi sstatus, 1 << 1") }
}
/// Set interrupts and halt
/// This will atomically wait for the next interrupt
/// Performing enable followed by halt is not guaranteed to be atomic, use this instead!
-1
View File
@@ -4,7 +4,6 @@ pub use super::CurrentRmmArch as RmmA;
pub use rmm::{Arch as RmmArch, PageFlags, PhysicalAddress, TableKind, VirtualAddress};
pub type PageMapper = rmm::PageMapper<RmmA, crate::memory::TheFrameAllocator>;
pub use crate::rmm::KernelMapper;
pub mod mapper;
-13
View File
@@ -1,18 +1,5 @@
use rmm::{Arch, PageFlags, VirtualAddress};
pub struct KernelMapper {
mapper: crate::paging::PageMapper,
ro: bool,
}
impl KernelMapper {
pub fn lock() -> Self {
unimplemented!()
}
pub fn get_mut(&mut self) -> Option<&mut crate::paging::PageMapper> {
unimplemented!()
}
}
pub unsafe fn page_flags<A: Arch>(virt: VirtualAddress) -> PageFlags<A> {
use crate::kernel_executable_offsets::*;
let virt_addr = virt.data();
+1 -1
View File
@@ -9,7 +9,7 @@ pub unsafe fn emergency_reset() -> ! {
unimplemented!()
}
pub unsafe fn kstop(token: &mut CleanLockToken) -> ! {
pub unsafe fn kstop(_token: &mut CleanLockToken) -> ! {
println!("kstop");
unimplemented!()
}