40 lines
1.1 KiB
Rust
40 lines
1.1 KiB
Rust
// Copyright (c) 2025 shibedrill
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
use lazy_static::lazy_static;
|
|
use limine::{
|
|
request::{ExecutableAddressRequest, HhdmRequest, MemoryMapRequest},
|
|
response::HhdmResponse,
|
|
};
|
|
|
|
use talc::*;
|
|
|
|
pub extern crate alloc;
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static ADDRESS_REQUEST: ExecutableAddressRequest =
|
|
limine::request::ExecutableAddressRequest::new();
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static MEMMAP_REQUEST: MemoryMapRequest = limine::request::MemoryMapRequest::new();
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static HHDM_REQUEST: HhdmRequest = limine::request::HhdmRequest::new();
|
|
|
|
lazy_static! {
|
|
pub static ref HHDM_RESPONSE: &'static HhdmResponse = HHDM_REQUEST
|
|
.get_response()
|
|
.expect("Did not get HHDM response from bootloader");
|
|
}
|
|
|
|
// TODO: 10kb kernel heap. Need to figure out how to make this less stupid...
|
|
static mut ARENA: [u8; 10000] = [0; 10000];
|
|
|
|
#[global_allocator]
|
|
static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> =
|
|
Talc::new(unsafe { ClaimOnOom::new(Span::from_array(core::ptr::addr_of!(ARENA).cast_mut())) })
|
|
.lock();
|