forked from koniifer/ableos
Remove warnings
This commit is contained in:
parent
e513caf499
commit
5af29efe17
|
@ -2,7 +2,7 @@
|
|||
edition = "2021"
|
||||
name = "kernel"
|
||||
version = "0.2.0"
|
||||
resolver = "2"
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
||||
|
|
|
@ -326,6 +326,6 @@ impl Heap {
|
|||
unsafe impl Send for Heap {}
|
||||
|
||||
#[alloc_error_handler]
|
||||
fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
|
||||
fn alloc_error_handler(_layout: alloc::alloc::Layout) -> ! {
|
||||
crate::arch::sloop()
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
use {limine::NonNullPtr, virtio_drivers::transport::Transport};
|
||||
use {limine::NonNullPtr};
|
||||
|
||||
use {
|
||||
crate::{arch::virtio::AbleosHal, kmain::DEVICE_TREE},
|
||||
crate::{kmain::DEVICE_TREE},
|
||||
able_graphics_library::raw_pixel::Display,
|
||||
embedded_graphics::{pixelcolor::Rgb888, prelude::*},
|
||||
limine::{Framebuffer, FramebufferRequest},
|
||||
spin::{Lazy, Mutex},
|
||||
virtio_drivers::device::gpu::VirtIOGpu,
|
||||
};
|
||||
|
||||
pub static DISPLAY: Lazy<Mutex<Display>> = Lazy::new(|| {
|
||||
|
@ -23,7 +22,7 @@ pub static DISPLAY: Lazy<Mutex<Display>> = Lazy::new(|| {
|
|||
disp.set_attribute("bits per pixel", fb1.bpp);
|
||||
dt.devices.insert("Displays".to_string(), alloc::vec![disp]);
|
||||
}
|
||||
let size: usize = (fb1.width * fb1.height).try_into().unwrap();
|
||||
let _size: usize = (fb1.width * fb1.height).try_into().unwrap();
|
||||
let back_buffer: alloc::vec::Vec<u32> = alloc::vec![0; 800*600];
|
||||
|
||||
let m = Mutex::new(Display {
|
||||
|
|
|
@ -64,7 +64,7 @@ extern "x86-interrupt" fn page_fault(
|
|||
panic!("Page fault ({error_code:?}): {stack_frame:?}")
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn timer(isf: InterruptStackFrame) {
|
||||
extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) {
|
||||
unsafe { LAPIC.lock().end_of_interrupt() };
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
//! Logging (as in terms of console / serial output)
|
||||
#![allow(deprecated)]
|
||||
|
||||
use spin::Lazy;
|
||||
|
||||
use {
|
||||
core::fmt::Write,
|
||||
limine::{TerminalRequest, TerminalResponse},
|
||||
spin::{Lazy, Mutex},
|
||||
spin::Mutex,
|
||||
uart_16550::SerialPort,
|
||||
};
|
||||
|
||||
|
|
|
@ -80,25 +80,25 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
|||
cpu.set_attribute("core count", core_count);
|
||||
cpu.set_attribute("brand string", brand_string);
|
||||
|
||||
let cpu_speed = 0;
|
||||
let _cpu_speed = 0;
|
||||
|
||||
cpu.set_attribute("speed", "Unknown");
|
||||
|
||||
if false {
|
||||
// disable() // disable interrupts (if still not done)
|
||||
let i = 0;
|
||||
let _i = 0;
|
||||
let start = cpuinfo.time_stamp_counter();
|
||||
|
||||
log::info!("{:?}", start.unwrap().invariant_tsc());
|
||||
for x in 0..1000 {}
|
||||
let end = cpuinfo.time_stamp_counter();
|
||||
for _x in 0..1000 {}
|
||||
let _end = cpuinfo.time_stamp_counter();
|
||||
}
|
||||
|
||||
let mut cpu_features = xml::XMLElement::new("CPU Features");
|
||||
{
|
||||
let x2 = cpuinfo.x2apic();
|
||||
let apic = cpuinfo.apic();
|
||||
let avx = cpuinfo.avx();
|
||||
let _avx = cpuinfo.avx();
|
||||
|
||||
cpu_features.set_attribute("apic", apic.to_string());
|
||||
cpu_features.set_attribute("avx", apic.to_string());
|
||||
|
@ -113,16 +113,9 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
|||
{
|
||||
graphics::init();
|
||||
let mut dis = DISPLAY.lock();
|
||||
use {able_graphics_library::raw_pixel, embedded_graphics::prelude::RgbColor};
|
||||
// dis.set_color(Rgb888::GREEN);
|
||||
// dis.line(400, 400, 700, 100, 50);
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
|
||||
// dis.set_color(Rgb888::new(100, 23, 100));
|
||||
|
||||
// dis.line(100, 100, 400, 400, 3);
|
||||
|
||||
// dis.line(100, 100, 700, 100, 1);
|
||||
dis.set_color(Rgb888::YELLOW);
|
||||
let _ = dis.set_color(Rgb888::YELLOW);
|
||||
let thick = 3;
|
||||
let p1 = (400, 30);
|
||||
let p2 = (200, 150);
|
||||
|
@ -134,20 +127,20 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
|||
{
|
||||
//HEXAGON
|
||||
|
||||
dis.line(p1.0, p1.1, p2.0, p2.1, thick);
|
||||
dis.line(p1.0, p1.1, p3.0, p3.1, thick);
|
||||
dis.line(p2.0, p2.1, p4.0, p4.1, thick);
|
||||
dis.line(p3.0, p3.1, p5.0, p5.1, thick);
|
||||
dis.line(p6.0, p6.1, p4.0, p4.1, thick);
|
||||
dis.line(p6.0, p6.1, p5.0, p5.1, thick);
|
||||
let _ = dis.line(p1.0, p1.1, p2.0, p2.1, thick);
|
||||
let _ = dis.line(p1.0, p1.1, p3.0, p3.1, thick);
|
||||
let _ = dis.line(p2.0, p2.1, p4.0, p4.1, thick);
|
||||
let _ = dis.line(p3.0, p3.1, p5.0, p5.1, thick);
|
||||
let _ = dis.line(p6.0, p6.1, p4.0, p4.1, thick);
|
||||
let _ = dis.line(p6.0, p6.1, p5.0, p5.1, thick);
|
||||
}
|
||||
{
|
||||
dis.line(600, 150, 200, 350, thick);
|
||||
dis.line(600, 350, 400, 250, thick);
|
||||
let _ = dis.line(600, 150, 200, 350, thick);
|
||||
let _ = dis.line(600, 350, 400, 250, thick);
|
||||
}
|
||||
|
||||
{
|
||||
dis.set_color(Rgb888::WHITE);
|
||||
let _ = dis.set_color(Rgb888::WHITE);
|
||||
let hp1 = (350, 150);
|
||||
let hp2 = (350, 350);
|
||||
let hp3 = (450, 250);
|
||||
|
@ -155,15 +148,15 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
|||
let hp5 = (450, 150);
|
||||
let hp6 = (450, 350);
|
||||
|
||||
dis.line(hp1.0, hp1.1, hp2.0, hp2.1, thick);
|
||||
dis.line(hp3.0, hp3.1, hp4.0, hp4.1, thick);
|
||||
dis.line(hp5.0, hp5.1, hp6.0, hp6.1, thick);
|
||||
let _ = dis.line(hp1.0, hp1.1, hp2.0, hp2.1, thick);
|
||||
let _ = dis.line(hp3.0, hp3.1, hp4.0, hp4.1, thick);
|
||||
let _ = dis.line(hp5.0, hp5.1, hp6.0, hp6.1, thick);
|
||||
}
|
||||
|
||||
dis.swap_buffers();
|
||||
}
|
||||
};
|
||||
|
||||
let rand = xml::XMLElement::new("Random");
|
||||
let _rand = xml::XMLElement::new("Random");
|
||||
|
||||
crate::kmain::kmain(
|
||||
KFILE_REQ
|
||||
|
@ -189,7 +182,7 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
|||
}),
|
||||
)
|
||||
}
|
||||
use embedded_graphics::prelude::WebColors;
|
||||
|
||||
/// Spin loop
|
||||
pub fn sloop() -> ! {
|
||||
loop {
|
||||
|
|
|
@ -271,7 +271,7 @@ use core::fmt::Display;
|
|||
|
||||
use crate::kmain::DEVICE_TREE;
|
||||
|
||||
use {alloc::fmt::format, x86_64::instructions::port::Port};
|
||||
use {x86_64::instructions::port::Port};
|
||||
|
||||
#[allow(non_camel_case_types, dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
use {
|
||||
alloc::alloc::{alloc_zeroed, dealloc, handle_alloc_error},
|
||||
core::{alloc::Layout, ptr::NonNull},
|
||||
virtio_drivers::{BufferDirection, Hal, PhysAddr, PAGE_SIZE},
|
||||
core::{ptr::NonNull},
|
||||
virtio_drivers::{BufferDirection, Hal, PhysAddr},
|
||||
};
|
||||
|
||||
pub fn test() {
|
||||
let ps = virtio_drivers::PAGE_SIZE;
|
||||
let _ps = virtio_drivers::PAGE_SIZE;
|
||||
}
|
||||
|
||||
pub struct AbleosHal;
|
||||
|
||||
unsafe impl Hal for AbleosHal {
|
||||
fn dma_alloc(pages: usize, _direction: BufferDirection) -> (PhysAddr, NonNull<u8>) {
|
||||
fn dma_alloc(_pages: usize, _direction: BufferDirection) -> (PhysAddr, NonNull<u8>) {
|
||||
todo!();
|
||||
}
|
||||
|
||||
unsafe fn dma_dealloc(_paddr: PhysAddr, vaddr: NonNull<u8>, pages: usize) -> i32 {
|
||||
unsafe fn dma_dealloc(_paddr: PhysAddr, _vaddr: NonNull<u8>, _pages: usize) -> i32 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
@ -23,7 +22,7 @@ unsafe impl Hal for AbleosHal {
|
|||
NonNull::new(paddr as _).unwrap()
|
||||
}
|
||||
|
||||
unsafe fn share(buffer: NonNull<[u8]>, _direction: BufferDirection) -> PhysAddr {
|
||||
unsafe fn share(_buffer: NonNull<[u8]>, _direction: BufferDirection) -> PhysAddr {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ use crate::utils::TAB;
|
|||
|
||||
impl fmt::Display for DeviceTree {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
writeln!(f);
|
||||
writeln!(f)?;
|
||||
for (device_type, devices) in &self.devices {
|
||||
writeln!(f, "\r{TAB}{}/\r", device_type)?;
|
||||
for device in devices {
|
||||
|
|
|
@ -39,7 +39,7 @@ impl Handle {
|
|||
|
||||
impl fmt::Display for Handle {
|
||||
fn fmt(&self, w: &mut Formatter<'_>) -> Result<(), core::fmt::Error> {
|
||||
write!(w, "{:?}", self.id);
|
||||
write!(w, "{:?}", self.id)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
use {alloc::collections::VecDeque, hbvm::engine::Engine};
|
||||
use {hbvm::engine::Engine};
|
||||
|
||||
use {
|
||||
crossbeam_queue::{ArrayQueue, SegQueue},
|
||||
log::trace,
|
||||
};
|
||||
|
||||
use crate::{ipc::message::Message, kmain::DEVICE_TREE};
|
||||
use crate::{ipc::message::Message};
|
||||
pub enum HostError {
|
||||
MemoryError,
|
||||
}
|
||||
|
||||
pub fn ipc_send(engine: &mut Engine) -> Result<(), HostError> {
|
||||
let handle = engine.registers.f0;
|
||||
let _handle = engine.registers.f0;
|
||||
let message_start = engine.registers.f1;
|
||||
let message_length = engine.registers.f2;
|
||||
|
||||
|
@ -28,7 +28,7 @@ pub fn ipc_send(engine: &mut Engine) -> Result<(), HostError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn ipc_recv(engine: &mut Engine) {}
|
||||
pub fn ipc_recv(_engine: &mut Engine) {}
|
||||
|
||||
/// Check f0 for the buffer type
|
||||
/// 0 means an unbound buffer
|
||||
|
@ -41,17 +41,17 @@ pub fn ipc_mkbuf(engine: &mut Engine) {
|
|||
match engine.registers.f0 as usize {
|
||||
0 => {
|
||||
trace!("Making a new ipc unbound buffer");
|
||||
let buf: SegQueue<Message> = SegQueue::new();
|
||||
let _buf: SegQueue<Message> = SegQueue::new();
|
||||
}
|
||||
1 => {
|
||||
let buf_len = engine.registers.f1 as usize;
|
||||
trace!("Making a new ipc buffer with capacity {}", buf_len);
|
||||
let buf: ArrayQueue<Message> = ArrayQueue::new(buf_len);
|
||||
let _buf: ArrayQueue<Message> = ArrayQueue::new(buf_len);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rpc_discover(engine: &mut Engine) {}
|
||||
pub fn rpc_register(engine: &mut Engine) {}
|
||||
pub fn rpc_call(engine: &mut Engine) {}
|
||||
pub fn rpc_discover(_engine: &mut Engine) {}
|
||||
pub fn rpc_register(_engine: &mut Engine) {}
|
||||
pub fn rpc_call(_engine: &mut Engine) {}
|
||||
|
|
|
@ -1,24 +1,2 @@
|
|||
pub mod buffer;
|
||||
pub mod message;
|
||||
|
||||
use alloc::string::ToString;
|
||||
|
||||
pub struct IpcV1 {
|
||||
abc: alloc::string::String,
|
||||
}
|
||||
|
||||
pub struct IpcV2 {
|
||||
abc: alloc::string::String,
|
||||
}
|
||||
|
||||
pub fn IPCV1_to_IPCV2(ipc_v1: IpcV1) -> IpcV2 {
|
||||
return IpcV2 {
|
||||
abc: "abc".to_string(),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn IPCV2_to_IPCV1(ipc_v2: IpcV2) -> IpcV1 {
|
||||
return IpcV1 {
|
||||
abc: "abc".to_string(),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ use {
|
|||
spin::{Lazy, Mutex},
|
||||
};
|
||||
|
||||
use {embedded_graphics::pixelcolor::Rgb888, hbvm::engine::Engine};
|
||||
use hbvm::engine::Engine;
|
||||
|
||||
use crate::{
|
||||
arch::{graphics::DISPLAY, logging::SERIAL_CONSOLE},
|
||||
arch::logging::SERIAL_CONSOLE,
|
||||
device_tree::DeviceTree,
|
||||
// host_functions::read_device_tree,
|
||||
};
|
||||
|
@ -37,24 +37,24 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
|||
|
||||
let bootstrap = bootstrap/*.expect("no bootstrap found")*/;
|
||||
match bootstrap {
|
||||
Some(bootstrap_mod) => {}
|
||||
Some(_bootstrap_mod) => {}
|
||||
None => {
|
||||
info!("No bootstrap module loaded.")
|
||||
}
|
||||
}
|
||||
let mut dt = DEVICE_TREE.lock();
|
||||
let dt = DEVICE_TREE.lock();
|
||||
|
||||
info!("Device Tree {}", &dt);
|
||||
|
||||
let bytes = alloc::vec![0];
|
||||
let mut prog = Engine::new(bytes);
|
||||
// prog.enviroment_call_table[0] = read_device_tree;
|
||||
prog.run();
|
||||
let _ = prog.run();
|
||||
prog.dump();
|
||||
|
||||
// TODO: change this to a driver
|
||||
{
|
||||
let mut buf = [8; 128 * 4];
|
||||
let _buf = [8; 128 * 4];
|
||||
|
||||
let mut sc = SERIAL_CONSOLE.lock();
|
||||
loop {
|
||||
|
@ -66,13 +66,11 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
crate::arch::sloop()
|
||||
// crate::arch::sloop()
|
||||
}
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
|
||||
use hbvm::bytecode::ops::Operations::*;
|
||||
pub static DEVICE_TREE: Lazy<Mutex<DeviceTree>> = Lazy::new(|| {
|
||||
let mut dt = DeviceTree::new();
|
||||
let dt = DeviceTree::new();
|
||||
Mutex::new(dt)
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! The ableOS kernel.
|
||||
|
||||
#![no_std]
|
||||
#![feature(
|
||||
abi_x86_interrupt,
|
||||
alloc_error_handler,
|
||||
|
@ -7,11 +8,11 @@
|
|||
panic_info_message,
|
||||
pointer_is_aligned,
|
||||
prelude_import,
|
||||
ptr_sub_ptr
|
||||
ptr_sub_ptr,
|
||||
custom_test_frameworks
|
||||
)]
|
||||
#![deny(clippy::pedantic)]
|
||||
#![no_std]
|
||||
#![feature(custom_test_frameworks)]
|
||||
#![deny(clippy::pedantic, warnings)]
|
||||
#![allow(dead_code)]
|
||||
#![test_runner(crate::test_runner)]
|
||||
|
||||
// #![deny(missing_docs)]
|
||||
|
|
|
@ -8,7 +8,7 @@ pub fn init() -> Result<(), SetLoggerError> {
|
|||
|
||||
struct Logger;
|
||||
impl log::Log for Logger {
|
||||
fn enabled(&self, metadata: &log::Metadata) -> bool {
|
||||
fn enabled(&self, _metadata: &log::Metadata) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
|
|||
// "-serial", "stdio",
|
||||
"-smp", "cores=4",
|
||||
"-vga", "cirrus",
|
||||
// "-device", "ati-vga",
|
||||
"-device", "virtio-gpu-pci",
|
||||
|
||||
"-device", "virtio-serial,id=virtio-serial0",
|
||||
|
|
Loading…
Reference in a new issue