blob: 49f29e2b85a0ff6b99d3894524b80b8c7bbfaba4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use core::{ffi::c_void, ops::Range, ptr::addr_of};
pub mod buddy;
pub mod physical_memory_free_list;
/// The number of bits in the offset in a page.
pub const PAGE_SIZE_BITS: usize = 12;
/// The size of a page, in bytes.
pub const PAGE_SIZE: usize = 1 << PAGE_SIZE_BITS;
/// Returns the physical address range the kernel is in.
pub fn kernel_boundaries() -> Range<usize> {
extern "C" {
static kernel_start: c_void;
static kernel_end: c_void;
}
// SAFETY: We only use these as addresses, we never dereference them.
let (kernel_start_addr, kernel_end_addr) =
unsafe { (addr_of!(kernel_start), addr_of!(kernel_end)) };
kernel_start_addr as usize..kernel_end_addr as usize
}
|