Compare commits

..

No commits in common. "8d10160ea1d644ece884f5a6522776ba8e376a8b" and "3c13ffe6ae1e6fd5e2b328d15484f85b741719f6" have entirely different histories.

16 changed files with 22 additions and 50 deletions

View file

@ -7,5 +7,4 @@
"kernel/aphrodite_common/Cargo.toml", "kernel/aphrodite_common/Cargo.toml",
"user/Cargo.toml" "user/Cargo.toml"
], ],
"rust-analyzer.check.command": "clippy",
} }

View file

@ -96,13 +96,10 @@
real_target=$(basename $real_target) real_target=$(basename $real_target)
if [[ $check = "true" ]]; then if [[ $check = "true" ]]; then
echo "[INFO] Checking target $target(with rust target of $real_target)" echo "[INFO] Checking target $target(with rust target of $real_target)"
cargo clippy --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target cargo check --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
else else
echo "[INFO] Compiling target $target(with rust target of $real_target)" echo "[INFO] Compiling target $target(with rust target of $real_target)"
echo "[INFO] Running clippy" cargo build --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
cargo clippy --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
echo "[INFO] Building"
cargo build --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target 2>/dev/null
cp "target/$(echo $real_target | sed 's/\.json//')/release/entrypoint_$target" kernel-$target cp "target/$(echo $real_target | sed 's/\.json//')/release/entrypoint_$target" kernel-$target
if [[ "$CONFIG_BUILD_GRUB" = "true" ]]; then if [[ "$CONFIG_BUILD_GRUB" = "true" ]]; then

View file

@ -95,16 +95,6 @@ pub mod interrupts {
} }
} }
} }
impl Default for IdtBuilder {
fn default() -> Self {
IdtBuilder {
vectors: [0; 256],
funcs: [MaybeUninit::uninit(); 256],
idx: 0,
}
}
}
} }
pub mod output { pub mod output {

View file

@ -1,5 +1,5 @@
//! Constants used throughout kernel code. //! Constants used throughout kernel code.
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
/// The assembly port number to output debug messages to. /// The assembly port number to output debug messages to.
pub(super) const DEBUG_PORT: u16 = 0xE9; pub(super) const DEBUG_PORT: u16 = 0xE9;

View file

@ -1,5 +1,5 @@
//! Stuff for writing and reading to the EGA text buffer. //! Stuff for writing and reading to the EGA text buffer.
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
use crate::display::Color; use crate::display::Color;
@ -109,6 +109,6 @@ impl FramebufferInfo {
super::ports::outb(0x3D4, 0x0E); super::ports::outb(0x3D4, 0x0E);
addr |= (super::ports::inb(0x3D5) as u32) << 8; addr |= (super::ports::inb(0x3D5) as u32) << 8;
(addr % self.width, addr / self.width) return (addr % self.width, addr / self.width);
} }
} }

View file

@ -1,5 +1,4 @@
//! GDT initalization. //! GDT initalization.
#![cfg(target_arch = "x86")]
use core::alloc::Layout; use core::alloc::Layout;

View file

@ -1,5 +1,5 @@
//! Provides interrupt-related functions //! Provides interrupt-related functions
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
#![allow(static_mut_refs)] #![allow(static_mut_refs)]
use core::{ use core::{
@ -69,20 +69,21 @@ pub fn restore_irq(flags: PoppedInterrupts) {
} }
/// The IDTR. Used internally in [load_idt]. /// The IDTR. Used internally in [load_idt].
#[repr(C, packed)] #[repr(packed)]
struct Idtr { #[repr(C)]
struct IDTR {
base: *const u8, base: *const u8,
size: usize, size: usize,
} }
unsafe impl Send for Idtr {} unsafe impl Send for IDTR {}
unsafe impl Sync for Idtr {} unsafe impl Sync for IDTR {}
/// Loads an interrupt descriptor table. /// Loads an interrupt descriptor table.
fn load_idt(base: *const u8, size: usize) { fn load_idt(base: *const u8, size: usize) {
static mut IDTR: MaybeUninit<Idtr> = MaybeUninit::uninit(); static mut IDTR: MaybeUninit<IDTR> = MaybeUninit::uninit();
unsafe { unsafe {
IDTR.write(Idtr { base, size }); IDTR.write(IDTR { base, size });
} }
unsafe { asm!("lidt {}", in(reg) IDTR.as_ptr() as usize) } unsafe { asm!("lidt {}", in(reg) IDTR.as_ptr() as usize) }
} }
@ -147,14 +148,3 @@ impl IdtBuilder {
} }
} }
} }
impl Default for IdtBuilder {
fn default() -> Self {
IdtBuilder {
vectors: [0; 256],
funcs: [MaybeUninit::uninit(); 256],
user_callable: [false; 256],
idx: 0,
}
}
}

View file

@ -1,5 +1,4 @@
//! Hardware-level memory sections. Unimplemented for certain hardware, x86 implements with GDT. //! Hardware-level memory sections. Unimplemented for certain hardware, x86 implements with GDT.
#![cfg(target_arch = "x86")]
use core::arch::asm; use core::arch::asm;

View file

@ -1,5 +1,5 @@
//! General x86 functions //! General x86 functions
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
use core::arch::asm; use core::arch::asm;
@ -13,7 +13,7 @@ pub mod ports;
mod constants; mod constants;
use constants::*; pub(self) use constants::*;
use interrupts::{pop_irq, restore_irq}; use interrupts::{pop_irq, restore_irq};
use ports::{inb, outb}; use ports::{inb, outb};

View file

@ -1,5 +1,5 @@
//! Functions to output to various things //! Functions to output to various things
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
use super::ports; use super::ports;
use paste::paste; use paste::paste;

View file

@ -1,5 +1,4 @@
//! Functions and types related to paging. //! Functions and types related to paging.
#![cfg(target_arch = "x86")]
use core::arch::asm; use core::arch::asm;

View file

@ -1,5 +1,5 @@
//! Provides utilities for interacting with assembly ports //! Provides utilities for interacting with assembly ports
#![cfg(target_arch = "x86")] #![cfg(any(target_arch = "x86"))]
use core::arch::asm; use core::arch::asm;

View file

@ -126,7 +126,7 @@ impl core::iter::Iterator for MemoryMap {
type Item = MemoryMapping; type Item = MemoryMapping;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
self.idx += 1; self.idx += 1;
if self.sections.len() < self.idx { if self.sections.len() <= self.idx - 1 {
self.reset_iter(); self.reset_iter();
return None; return None;
} }

View file

@ -7,7 +7,7 @@ macro_rules! cfg_int {
paste::paste! { paste::paste! {
{ {
let cfg = env!($cfg).as_bytes(); let cfg = env!($cfg).as_bytes();
$crate::[< str_as_ $type >](cfg) crate::[< str_as_ $type >](cfg)
} }
} }
}; };

View file

@ -1,7 +1,6 @@
//! This provides raw methods for internal kernel usage for the Aphrodite kernel. See aphrodite_user for userspace. //! This provides raw methods for internal kernel usage for the Aphrodite kernel. See aphrodite_user for userspace.
#![no_std] #![no_std]
#![warn(missing_docs)] #![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
#![warn(rustdoc::missing_crate_level_docs)] #![warn(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_html_tags)] #![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)] #![deny(rustdoc::invalid_rust_codeblocks)]