FPU: moved enable function to zc706

This commit is contained in:
pca006132 2020-07-03 16:02:34 +08:00
parent f0697c3ec3
commit 90e33f688a
2 changed files with 16 additions and 0 deletions

14
libcortex_a9/src/fpu.rs Normal file
View File

@ -0,0 +1,14 @@
/// Enable FPU in the current core.
pub fn enable_fpu() {
unsafe {
llvm_asm!("
mrc p15, 0, r1, c1, c0, 2
orr r1, r1, (0b1111<<20)
mcr p15, 0, r1, c1, c0, 2
vmrs r1, fpexc
orr r1, r1, (1<<30)
vmsr fpexc, r1
":::"r1");
}
}

View File

@ -11,6 +11,8 @@ pub mod mmu;
pub mod mutex; pub mod mutex;
pub mod sync_channel; pub mod sync_channel;
mod uncached; mod uncached;
mod fpu;
pub use uncached::UncachedSlice; pub use uncached::UncachedSlice;
pub use fpu::enable_fpu;
global_asm!(include_str!("exceptions.s")); global_asm!(include_str!("exceptions.s"));