5 Commits

Author SHA1 Message Date
zxq5 72fe78cbc6 Merge pull request 'dev' (#4) from dev into main
Continuous integration / build (push) Failing after 2m12s
Reviewed-on: OsDev/FoundryOS#4
2025-02-22 21:32:27 +00:00
zxq5 f9bc75c4f3 added boot messages 2025-02-22 21:30:13 +00:00
zxq5 494d00c53b Update .gitea/workflows/rust.yml 2025-02-22 21:18:14 +00:00
zxq5 114c70ffe9 updated submodules
Continuous integration / build (push) Failing after 2m7s
2025-02-22 21:03:17 +00:00
zxq5 361c67764d totally didn't import an allocator... 2025-02-22 21:02:29 +00:00
6 changed files with 60 additions and 9 deletions
+5 -1
View File
@@ -1,4 +1,8 @@
on: [push, pull_request] on:
push:
branches: [ main ]
pull-request:
branches: [ main ]
name: Continuous integration name: Continuous integration
Generated
+22
View File
@@ -57,6 +57,10 @@ dependencies = [
[[package]] [[package]]
name = "lib_alloc" name = "lib_alloc"
version = "0.1.0" version = "0.1.0"
dependencies = [
"linked_list_allocator",
"x86_64",
]
[[package]] [[package]]
name = "lib_application" name = "lib_application"
@@ -101,6 +105,15 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "linked_list_allocator"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286"
dependencies = [
"spinning_top",
]
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.12" version = "0.4.12"
@@ -153,6 +166,15 @@ dependencies = [
"lock_api", "lock_api",
] ]
[[package]]
name = "spinning_top"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0"
dependencies = [
"lock_api",
]
[[package]] [[package]]
name = "volatile" name = "volatile"
version = "0.4.6" version = "0.4.6"
-3
View File
@@ -9,9 +9,6 @@ use x86_64::{
PhysAddr, VirtAddr, PhysAddr, VirtAddr,
}; };
#[global_allocator]
static ALLOCATOR: FoundryAllocator = FoundryAllocator;
/// Returns a mutable reference to the current level 4 page table. /// Returns a mutable reference to the current level 4 page table.
/// ///
/// # Safety /// # Safety
+25 -3
View File
@@ -4,6 +4,7 @@
extern crate alloc; extern crate alloc;
use core::arch::asm; use core::arch::asm;
use lib_alloc::allocator::init_heap;
use limine::request::{RequestsEndMarker, RequestsStartMarker}; use limine::request::{RequestsEndMarker, RequestsStartMarker};
use limine::BaseRevision; use limine::BaseRevision;
@@ -58,16 +59,37 @@ pub fn boot() -> Result<(), &'static str> {
use arch::x86_64::{gdt, interrupts, memmap, memory}; use arch::x86_64::{gdt, interrupts, memmap, memory};
let memory_map = memmap::get_memory_map(); let memory_map = memmap::get_memory_map();
print_log!(" Initialising Serial... ");
lib_serial::init()?; lib_serial::init()?;
println_log!("[Success]");
print_log!(" Setting Up Global Descriptor Table... ");
gdt::init(); gdt::init();
println_log!("[Success]");
print_log!(" Setting Up Interrupt Descriptor Table... ");
interrupts::init_idt(); interrupts::init_idt();
println_log!("[Success]");
print_log!(" Setting Up Page Table... ");
let mut frame_allocator = unsafe { memory::FoundryOSFrameAllocator::init(memory_map) }; let mut frame_allocator = unsafe { memory::FoundryOSFrameAllocator::init(memory_map) };
println_log!("[Success]");
x86_64::instructions::interrupts::enable(); print_log!(" Initialising Memory Subsystem... ");
let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET); let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET);
let l4_table = unsafe { memory::init(physical_memory_offset) }; let mut l4_table = unsafe { memory::init(physical_memory_offset) };
println_log!("[Success]");
print_log!(" Initialising Heap... ");
if let Err(e) = init_heap(&mut l4_table, &mut frame_allocator) {
return Err("Failed to initialise heap");
}
println_log!("[Success]");
print_log!(" Enabling Interrupts... ");
x86_64::instructions::interrupts::enable();
println_log!("[Success]");
Ok(()) Ok(())
} }
+7 -1
View File
@@ -1,6 +1,10 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
extern crate alloc;
use alloc::vec::Vec;
use foundry_os::{println, println_log}; use foundry_os::{println, println_log};
#[no_mangle] #[no_mangle]
@@ -8,11 +12,13 @@ unsafe extern "C" fn kmain() -> ! {
// All limine requests must also be referenced in a called function, otherwise they may be // All limine requests must also be referenced in a called function, otherwise they may be
// removed by the linker. // removed by the linker.
println_log!(" [ Initialising ] "); println_log!(" [ Initialising Kernel Systems ] ");
if let Err(err) = foundry_os::boot() { if let Err(err) = foundry_os::boot() {
panic!("{}", err); panic!("{}", err);
} }
println_log!("[ Kernel Initialised Successfully ] ");
let dimensions = lib_ascii::screensize_chars(); let dimensions = lib_ascii::screensize_chars();
let dimensions2 = lib_framebuffer::screensize_px(); let dimensions2 = lib_framebuffer::screensize_px();