Skip to content

Commit

Permalink
Replace allocator with static_alloc crate
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed May 13, 2022
1 parent 9868268 commit 8d3e622
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 78 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition = "2021"
[dependencies]
bitflags = "1.3"
goblin = { version = "0.4", default-features = false, features = ["elf64", "elf32", "endian_fd"] }
static-alloc = "0.2"

[target.'cfg(target_arch = "x86_64")'.dependencies]
multiboot = "0.7"
Expand Down
77 changes: 0 additions & 77 deletions src/allocator.rs

This file was deleted.

11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ extern crate bitflags;
#[macro_use]
pub mod macros;

pub mod allocator;
pub mod arch;
pub mod console;
pub mod kernel;
mod runtime_glue;

use core::ptr;

use static_alloc::Bump;

/// A simple bump memory allocator using static storage.
///
/// This allocator is used for bootstrapping.
/// It manages a slice of uninitialized memory and cannot deallocate.
/// The kernel will setup a proper memory allocator later.
#[global_allocator]
static ALLOCATOR: Bump<[u8; 2 * 1024 * 1024]> = Bump::uninit();

// FUNCTIONS
pub unsafe fn sections_init() {
extern "C" {
Expand Down

0 comments on commit 8d3e622

Please sign in to comment.