Some ACPI work
This commit is contained in:
parent
7fe3ba7912
commit
d780a72358
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -2,6 +2,17 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "acpi"
|
||||||
|
version = "5.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9e42f25ac5fa51f4188d14baf8f387a97dcd8639644b2f3df948bf5f6dd7d6fa"
|
||||||
|
dependencies = [
|
||||||
|
"bit_field",
|
||||||
|
"bitflags 2.8.0",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
@ -63,6 +74,7 @@ checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e"
|
|||||||
name = "gila"
|
name = "gila"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"acpi",
|
||||||
"flagset",
|
"flagset",
|
||||||
"limine",
|
"limine",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -90,6 +102,12 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.19"
|
||||||
|
@ -4,6 +4,7 @@ version = "0.2.2"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
acpi = "5.1.0"
|
||||||
flagset = "0.4.6"
|
flagset = "0.4.6"
|
||||||
limine = "0.3.1"
|
limine = "0.3.1"
|
||||||
once_cell = { version = "1.20.3", default-features = false, features = ["alloc", "critical-section"] }
|
once_cell = { version = "1.20.3", default-features = false, features = ["alloc", "critical-section"] }
|
||||||
|
1
src/arch/x86_64/acpi.rs
Normal file
1
src/arch/x86_64/acpi.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
// TODO: Implement per-arch memory handlers for ACPI memory map regions
|
@ -1,2 +1,3 @@
|
|||||||
|
pub mod acpi;
|
||||||
pub mod asm;
|
pub mod asm;
|
||||||
pub mod display;
|
pub mod display;
|
||||||
|
@ -18,3 +18,6 @@ pub static SMP_REQUEST: SmpRequest = limine::request::SmpRequest::new();
|
|||||||
#[used]
|
#[used]
|
||||||
#[unsafe(link_section = ".requests")]
|
#[unsafe(link_section = ".requests")]
|
||||||
pub static FILE_REQUEST: KernelFileRequest = limine::request::KernelFileRequest::new();
|
pub static FILE_REQUEST: KernelFileRequest = limine::request::KernelFileRequest::new();
|
||||||
|
#[used]
|
||||||
|
#[unsafe(link_section = ".requests")]
|
||||||
|
pub static RSDP_REQUEST: RsdpRequest = limine::request::RsdpRequest::new();
|
||||||
|
48
src/main.rs
48
src/main.rs
@ -12,12 +12,14 @@ mod params;
|
|||||||
mod process;
|
mod process;
|
||||||
mod resources;
|
mod resources;
|
||||||
|
|
||||||
use crate::arch::current::*;
|
use crate::arch::current;
|
||||||
use crate::boot::*;
|
use crate::boot::*;
|
||||||
use crate::log::*;
|
use crate::log::*;
|
||||||
use crate::memory::alloc::*;
|
use crate::memory::alloc::{self, format, string::String, vec};
|
||||||
use crate::params::*;
|
use crate::params::*;
|
||||||
|
|
||||||
|
use acpi::{AcpiResult, AcpiTable};
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
unsafe extern "C" fn main() -> ! {
|
unsafe extern "C" fn main() -> ! {
|
||||||
// Assert supported bootloader version
|
// Assert supported bootloader version
|
||||||
@ -47,54 +49,52 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
if log_device_list.contains(&"serial") {
|
if log_device_list.contains(&"serial") {
|
||||||
// Append serial console to log subs
|
// Append serial console to log subs
|
||||||
}
|
}
|
||||||
log(LogLevel::Info, "Configured kernel logging devices.")
|
log(LogLevel::Info, "Boot: Configured kernel logging devices.")
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
let kernel_cmdline_string =
|
|
||||||
string::String::from_utf8_lossy(kernel_file_response.file().cmdline());
|
|
||||||
log(
|
log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
&format!("Kernel cmdline: {}", kernel_cmdline_string),
|
&format!(
|
||||||
|
"Boot: Kernel cmdline: {}",
|
||||||
|
String::from_utf8_lossy(kernel_file_response.file().cmdline())
|
||||||
|
),
|
||||||
);
|
);
|
||||||
drop(kernel_cmdline_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let kernel_path = string::String::from_utf8_lossy(kernel_file_response.file().path());
|
|
||||||
log(
|
log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
&format!("Kernel file path: {}", kernel_path),
|
&format!(
|
||||||
|
"Boot: Kernel file path: {}",
|
||||||
|
String::from_utf8_lossy(kernel_file_response.file().path())
|
||||||
|
),
|
||||||
);
|
);
|
||||||
drop(kernel_path);
|
|
||||||
}
|
}
|
||||||
}
|
log(
|
||||||
|
LogLevel::Info,
|
||||||
log(LogLevel::Info, "Log devices configured. Booting `gila`.");
|
"Boot: Log devices configured. Booting `gila`.",
|
||||||
log(LogLevel::Info, "Trans Rights!");
|
);
|
||||||
|
log(LogLevel::Info, "Boot: Trans Rights!");
|
||||||
|
|
||||||
let _smp_response = SMP_REQUEST.get_response();
|
let _smp_response = SMP_REQUEST.get_response();
|
||||||
|
|
||||||
match _smp_response {
|
match _smp_response {
|
||||||
None => log(
|
None => log(
|
||||||
LogLevel::Error,
|
LogLevel::Error,
|
||||||
"SMP response not received. Multiprocessing is disabled.",
|
"SMP: bootloader response not received. Multiprocessing is disabled.",
|
||||||
),
|
),
|
||||||
Some(resp) => {
|
Some(resp) => {
|
||||||
log(
|
log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
"SMP response received. Multiprocessing enabled.",
|
"SMP: bootloader response received. Multiprocessing enabled.",
|
||||||
);
|
);
|
||||||
log(
|
log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
&format!("{} CPUs found.", resp.cpus().len()),
|
&format!("SMP: {} CPUs found.", resp.cpus().len()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _rsdp_response = RSDP_REQUEST.get_response();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
asm::halt();
|
arch::current::asm::halt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,16 @@ pub struct Process {
|
|||||||
semaphor_wait: Option<u32>,
|
semaphor_wait: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub unsafe fn context_switch() -> ! {
|
||||||
|
#[allow(unused_unsafe)]
|
||||||
|
unsafe {
|
||||||
|
loop {
|
||||||
|
crate::arch::current::asm::halt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub enum ProcessState {
|
pub enum ProcessState {
|
||||||
Running,
|
Running,
|
||||||
|
Loading…
Reference in New Issue
Block a user