Skip to content

Commit 4a62db4

Browse files
Dan Crossorangecms
Dan Cross
authored andcommitted
allocator: import QuickFit allocator from Hypatia
This imports the QuickFit allocator from Hypatia, setting us up to have a rudimentary kernel heap. Signed-off-by: Dan Cross <cross@gajendra.net>
1 parent d6a0ade commit 4a62db4

File tree

12 files changed

+549
-57
lines changed

12 files changed

+549
-57
lines changed

aarch64/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![cfg_attr(not(any(test)), no_std)]
44
#![cfg_attr(not(test), no_main)]
55
#![feature(alloc_error_handler)]
6-
#![feature(asm_const)]
76
#![feature(core_intrinsics)]
87
#![feature(strict_provenance)]
98
#![forbid(unsafe_op_in_unsafe_fn)]

aarch64/src/runtime.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate alloc;
55
use crate::kmem::physaddr_as_virt;
66
use crate::registers::rpi_mmio;
77
use crate::uartmini::MiniUart;
8-
use alloc::alloc::{GlobalAlloc, Layout};
8+
use alloc::alloc::Layout;
99
use core::fmt::Write;
1010
use core::panic::PanicInfo;
1111
use port::devcons::PanicConsole;
@@ -39,17 +39,3 @@ pub fn panic(info: &PanicInfo) -> ! {
3939
fn oom(_layout: Layout) -> ! {
4040
panic!("oom");
4141
}
42-
43-
struct FakeAlloc;
44-
45-
unsafe impl GlobalAlloc for FakeAlloc {
46-
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
47-
panic!("fake alloc");
48-
}
49-
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
50-
panic!("fake dealloc");
51-
}
52-
}
53-
54-
#[global_allocator]
55-
static FAKE_ALLOCATOR: FakeAlloc = FakeAlloc {};

lib/aarch64-unknown-none-elf.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"arch": "aarch64",
3-
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
3+
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32",
44
"disable-redzone": true,
55
"executables": true,
66
"features": "+strict-align,+neon,+fp-armv8",
@@ -16,4 +16,4 @@
1616
"-nostdlib"
1717
]
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)