feat: change font and release greate tty output

This commit is contained in:
Faynot
2026-06-26 22:07:16 +03:00
parent 3f87a93d52
commit b59779ca4a
13 changed files with 183 additions and 139 deletions

View File

@@ -37,15 +37,12 @@
extern crate alloc;
use alloc::vec::Vec;
// ══════════════════════════════════════════════════════════════════════════════
// Constants & helpers
// ══════════════════════════════════════════════════════════════════════════════
/// Maximum allocation order.
/// `2^11 × 4 096 bytes = 8 MiB` per single allocation.
pub const MAX_ORDER: usize = 11;
/// ⌈log(n)⌉ — the minimum order whose block size covers `page_count` pages.
/// ⌈log2(n)⌉ — the minimum order whose block size covers `page_count` pages.
///
/// ```text
/// order_for(1) = 0 (2^0 = 1)
@@ -63,10 +60,7 @@ pub fn order_for(page_count: usize) -> usize {
}
}
// ══════════════════════════════════════════════════════════════════════════════
// BuddyAllocator
// ══════════════════════════════════════════════════════════════════════════════
/// Buddy allocator over a contiguous, pre-committed range of physical pages.
///
/// All page indices stored in free lists are **relative to the start of the
@@ -89,8 +83,7 @@ pub struct BuddyAllocator {
}
impl BuddyAllocator {
// ─── Construction ─────────────────────────────────────────────────────────
//Construction
/// Create a new allocator over `total_pages` pages, **all initially free**.
///
/// Uses a greedy largest-first decomposition to build the initial free lists
@@ -127,7 +120,7 @@ impl BuddyAllocator {
// Size constraint: 2^order ≤ remaining → order ≤ ⌊log₂(remaining)⌋.
let size_order = (usize::BITS as usize - 1)
- remaining.leading_zeros() as usize; // ⌊log(remaining)⌋
- remaining.leading_zeros() as usize; // ⌊log2(remaining)⌋
let order = MAX_ORDER.min(align_order).min(size_order);
let block_size = 1usize << order;
@@ -140,8 +133,7 @@ impl BuddyAllocator {
this
}
// ─── Allocation ───────────────────────────────────────────────────────────
//Allocation
/// Allocate a 2^`order`-page block.
///
/// Returns the **relative** page index of the block's first page, or `None`
@@ -206,7 +198,7 @@ impl BuddyAllocator {
self.alloc(order).map(|idx| (idx, order))
}
// ─── Deallocation ─────────────────────────────────────────────────────────
//Deallocation
/// Return a 2^`order`-page block at **relative** index `block_idx` to the
/// free pool, coalescing with free buddies up the order chain.
@@ -269,7 +261,7 @@ impl BuddyAllocator {
self.free_lists[order].push(block_idx);
}
// ─── Introspection ────────────────────────────────────────────────────────
//Introspection
/// Number of pages currently available for allocation.
#[inline]