| Crates.io | axplat-loongarch64-qemu-virt |
| lib.rs | axplat-loongarch64-qemu-virt |
| version | 0.2.0 |
| created_at | 2025-07-02 07:54:57.812738+00 |
| updated_at | 2025-08-21 03:57:26.304616+00 |
| description | Implementation of `axplat` hardware abstraction layer for QEMU LoongArch virtual machine. |
| homepage | https://github.com/arceos-org/arceos |
| repository | https://github.com/arceos-org/axplat_crates |
| max_upload_size | |
| id | 1734688 |
| size | 45,040 |
Implementation of axplat hardware abstraction layer for QEMU LoongArch virtual machine.
cargo +nightly add axplat axplat-loongarch64-qemu-virt
#[axplat::main]
fn kernel_main(cpu_id: usize, arg: usize) -> ! {
// Initialize trap, console, time.
axplat::init::init_early(cpu_id, arg);
// Initialize platform peripherals (not used in this example).
axplat::init::init_later(cpu_id, arg);
// Write your kernel code here.
axplat::console_println!("Hello, ArceOS!");
// Power off the system.
axplat::power::system_off();
}
// Can be located at any dependency crate.
extern crate axplat_loongarch64_qemu_virt;
ENTRY(_start)
SECTIONS
{
. = 0xffff000080000000;
.text : ALIGN(4K) {
*(.text.boot) /* This section is required */
*(.text .text.*)
}
.rodata : ALIGN(4K) {
*(.rodata .rodata.*)
}
.data : ALIGN(4K) {
*(.data .data.*)
}
.bss : ALIGN(4K) {
*(.bss.stack) /* This section is required */
. = ALIGN(4K);
*(.bss .bss.*)
*(COMMON)
}
/DISCARD/ : {
*(.comment)
}
}
Some sections are required to be defined in the linker script, listed as below:
.text.boot: Kernel boot code..bss.stack: Stack for kernel booting.hello-kernel is a complete example of a minimal kernel implemented using axplat and related platform packages.