I hate the x86 architecture with a passion, time to switch over to ARM /j
This commit is contained in:
parent
80bd36b4c4
commit
ded4ea603e
8 changed files with 58 additions and 3 deletions
|
@ -43,6 +43,12 @@ fn main() {
|
|||
println!(
|
||||
r#"cargo:rustc-check-cfg=cfg(CONFIG_MEMORY_UNION_ALL, values("true", "false", none()))"#
|
||||
);
|
||||
|
||||
println!(r#"cargo:rustc-check-cfg=cfg(CONFIG_POWERON_TESTS, values("true", "false", none()))"#);
|
||||
|
||||
println!(
|
||||
r#"cargo:rustc-check-cfg=cfg(CONFIG_POWERON_TEST_ALLOC, values("true", "false", none()))"#
|
||||
);
|
||||
// End checks
|
||||
|
||||
// Configuration name used when a config is required but should always evaluate
|
||||
|
|
|
@ -35,5 +35,13 @@ CONFIG_BUILD_GRUB=true
|
|||
# The precision of the allocator. The size of the allocated region is divided by this to get how much to change it by each loop iteration
|
||||
# when trying to find a allocatable region.
|
||||
CONFIG_ALLOC_PRECISION=4
|
||||
|
||||
# Joke memory allocation option. Causes all allocations to return the exact same address.
|
||||
CONFIG_MEMORY_UNION_ALL=false
|
||||
|
||||
# Whether to run power on tests.
|
||||
CONFIG_POWERON_TESTS=true
|
||||
|
||||
# Whether to run the allocator power on test.
|
||||
CONFIG_POWERON_TEST_ALLOC=true
|
||||
# End configs
|
|
@ -15,6 +15,7 @@ use core::fmt::Debug;
|
|||
use core::panic::PanicInfo;
|
||||
|
||||
use aphrodite::arch::egatext;
|
||||
use aphrodite::arch::enable_a20;
|
||||
use aphrodite::arch::output::*;
|
||||
use aphrodite::boot::{BootInfo, MemoryMapping};
|
||||
use aphrodite::display::COLOR_DEFAULT;
|
||||
|
@ -290,6 +291,12 @@ extern "C" fn _start() -> ! {
|
|||
}
|
||||
sdebugsln("Bootloader information has been successfully loaded");
|
||||
sdebugunp(b'\n');
|
||||
|
||||
if !enable_a20() {
|
||||
panic!("failed to enable a20 gate");
|
||||
}
|
||||
initalize_rtc();
|
||||
|
||||
unsafe {
|
||||
if BI.output.clone().is_some() {
|
||||
let framebuffer_info = FBI;
|
||||
|
|
|
@ -85,7 +85,7 @@ fn load_idt(base: *const u8, size: usize) {
|
|||
/// Activate an IDT.
|
||||
#[aphrodite_proc_macros::kernel_item(ActivateIDT)]
|
||||
fn activate_idt(idt: Idt, alloc: crate::mem::MemoryMapAlloc) {
|
||||
let _mem = alloc
|
||||
let mem = alloc
|
||||
.allocate(unsafe { Layout::from_size_align_unchecked(8 * idt.len, 1) })
|
||||
.unwrap()
|
||||
.as_mut_ptr();
|
||||
|
|
|
@ -153,3 +153,24 @@ pub fn enable_a20() -> bool {
|
|||
|
||||
return test_a20();
|
||||
}
|
||||
|
||||
static mut RTC_INITALIZED: bool = false;
|
||||
|
||||
pub fn initalize_rtc() {
|
||||
if unsafe { RTC_INITALIZED } {
|
||||
return;
|
||||
}
|
||||
let irq = pop_irq();
|
||||
outb(0x70, 0x8A);
|
||||
outb(0x71, 0x20);
|
||||
restore_irq(irq);
|
||||
unsafe { RTC_INITALIZED = true }
|
||||
}
|
||||
|
||||
pub fn sleep(seconds: u32) {
|
||||
initalize_rtc();
|
||||
}
|
||||
|
||||
pub fn alloc_available_boot() {
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,13 @@ fn indep_boot_entry(
|
|||
let mem_map = BI.memory_map.unwrap();
|
||||
crate::mem::MemMapAllocInit(mem_map).unwrap();
|
||||
|
||||
crate::power_on_tests::run(display);
|
||||
crate::arch::alloc_available_boot();
|
||||
|
||||
if cfg!(not(CONFIG_POWERON_TESTS = "false")) {
|
||||
crate::power_on_tests::run(display);
|
||||
|
||||
tinfosln("Successfully ran all configured power on tests", display).unwrap();
|
||||
}
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(all(not(CONFIG_POWERON_TESTS = "false"), not(CONFIG_POWERON_TEST_ALLOC = "false")))]
|
||||
|
||||
use crate::display::TextDisplay;
|
||||
use crate::output::*;
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#![cfg(not(CONFIG_POWERON_TESTS = "false"))]
|
||||
|
||||
use crate::display::TextDisplay;
|
||||
|
||||
mod memmapalloc;
|
||||
|
||||
pub fn run(display: &dyn TextDisplay) { memmapalloc::run(display); }
|
||||
pub fn run(display: &dyn TextDisplay) {
|
||||
#[cfg(not(CONFIG_POWERON_TEST_ALLOC = "false"))]
|
||||
memmapalloc::run(display);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue