get it back to working for now
This commit is contained in:
parent
4499d611e1
commit
b4623a51a9
6 changed files with 16 additions and 9 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1 +1 @@
|
|||
pub const UART0: u64 = 0x0900_0000;
|
||||
pub const UART0: *mut u8 = 0x0900_0000 as *mut u8;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
2
run.sh
|
@ -1,5 +1,5 @@
|
|||
set -euo pipefail
|
||||
cargo build
|
||||
cargo xbuild --target=aarch64-unknown-none.json
|
||||
exec qemu-system-aarch64 \
|
||||
-machine virt \
|
||||
-m 1024M \
|
||||
|
|
Loading…
Reference in a new issue