Skip to content

Commit 14abd71

Browse files
committed
arch/aarch64: Setup SIMD at startup
A recent GRUB binary implicitly uses advanced SIMD registers. We don't want to trap use of these registers, we have to ensure that CPACR_EL.FPEN is set to 0b11. Signed-off-by: Akira Moroo <[email protected]>
1 parent 376ebd0 commit 14abd71

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/arch/aarch64/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
pub mod asm;
66
pub mod layout;
77
pub mod paging;
8+
pub mod simd;
89
mod translation;

src/arch/aarch64/simd.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (C) 2023 Akira Moroo
3+
4+
use aarch64_cpu::registers::*;
5+
use tock_registers::interfaces::ReadWriteable;
6+
7+
pub fn setup_simd() {
8+
CPACR_EL1.modify(CPACR_EL1::FPEN::TrapNothing);
9+
}

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ pub extern "C" fn rust64_start(#[cfg(not(feature = "coreboot"))] pvh_info: &pvh:
171171
pub extern "C" fn rust64_start(x0: *const u8) -> ! {
172172
serial::PORT.borrow_mut().init();
173173

174+
arch::aarch64::simd::setup_simd();
174175
arch::aarch64::paging::setup();
175176

176177
let info = fdt::StartInfo::new(x0);

0 commit comments

Comments
 (0)