Merge master into 0.2.0 (688 commits, theirs pref for conflicts)

This commit is contained in:
2026-05-21 21:37:43 +03:00
3898 changed files with 4062828 additions and 147781 deletions
@@ -74,16 +74,24 @@ impl MemoryEntry {
}
struct MemoryMap {
<<<<<<< HEAD
entries: [MemoryEntry; 1024],
=======
entries: [MemoryEntry; 512],
>>>>>>> master
size: usize,
}
impl MemoryMap {
fn register(&mut self, base: usize, size: usize, kind: BootloaderMemoryKind) {
if self.size >= self.entries.len() {
<<<<<<< HEAD
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
unsafe { core::arch::asm!("out dx, al", in("dx") 0x3F8u16, in("al") b'!', options(nostack, preserves_flags)); }
panic!("Early memory map overflow at entry {} (max {})", self.size, self.entries.len());
=======
panic!("Early memory map overflow!");
>>>>>>> master
}
let start = if kind == BootloaderMemoryKind::Free {
align_up(base)
@@ -136,7 +144,11 @@ static MEMORY_MAP: SyncUnsafeCell<MemoryMap> = SyncUnsafeCell::new(MemoryMap {
start: 0,
end: 0,
kind: BootloaderMemoryKind::Null,
<<<<<<< HEAD
}; 1024],
=======
}; 512],
>>>>>>> master
size: 0,
});
@@ -325,6 +337,7 @@ unsafe fn map_memory<A: Arch>(areas: &[MemoryArea], mut bump_allocator: &mut Bum
}
}
<<<<<<< HEAD
let kernel_area = match (*MEMORY_MAP.get()).kernel() {
Some(area) => area,
None => {
@@ -335,6 +348,9 @@ unsafe fn map_memory<A: Arch>(areas: &[MemoryArea], mut bump_allocator: &mut Bum
}
}
};
=======
let kernel_area = (*MEMORY_MAP.get()).kernel().unwrap();
>>>>>>> master
let kernel_base = kernel_area.start;
let kernel_size = kernel_area.end.saturating_sub(kernel_area.start);
// Map kernel at KERNEL_OFFSET
@@ -149,6 +149,7 @@ static BOOTSTRAP: spin::Once<Bootstrap> = spin::Once::new();
pub(crate) static AP_READY: AtomicBool = AtomicBool::new(false);
static BSP_READY: AtomicBool = AtomicBool::new(false);
<<<<<<< HEAD
#[cold]
fn halt_boot(message: &str) -> ! {
print!("{message}");
@@ -158,6 +159,8 @@ fn halt_boot(message: &str) -> ! {
}
}
=======
>>>>>>> master
/// This is the kernel entry point for the primary CPU. The arch crate is responsible for calling this
pub(crate) fn kmain(bootstrap: Bootstrap) -> ! {
let mut token = unsafe { CleanLockToken::new() };
@@ -189,7 +192,13 @@ pub(crate) fn kmain(bootstrap: Bootstrap) -> ! {
context.euid = 0;
context.egid = 0;
}
<<<<<<< HEAD
Err(_err) => halt_boot("FATAL: failed to spawn first userspace process userspace_init\n"),
=======
Err(err) => {
panic!("failed to spawn userspace_init: {:?}", err);
}
>>>>>>> master
}
run_userspace(&mut token)