Files
RedBear-OS/src/arch/aarch64/mod.rs
T
2026-04-02 20:29:36 +02:00

72 lines
1.1 KiB
Rust

/// Constants like memory locations
pub mod consts;
/// Debugging support
pub mod debug;
/// Devices
pub mod device;
/// Interrupt instructions
pub mod interrupt;
/// Inter-processor interrupts
pub mod ipi;
/// Miscellaneous
pub mod misc;
/// Paging
pub mod paging;
/// Initialization and start function
pub mod start;
/// Stop function
pub mod stop;
// Interrupt vectors
pub mod vectors;
pub mod time;
pub use ::rmm::aarch64::AArch64Arch as CurrentRmmArch;
pub use arch_copy_to_user as arch_copy_from_user;
#[unsafe(naked)]
pub unsafe extern "C" fn arch_copy_to_user(dst: usize, src: usize, len: usize) -> u8 {
// x0, x1, x2
core::arch::naked_asm!(
"
.global __usercopy_start
__usercopy_start:
mov x4, x0
mov x0, 0
2:
cmp x2, 0
b.eq 3f
ldrb w3, [x1]
strb w3, [x4]
add x4, x4, 1
add x1, x1, 1
sub x2, x2, 1
b 2b
3:
ret
.global __usercopy_end
__usercopy_end:
"
);
}
pub const KFX_SIZE: usize = 1024;
// This function exists as the KFX size is dynamic on x86_64.
pub fn kfx_size() -> usize {
KFX_SIZE
}