Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/workflows/benchmark.yml

This file was deleted.

312 changes: 7 additions & 305 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/arch/aarch64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub mod systemtime;
use alloc::alloc::alloc;
use core::alloc::Layout;
use core::arch::global_asm;
use core::ptr;
use core::sync::atomic::{AtomicPtr, AtomicU32, Ordering};
use core::{ptr, str};

pub(crate) use self::interrupts::wakeup_core;
pub(crate) use self::processor::set_oneshot_timer;
Expand Down Expand Up @@ -61,10 +61,6 @@ pub fn get_processor_count() -> u32 {
1
}

pub fn args() -> Option<&'static str> {
None
}

/// Real Boot Processor initialization as soon as we have put the first Welcome message on the screen.
#[cfg(target_os = "none")]
pub fn boot_processor_init() {
Expand Down
26 changes: 13 additions & 13 deletions src/arch/aarch64/kernel/serial.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use alloc::collections::vec_deque::VecDeque;
use core::num::NonZero;
use core::ptr::NonNull;
use core::ptr::{self, NonNull};

use arm_pl011_uart::{DataBits, Interrupts, LineConfig, Parity, StopBits, Uart, UniqueMmioPointer};
use arm_pl011_uart::{
DataBits, Interrupts, LineConfig, PL011Registers, Parity, StopBits, Uart, UniqueMmioPointer,
};
use embedded_io::{ErrorType, Read, ReadReady, Write};
use hermit_sync::{InterruptTicketMutex, Lazy};

Expand All @@ -18,16 +19,15 @@ pub(crate) struct UartDevice {

impl UartDevice {
pub fn new() -> Self {
let base = crate::env::boot_info()
.hardware_info
.serial_port_base
.unwrap();
let base = NonZero::try_from(base).unwrap();
let base = NonNull::with_exposed_provenance(base);

let uart_pointer = unsafe { UniqueMmioPointer::new(base) };

let mut uart = Uart::new(uart_pointer);
// The loader maps the serial port to 0x1000. Eventually, the kernel
// should take care of the initial page tables. Until then, we hardcode
// the value to slowly move away from the Hermit-specific boot info
// struct.
let ptr = ptr::with_exposed_provenance_mut::<PL011Registers>(0x1000);
let ptr = NonNull::new(ptr).unwrap();
let ptr = unsafe { UniqueMmioPointer::new(ptr) };

let mut uart = Uart::new(ptr);

let line_config = LineConfig {
data_bits: DataBits::Bits8,
Expand Down
4 changes: 0 additions & 4 deletions src/arch/riscv64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ pub fn get_processor_count() -> u32 {
1
}

pub fn args() -> Option<&'static str> {
None
}

pub fn get_hart_mask() -> u64 {
HART_MASK.load(Ordering::Relaxed)
}
Expand Down
8 changes: 0 additions & 8 deletions src/arch/x86_64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ pub fn is_uhyve_with_pci() -> bool {
)
}

pub fn args() -> Option<&'static str> {
match env::boot_info().platform_info {
PlatformInfo::Multiboot { command_line, .. }
| PlatformInfo::LinuxBootParams { command_line, .. } => command_line,
_ => None,
}
}

/// Real Boot Processor initialization as soon as we have put the first Welcome message on the screen.
#[cfg(target_os = "none")]
pub fn boot_processor_init() {
Expand Down
8 changes: 2 additions & 6 deletions src/arch/x86_64/kernel/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ struct UartDevice {

impl UartDevice {
pub unsafe fn new() -> Self {
let base = crate::env::boot_info()
.hardware_info
.serial_port_base
.unwrap()
.get();
let mut uart = unsafe { Uart16550::new_port(base).unwrap() };
let base_port = 0x3f8;
let mut uart = unsafe { Uart16550::new_port(base_port).unwrap() };
uart.init(Config::default()).ok();
// Once we have a fallback destination for output,
// we should log any error above and run
Expand Down
20 changes: 13 additions & 7 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use alloc::borrow::ToOwned;
use alloc::string::String;
use alloc::vec::Vec;
use core::num::NonZero;
use core::{ptr, str};

use ahash::RandomState;
Expand All @@ -13,8 +14,6 @@ use hermit_entry::boot_info::{BootInfo, PlatformInfo, RawBootInfo};
use hermit_sync::OnceCell;
use memory_addresses::PhysAddr;

use crate::arch::kernel;

static BOOT_INFO: OnceCell<BootInfo> = OnceCell::new();

pub fn boot_info() -> &'static BootInfo {
Expand Down Expand Up @@ -53,9 +52,16 @@ pub fn is_uefi() -> bool {
fdt().is_some_and(|fdt| fdt.root().compatible().first() == "hermit,uefi")
}

pub fn fdt_addr() -> Option<NonZero<usize>> {
boot_info()
.hardware_info
.device_tree
.map(|fdt| NonZero::new(fdt.get() as usize).unwrap())
}

pub fn fdt() -> Option<Fdt<'static>> {
boot_info().hardware_info.device_tree.map(|fdt| {
let ptr = ptr::with_exposed_provenance(fdt.get().try_into().unwrap());
fdt_addr().map(|fdt| {
let ptr = ptr::with_exposed_provenance(fdt.get());
unsafe { Fdt::from_ptr(ptr).unwrap() }
})
}
Expand All @@ -69,14 +75,14 @@ pub(crate) fn get_ram_address() -> Option<PhysAddr> {

/// Returns the RSDP physical address if available.
#[cfg(all(target_arch = "x86_64", feature = "acpi"))]
pub fn rsdp() -> Option<core::num::NonZero<usize>> {
pub fn rsdp() -> Option<NonZero<usize>> {
let rsdp = fdt()?
.find_node("/hermit,rsdp")?
.reg()?
.next()?
.starting_address
.addr();
core::num::NonZero::new(rsdp)
NonZero::new(rsdp)
}

pub fn fdt_args() -> Option<&'static str> {
Expand All @@ -92,7 +98,7 @@ impl Default for Cli {
RandomState::with_seeds(0, 0, 0, 0),
);

let args = kernel::args().or_else(fdt_args).unwrap_or_default();
let args = fdt_args().unwrap_or_default();
info!("bootargs = {args}");
let words = shell_words::split(args).unwrap();

Expand Down
3 changes: 1 addition & 2 deletions src/mm/physicalmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ unsafe fn detect_from_fdt() -> Result<(), ()> {
let kernel_region = PageRange::new(kernel_start, kernel_end).unwrap();
reserve(kernel_region);

let fdt_start = env::boot_info().hardware_info.device_tree.unwrap().get();
let fdt_start = usize::try_from(fdt_start).unwrap();
let fdt_start = env::fdt_addr().unwrap().get();
let fdt_end = fdt_start + fdt.total_size();
let fdt_region = PageRange::containing(fdt_start, fdt_end).unwrap();
reserve(fdt_region);
Expand Down
Loading