Skip to content

Commit

Permalink
misc: Cleanup warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Esteban Blanc <[email protected]>
  • Loading branch information
Skallwar committed Aug 3, 2023
1 parent dcd72c3 commit 0f9e028
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 155 deletions.
2 changes: 0 additions & 2 deletions aarch64_qemuvirt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ extern "C" fn k_main(_device_tree_ptr: usize) -> ! {
let device_tree = kernel::device_tree::DeviceTree::new(DTB_ADDR).unwrap();

kernel::generic_main::generic_main::<LAUNCH_TESTS>(device_tree, &[&PL011]);

unreachable!();
}
2 changes: 1 addition & 1 deletion hal_aarch64/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![feature(once_cell)]
#![feature(naked_functions)]

use cortex_a::registers::*;
Expand All @@ -13,6 +12,7 @@ pub mod mm;

mod devices;

#[allow(dead_code)]
#[derive(Debug)]
pub struct PanicInfo {
esr_el1: u64,
Expand Down
2 changes: 1 addition & 1 deletion hal_riscv64/src/irq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::mm;
use super::plic::Plic;
use super::registers;

use riscv::asm::delay;


use core::arch::asm;
use core::ptr;
Expand Down
1 change: 0 additions & 1 deletion hal_riscv64/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![no_std]
#![feature(fn_align)]
#![feature(naked_functions)]
#![feature(once_cell)]

pub mod cpu;
pub mod irq;
Expand Down
2 changes: 1 addition & 1 deletion hal_riscv64/src/mm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::arch::asm;
use core::cell::OnceCell;

use hal_core::{
mm::{self, PageAllocFn, PageMap, Permissions, VAddr},
mm::{PageAllocFn, PageMap},
Error, Range,
};

Expand Down
10 changes: 7 additions & 3 deletions hal_riscv64/src/mm/sv39.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::arch::asm;
use core::convert::TryInto;


use modular_bitfield::{bitfield, prelude::*};

use hal_core::mm::{self, PageAllocFn, PageEntry, PageMap};
Expand Down Expand Up @@ -93,9 +93,13 @@ impl PAddr {
#[bitfield]
pub struct PageTableEntry {
v: B1,
#[skip(getters)]
r: B1,
#[skip(getters)]
w: B1,
#[skip(getters)]
x: B1,
#[skip(getters)]
u: B1,
#[skip]
g: B1,
Expand Down Expand Up @@ -222,7 +226,7 @@ impl PageMap for PageTable {

#[repr(u8)]
pub(crate) enum SatpMode {
Bare = 0,
_Bare = 0,
Sv39 = 8,
_Sv48 = 9,
_Sv57 = 10,
Expand Down
2 changes: 0 additions & 2 deletions hal_riscv64/src/plic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const PLIC_NUMBER_SOURCE_REGISTER: u16 =
const PLIC_MAX_CONTEXT: u16 = 0x3e00;
const PLIC_CLAIM_OFFSET: usize = 0x201004;

static mut PLIC: Option<Plic> = None;

pub struct Plic {
base_register_address: usize,
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ goblin = { version = "0.6", default-features = false, features = ["elf64"] }
qemu-exit = "3.0"
hal_core = { path = "../hal_core" }
arrayvec = { version = "0.7", default-features = false }
tests = { path = "../tests", artifact = "bin" }
align-data = "0.1"
log = "0.4"
tests = { path = "../tests", artifact = "bin" }

[dev-dependencies]

Expand Down
9 changes: 0 additions & 9 deletions kernel/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
use super::mm;

use crate::utils::init_once;

#[derive(Debug)]
pub enum Error {
DeviceNotFound(&'static str),
NoMatchingDriver(&'static str),
InvalidFdtNode,
FdtError(fdt::FdtError),
InitOnce(init_once::Error),
Allocator(mm::AllocatorError),
Hal(hal_core::Error),
SetLoggerError(log::SetLoggerError),
}

impl From<init_once::Error> for Error {
fn from(e: init_once::Error) -> Self {
Self::InitOnce(e)
}
}

impl From<fdt::FdtError> for Error {
fn from(e: fdt::FdtError) -> Self {
Self::FdtError(e)
Expand Down
10 changes: 5 additions & 5 deletions kernel/src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::lock::Lock;

use crate::mm;

use crate::drivers;
use crate::utils;
use utils::init_cell::InitCell;
use utils::init_once::InitOnce;

use alloc::sync::Arc;






pub static PHYSICAL_MEMORY_MANAGER: Lock<mm::PhysicalMemoryManager> =
Lock::new(mm::PhysicalMemoryManager::new());
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/kernel_console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::Error;

use alloc::sync::Arc;

use log::{error, Level, LevelFilter, Metadata, Record};
use log::{Level, LevelFilter, Metadata, Record};
use spin::Mutex;

struct KernelConsole {
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use log::{debug, info, trace};
use core::slice;
use core::sync::atomic::{AtomicUsize, Ordering};

use super::drivers::{pl011::Pl011, Console};

use crate::executable::elf::Elf;
use crate::hal;
use crate::mm::{alloc_pages, alloc_pages_for_hal};
Expand Down
25 changes: 0 additions & 25 deletions kernel/src/utils/init_cell.rs

This file was deleted.

81 changes: 0 additions & 81 deletions kernel/src/utils/init_once.rs

This file was deleted.

4 changes: 2 additions & 2 deletions kernel/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod init_cell;
pub mod init_once;
// pub mod init_cell;
// pub mod init_once;
pub mod lock;

// pub use init_cell;
Expand Down
20 changes: 1 addition & 19 deletions riscv64_qemuvirt/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#![no_std]
#![no_main]
#![feature(naked_functions)]
// #![feature(custom_test_frameworks)]
// #![test_runner(kernel::super::kernel_tests::runner)]
// #![reexport_test_harness_main = "ktests_launch"]

#[cfg(not(target_arch = "riscv64"))]
compile_error!("Must be compiled as riscv64");

use core::arch::asm;
use kernel::drivers::ns16550::*;
use kernel::drivers::qemuexit::QemuExit;
use kernel::executable::elf::Elf;

use align_data::{include_aligned, Align4K};

use log::info;

Expand All @@ -31,18 +23,8 @@ extern "C" fn k_main(_core_id: usize, device_tree_ptr: usize) -> ! {

info!("GoOSe is booting");

// #[cfg(test)]
// {
// kernel::kernel_tests::init(device_tree_ptr);
// ktests_launch();
// }

unsafe {
kernel::hal::irq::init_exception_handlers();
}
kernel::hal::irq::init_exception_handlers();

let device_tree = kernel::device_tree::DeviceTree::new(device_tree_ptr).unwrap();
kernel::generic_main::generic_main::<LAUNCH_TESTS>(device_tree, &[&NS16550]);

unreachable!();
}

0 comments on commit 0f9e028

Please sign in to comment.