From 1f23a1b86c8dd233ec532a06045fe108caf0cd43 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 7 Jun 2020 15:12:34 +0800 Subject: [PATCH] enable FPU on Core1 --- src/runtime/src/kernel.rs | 13 +++++++++++++ src/runtime/src/main.rs | 1 + 2 files changed, 14 insertions(+) diff --git a/src/runtime/src/kernel.rs b/src/runtime/src/kernel.rs index eb5aa9e..4ff27d4 100644 --- a/src/runtime/src/kernel.rs +++ b/src/runtime/src/kernel.rs @@ -128,6 +128,19 @@ fn resolve(required: &[u8]) -> Option { pub fn main_core1() { debug!("Core1 started"); + 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"); + } + debug!("FPU enabled on Core1"); + let mut core1_tx = None; while core1_tx.is_none() { core1_tx = CHANNEL_1TO0.lock().take(); diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 8d62a75..48522df 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -1,6 +1,7 @@ #![no_std] #![no_main] #![recursion_limit="1024"] // for futures_util::select! +#![feature(llvm_asm)] extern crate alloc;