Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions luma_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#![allow(unused_attributes)]
#![feature(asm_experimental_arch, box_into_boxed_slice, allocator_api)]

use core::arch::asm;

extern crate alloc;

// Broadway Processor Utilities
Expand All @@ -32,3 +34,19 @@ pub mod allocate;

// VI Subsystem
pub mod vi;

#[no_mangle]
#[inline(never)]
pub unsafe extern "C" fn puts(unused: u32, message: *const u8) {
// Do nothing, this is for Dolphin’s use until we get actual USB Gecko support.
asm!("/* {0} {1} */", in(reg) unused, in(reg) message);
}

#[macro_export]
macro_rules! println {
($fmt: expr, $($args: expr),*) => {{
// TODO: figure out a way to not have to import those crates with these names in user code.
let string = alloc::format!($fmt, $($args),*);
unsafe { luma_core::puts(0, string.as_ptr()) };
}}
}
6 changes: 5 additions & 1 deletion luma_runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#![no_std]
#![feature(asm_experimental_arch, lang_items, alloc_error_handler)]

extern crate alloc;

use core::arch::global_asm;
use core::{alloc::Layout, panic::PanicInfo};
use linked_list_allocator::LockedHeap;
#[allow(unused_imports)]
use luma_core::cache::*;
use luma_core::println;

// Import linker symbols for allocator initialization.
extern "C" {
Expand Down Expand Up @@ -66,7 +69,8 @@ impl Termination for () {}
/// This function is called on panic.
#[cfg_attr(not(test), panic_handler)]
#[no_mangle]
fn panic(_info: &PanicInfo) -> ! {
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
loop {}
}

Expand Down