Skip to content

Commit

Permalink
improce readability, remoce clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Nov 16, 2024
1 parent 77e99e4 commit e6af774
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
10 changes: 3 additions & 7 deletions src/arch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ pub mod x86;

// Export our platform-specific modules.
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
pub use self::x86::kernel::{init, processor};
pub(crate) use self::x86::kernel::{init, processor};

#[cfg(feature = "vga")]
pub use self::x86::kernel::vga;
pub(crate) use self::x86::kernel::vga;

#[cfg(not(feature = "vga"))]
pub use self::x86::kernel::serial;

// Export our platform-specific modules.
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
pub use self::x86::mm;
pub(crate) use self::x86::kernel::serial;
1 change: 0 additions & 1 deletion src/arch/x86/kernel/entry.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

# This part MUST be 4 byte aligned, so we solve that issue using '.align 4'.
.align 4
.global mboot
mboot:
# Multiboot macros to make a few lines more readable later
.set MULTIBOOT_PAGE_ALIGN, (1 << 0)
Expand Down
10 changes: 5 additions & 5 deletions src/arch/x86/kernel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pub mod processor;
pub(crate) mod processor;
#[cfg(not(feature = "vga"))]
pub mod serial;
pub mod start;
pub(crate) mod serial;
pub(crate) mod start;
#[cfg(feature = "vga")]
pub mod vga;
pub(crate) mod vga;

#[cfg(target_arch = "x86")]
core::arch::global_asm!(include_str!("entry.s"));

pub fn init() {
pub(crate) fn init() {
processor::cpu_init();

#[cfg(all(target_arch = "x86", feature = "vga"))]
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use x86::controlregs::*;

#[allow(unused_variables)]
#[no_mangle]
pub extern "C" fn shutdown(error_code: i32) -> ! {
pub(crate) extern "C" fn shutdown(error_code: i32) -> ! {
#[cfg(feature = "qemu-exit")]
{
let code = if error_code == 0 { 5 } else { 1 };
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86/kernel/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub unsafe extern "C" fn _start() -> ! {
/// This function is the entry point of the kernel.
/// The kernel itself should not call this function.
pub unsafe extern "C" fn _start() -> ! {
use crate::arch::mm::{BOOT_STACK, BOOT_STACK_SIZE};
use crate::arch::x86::mm::{BOOT_STACK, BOOT_STACK_SIZE};
use core::arch::naked_asm;

naked_asm!(
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

// These need to be visible to the linker, so we need to export them.
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
pub use arch::processor::*;
pub(crate) use arch::processor::*;

#[macro_use]
pub mod macros;
#[macro_use]
pub mod logging;
pub mod arch;
pub(crate) mod logging;
pub(crate) mod arch;
pub mod console;

#[cfg(not(test))]
Expand Down
3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(abi_x86_interrupt)]
#![no_std] // don't link the Rust standard library
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
#![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))]
Expand All @@ -11,8 +10,6 @@ extern crate eduos_rs;
#[cfg(not(test))]
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn main() -> i32 {
eduos_rs::arch::init();

println!("Hello world!");

0
Expand Down

0 comments on commit e6af774

Please sign in to comment.