mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
commit
0577ba6775
11 changed files with 25 additions and 21 deletions
|
|
@ -129,7 +129,7 @@ pub const GLYPH_LEN: usize = {{.GS.GlyphsLen}};
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ pub const GLYPH_LEN: usize = 1656;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1550,7 +1550,7 @@ pub const GLYPH_LEN: usize = 10944;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11138,7 +11138,7 @@ pub const GLYPH_LEN: usize = 88648;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12593,7 +12593,7 @@ pub const GLYPH_LEN: usize = 99712;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ pub const GLYPH_LEN: usize = 1656;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ pub const GLYPH_LEN: usize = 1656;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ pub const GLYPH_LEN: usize = 1656;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ pub const GLYPH_LEN: usize = 6624;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8364,7 +8364,7 @@ pub const GLYPH_LEN: usize = 65448;
|
|||
pub fn glyphs() -> &'static [u32] {
|
||||
#[cfg(any(feature="precursor", feature="renode"))]
|
||||
unsafe {
|
||||
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
|
||||
let data: *const u32 = core::ptr::with_exposed_provenance::<u32>(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst) as usize);
|
||||
core::slice::from_raw_parts(data, GLYPH_LEN)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ use alloc::vec::Vec;
|
|||
#[macro_use]
|
||||
mod args;
|
||||
use args::{KernelArgument, KernelArguments};
|
||||
#[cfg(feature = "bao1x")]
|
||||
use bao1x_api::UUID;
|
||||
|
||||
#[cfg_attr(feature = "atsama5d27", path = "platform/atsama5d27/debug.rs")]
|
||||
|
|
@ -121,14 +122,11 @@ mod test;
|
|||
// somewhat dangerously tell the loader to go ahead and allocate over this region by
|
||||
// telling it has the whole rest of SRAM to stick initial process pages in.
|
||||
#[global_allocator]
|
||||
#[cfg(feature = "bao1x")]
|
||||
static ALLOCATOR: linked_list_allocator::LockedHeap = linked_list_allocator::LockedHeap::empty();
|
||||
// heap start is selected by looking at the total reserved .data + .bss region in the compiled loader.
|
||||
// it hovers at 0x5000 unless I start adding lots of statics to the loader (which there are not).
|
||||
#[cfg(feature = "bao1x")]
|
||||
pub const HEAP_OFFSET: usize = 0x5000;
|
||||
// just a small heap, big enough for us to use alloc to simplify argument processing
|
||||
#[cfg(feature = "bao1x")]
|
||||
pub const HEAP_LEN: usize = 0x1000;
|
||||
|
||||
#[repr(C)]
|
||||
|
|
@ -245,14 +243,23 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32)
|
|||
// Initialize the allocator with heap memory range. The heap memory is "throw-away"
|
||||
// so we stick it near the bottom of RAM, with the assumption that the loader process
|
||||
// won't smash over it.
|
||||
#[cfg(any(feature = "bao1x"))]
|
||||
#[cfg(feature = "bao1x")]
|
||||
let heap_start = utralib::HW_SRAM_MEM + HEAP_OFFSET;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
let heap_start = utralib::HW_SRAM_EXT_MEM + HEAP_OFFSET;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
{
|
||||
let heap_start = utralib::HW_SRAM_MEM + HEAP_OFFSET;
|
||||
crate::println!("Setting up heap @ {:x}-{:x}", heap_start, heap_start + HEAP_LEN);
|
||||
unsafe {
|
||||
ALLOCATOR.lock().init(heap_start as *mut u8, HEAP_LEN);
|
||||
// for precursor, clear this region, as it is only cleared later in the boot process
|
||||
let ram_init = utralib::HW_SRAM_EXT_MEM as *mut u32;
|
||||
for i in 0..(HEAP_LEN + HEAP_OFFSET) / size_of::<u32>() {
|
||||
unsafe { ram_init.add(i).write_volatile(0) };
|
||||
}
|
||||
}
|
||||
println!("Setting up heap @ {:x}-{:x}", heap_start, heap_start + HEAP_LEN);
|
||||
unsafe {
|
||||
ALLOCATOR.lock().init(heap_start as *mut u8, HEAP_LEN);
|
||||
}
|
||||
println!("done");
|
||||
|
||||
// Run kernel image validation now that the heap is set up.
|
||||
#[cfg(feature = "bao1x")]
|
||||
|
|
@ -787,9 +794,6 @@ fn clear_ram(cfg: &mut BootConfig) {
|
|||
if VDBG {
|
||||
println!("Stack clearing limit: {:x}", clear_limit);
|
||||
}
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
let clear_start = 0;
|
||||
#[cfg(feature = "bao1x")]
|
||||
let clear_start = HEAP_OFFSET + HEAP_LEN;
|
||||
unsafe {
|
||||
for addr in clear_start..(cfg.sram_size - clear_limit) / 4 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue