get it back to working for now

This commit is contained in:
Michael Zhang 2024-02-22 22:19:16 -06:00
parent 4499d611e1
commit b4623a51a9
6 changed files with 16 additions and 9 deletions

View file

@ -14,6 +14,10 @@ impl Console {
impl Write for Console {
fn write_str(&mut self, s: &str) -> fmt::Result {
todo!()
// TODO: Lock
Ok(())
// TODO: Release lock
}
}

View file

@ -5,6 +5,7 @@ use core::fmt::Write;
use core::{arch::global_asm, ptr};
use crate::console::Console;
use crate::memory_layout::UART0;
#[macro_use]
mod macros;
@ -18,11 +19,10 @@ mod uart;
global_asm!(include_str!("start.s"));
#[no_mangle]
pub extern "C" fn not_main() {
let mut console = Console::init();
let _ = writeln!(console, "eos0 is booting...");
pub extern "C" fn main() {
// let mut console = Console::init();
// let _ = writeln!(console, "eos0 is booting...");
const UART0: *mut u8 = 0x0900_0000 as *mut u8;
let out_str = b"AArch64 Bare Metal";
for byte in out_str {
unsafe {

View file

@ -1 +1 @@
pub const UART0: u64 = 0x0900_0000;
pub const UART0: *mut u8 = 0x0900_0000 as *mut u8;

View file

@ -6,7 +6,7 @@
_start:
ldr x30, =LD_STACK_PTR
mov sp, x30
bl not_main
bl main
.equ PSCI_SYSTEM_OFF, 0x84000008
.globl system_off

View file

@ -1,3 +1,5 @@
//! UART (Universal Asynchronous Receiver-Transmitter)
use crate::memory_layout::UART0;
/// http://byterunner.com/16550.html
@ -14,7 +16,8 @@ impl Register {
/// address of one of the registers
#[inline]
fn register(reg: Register) -> *mut u8 {
(UART0 + reg.offset()) as *mut u8
// (UART0 + reg.offset()) as *mut u8
UART0
}
#[inline]

2
run.sh
View file

@ -1,5 +1,5 @@
set -euo pipefail
cargo build
cargo xbuild --target=aarch64-unknown-none.json
exec qemu-system-aarch64 \
-machine virt \
-m 1024M \