1
0
Fork 0
forked from AbleOS/ableos

ARM: it compiles but does not yet run :V

This commit is contained in:
able 2023-07-14 19:38:13 -05:00
parent 4dd3699e0e
commit 9bbc0e19a1
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",
]);
}