Compare commits
2 commits
3c13ffe6ae
...
8d10160ea1
Author | SHA1 | Date | |
---|---|---|---|
8d10160ea1 | |||
c5ec673970 |
16 changed files with 50 additions and 22 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -7,4 +7,5 @@
|
|||
"kernel/aphrodite_common/Cargo.toml",
|
||||
"user/Cargo.toml"
|
||||
],
|
||||
"rust-analyzer.check.command": "clippy",
|
||||
}
|
|
@ -96,10 +96,13 @@
|
|||
real_target=$(basename $real_target)
|
||||
if [[ $check = "true" ]]; then
|
||||
echo "[INFO] Checking target $target(with rust target of $real_target)"
|
||||
cargo check --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
|
||||
cargo clippy --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
|
||||
else
|
||||
echo "[INFO] Compiling target $target(with rust target of $real_target)"
|
||||
cargo build --target "$real_target" --release -Zbuild-std=core,alloc --bin entrypoint_$target
|
||||
echo "[INFO] Running clippy"
|
||||
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
|
||||
|
||||
if [[ "$CONFIG_BUILD_GRUB" = "true" ]]; then
|
||||
|
|
|
@ -95,6 +95,16 @@ pub mod interrupts {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for IdtBuilder {
|
||||
fn default() -> Self {
|
||||
IdtBuilder {
|
||||
vectors: [0; 256],
|
||||
funcs: [MaybeUninit::uninit(); 256],
|
||||
idx: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod output {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Constants used throughout kernel code.
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
/// The assembly port number to output debug messages to.
|
||||
pub(super) const DEBUG_PORT: u16 = 0xE9;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Stuff for writing and reading to the EGA text buffer.
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use crate::display::Color;
|
||||
|
||||
|
@ -109,6 +109,6 @@ impl FramebufferInfo {
|
|||
super::ports::outb(0x3D4, 0x0E);
|
||||
addr |= (super::ports::inb(0x3D5) as u32) << 8;
|
||||
|
||||
return (addr % self.width, addr / self.width);
|
||||
(addr % self.width, addr / self.width)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! GDT initalization.
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use core::alloc::Layout;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Provides interrupt-related functions
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
#![allow(static_mut_refs)]
|
||||
|
||||
use core::{
|
||||
|
@ -69,21 +69,20 @@ pub fn restore_irq(flags: PoppedInterrupts) {
|
|||
}
|
||||
|
||||
/// The IDTR. Used internally in [load_idt].
|
||||
#[repr(packed)]
|
||||
#[repr(C)]
|
||||
struct IDTR {
|
||||
#[repr(C, packed)]
|
||||
struct Idtr {
|
||||
base: *const u8,
|
||||
size: usize,
|
||||
}
|
||||
|
||||
unsafe impl Send for IDTR {}
|
||||
unsafe impl Sync for IDTR {}
|
||||
unsafe impl Send for Idtr {}
|
||||
unsafe impl Sync for Idtr {}
|
||||
|
||||
/// Loads an interrupt descriptor table.
|
||||
fn load_idt(base: *const u8, size: usize) {
|
||||
static mut IDTR: MaybeUninit<IDTR> = MaybeUninit::uninit();
|
||||
static mut IDTR: MaybeUninit<Idtr> = MaybeUninit::uninit();
|
||||
unsafe {
|
||||
IDTR.write(IDTR { base, size });
|
||||
IDTR.write(Idtr { base, size });
|
||||
}
|
||||
unsafe { asm!("lidt {}", in(reg) IDTR.as_ptr() as usize) }
|
||||
}
|
||||
|
@ -148,3 +147,14 @@ impl IdtBuilder {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for IdtBuilder {
|
||||
fn default() -> Self {
|
||||
IdtBuilder {
|
||||
vectors: [0; 256],
|
||||
funcs: [MaybeUninit::uninit(); 256],
|
||||
user_callable: [false; 256],
|
||||
idx: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Hardware-level memory sections. Unimplemented for certain hardware, x86 implements with GDT.
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! General x86 functions
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub mod ports;
|
|||
|
||||
mod constants;
|
||||
|
||||
pub(self) use constants::*;
|
||||
use constants::*;
|
||||
use interrupts::{pop_irq, restore_irq};
|
||||
use ports::{inb, outb};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Functions to output to various things
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use super::ports;
|
||||
use paste::paste;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Functions and types related to paging.
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Provides utilities for interacting with assembly ports
|
||||
#![cfg(any(target_arch = "x86"))]
|
||||
#![cfg(target_arch = "x86")]
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ impl core::iter::Iterator for MemoryMap {
|
|||
type Item = MemoryMapping;
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.idx += 1;
|
||||
if self.sections.len() <= self.idx - 1 {
|
||||
if self.sections.len() < self.idx {
|
||||
self.reset_iter();
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ macro_rules! cfg_int {
|
|||
paste::paste! {
|
||||
{
|
||||
let cfg = env!($cfg).as_bytes();
|
||||
crate::[< str_as_ $type >](cfg)
|
||||
$crate::[< str_as_ $type >](cfg)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! This provides raw methods for internal kernel usage for the Aphrodite kernel. See aphrodite_user for userspace.
|
||||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
#![warn(clippy::missing_docs_in_private_items)]
|
||||
#![warn(rustdoc::missing_crate_level_docs)]
|
||||
#![deny(rustdoc::invalid_html_tags)]
|
||||
#![deny(rustdoc::invalid_rust_codeblocks)]
|
||||
|
|
Loading…
Add table
Reference in a new issue