ARM: it compiles but does not yet run :V

pull/7/head
able 2023-07-14 19:38:13 -05:00
parent bf75c0e3c8
commit fe84ee85bf
4 changed files with 42 additions and 4 deletions

View File

@ -0,0 +1,14 @@
ENTRY(_start)
SECTIONS
{
. = 0x40080000;
.text.boot : { *(.text.boot) }
.text : { *(.text) }
.data : { *(.data) }
.rodata : { *(.rodata) }
.bss : { *(.bss) }
. = ALIGN(8);
. = . + 0x4000;
LD_STACK_PTR = .;
}

View File

@ -1,4 +1,27 @@
//!
use core::ptr;
#[no_mangle]
unsafe extern "C" fn _kernel_start() -> ! {}
unsafe extern "C" fn _kernel_start() -> ! {
const UART0: *mut u8 = 0x0900_0000 as *mut u8;
let out_str = b"AArch64 Bare Metal";
for byte in out_str {
unsafe {
ptr::write_volatile(UART0, *byte);
}
}
loop {}
}
pub fn log(_args: core::fmt::Arguments<'_>) -> core::fmt::Result {
panic!()
}
pub fn sloop() -> ! {
loop {}
}
pub fn hardware_random_u64() -> u64 {
0
}
pub const PAGE_SIZE: usize = 10;

View File

@ -10,7 +10,7 @@
"linker-is-gnu": true,
"pre-link-args": {
"ld.lld": [
"-Taarch64-qemu.ld"
"-Tkernel/lds/aarch64-qemu.ld"
]
},
"llvm-target": "aarch64-unknown-none",

View File

@ -225,7 +225,8 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
if target == Target::Aarch64 {
com.args([
"-M", "virt", "-m", //
"128M", "-serial", "stdio",
"128M",
// "-serial", "stdio",
]);
}