Skip to content

Commit

Permalink
arch/aarch64: Setup SIMD at startup
Browse files Browse the repository at this point in the history
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 <retrage01@gmail.com>
  • Loading branch information
retrage committed Jan 25, 2023
1 parent 9d25f47 commit 411ca73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
pub mod asm;
pub mod layout;
pub mod paging;
pub mod simd;
mod translation;
9 changes: 9 additions & 0 deletions src/arch/aarch64/simd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Akira Moroo

use aarch64_cpu::registers::*;
use tock_registers::interfaces::ReadWriteable;

pub fn setup_simd() {
CPACR_EL1.modify(CPACR_EL1::FPEN::TrapNothing);
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ pub extern "C" fn rust64_start(#[cfg(not(feature = "coreboot"))] pvh_info: &pvh:
pub extern "C" fn rust64_start(x0: *const u8) -> ! {
serial::PORT.borrow_mut().init();

arch::aarch64::simd::setup_simd();
arch::aarch64::paging::setup();

let info = fdt::StartInfo::new(x0);
Expand Down

0 comments on commit 411ca73

Please sign in to comment.