forked from koniifer/ableos
ARM: it compiles but does not yet run :V
This commit is contained in:
parent
4dd3699e0e
commit
9bbc0e19a1
14
kernel/lds/aarch64-qemu.ld
Normal file
14
kernel/lds/aarch64-qemu.ld
Normal 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 = .;
|
||||||
|
}
|
|
@ -1,4 +1,27 @@
|
||||||
//!
|
//!
|
||||||
|
use core::ptr;
|
||||||
#[no_mangle]
|
#[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;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"linker-is-gnu": true,
|
"linker-is-gnu": true,
|
||||||
"pre-link-args": {
|
"pre-link-args": {
|
||||||
"ld.lld": [
|
"ld.lld": [
|
||||||
"-Taarch64-qemu.ld"
|
"-Tkernel/lds/aarch64-qemu.ld"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"llvm-target": "aarch64-unknown-none",
|
"llvm-target": "aarch64-unknown-none",
|
||||||
|
|
|
@ -225,7 +225,8 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
|
||||||
if target == Target::Aarch64 {
|
if target == Target::Aarch64 {
|
||||||
com.args([
|
com.args([
|
||||||
"-M", "virt", "-m", //
|
"-M", "virt", "-m", //
|
||||||
"128M", "-serial", "stdio",
|
"128M",
|
||||||
|
// "-serial", "stdio",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue