wtf lol
This commit is contained in:
parent
ea550ccaa6
commit
4499d611e1
8 changed files with 42 additions and 15 deletions
|
@ -1,5 +1,19 @@
|
||||||
|
use core::fmt::{self, Write};
|
||||||
|
|
||||||
use crate::uart::uart_init;
|
use crate::uart::uart_init;
|
||||||
|
|
||||||
pub fn console_init() {
|
/// A wrapper around the console
|
||||||
|
pub struct Console {}
|
||||||
|
|
||||||
|
impl Console {
|
||||||
|
pub fn init() -> Self {
|
||||||
uart_init();
|
uart_init();
|
||||||
|
Console {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Write for Console {
|
||||||
|
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
1
kernel/src/io.rs
Normal file
1
kernel/src/io.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
kernel/src/macros.rs
Normal file
1
kernel/src/macros.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
|
use core::fmt::Write;
|
||||||
use core::{arch::global_asm, ptr};
|
use core::{arch::global_asm, ptr};
|
||||||
|
|
||||||
use crate::console::console_init;
|
use crate::console::Console;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod macros;
|
||||||
|
|
||||||
mod console;
|
mod console;
|
||||||
|
mod io;
|
||||||
mod memory_layout;
|
mod memory_layout;
|
||||||
mod panic;
|
mod panic;
|
||||||
mod uart;
|
mod uart;
|
||||||
|
@ -14,7 +19,8 @@ global_asm!(include_str!("start.s"));
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn not_main() {
|
pub extern "C" fn not_main() {
|
||||||
console_init();
|
let mut console = Console::init();
|
||||||
|
let _ = writeln!(console, "eos0 is booting...");
|
||||||
|
|
||||||
const UART0: *mut u8 = 0x0900_0000 as *mut u8;
|
const UART0: *mut u8 = 0x0900_0000 as *mut u8;
|
||||||
let out_str = b"AArch64 Bare Metal";
|
let out_str = b"AArch64 Bare Metal";
|
||||||
|
|
5
run.sh
5
run.sh
|
@ -1,4 +1,7 @@
|
||||||
exec qemu-system-aarch64 -machine virt \
|
set -euo pipefail
|
||||||
|
cargo build
|
||||||
|
exec qemu-system-aarch64 \
|
||||||
|
-machine virt \
|
||||||
-m 1024M \
|
-m 1024M \
|
||||||
-cpu cortex-a53 \
|
-cpu cortex-a53 \
|
||||||
-nographic \
|
-nographic \
|
||||||
|
|
2
rustfmt.toml
Normal file
2
rustfmt.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
tab_spaces = 2
|
||||||
|
max_width = 80
|
Loading…
Reference in a new issue