Skip to content

Commit 1d53dc2

Browse files
Add back x86_64 build in Github CI.
The PRs are gated on the x86 build passing, so I added a lot of cfg(target_arch = "aarch64") to aarch64-pmsa-rt so it will build for the wrong architecture. This is useful for running unit tests on helper types, etc.
1 parent b6e6c09 commit 1d53dc2

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
target: [
2222
aarch64-unknown-none-softfloat,
2323
aarch64-unknown-none,
24+
x86_64-unknown-linux-gnu,
2425
]
2526
variant: [
2627
"", # debug

packages/aarch64-pmsa-rt/src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
1111
#![no_std]
1212

13-
use core::{
14-
arch::{asm, naked_asm},
15-
mem,
16-
};
13+
#[cfg(target_arch = "aarch64")]
14+
use core::arch::{asm, naked_asm};
1715

16+
#[cfg(target_arch = "aarch64")]
1817
use aarch64_cpu::registers::{self, DAIF, Readable as _, Writeable as _};
1918

2019
mod sections;
@@ -25,6 +24,7 @@ pub use sections::Section;
2524
/// Executes `f` at one lower Exception Level on the given `stack` memory
2625
///
2726
/// `f` will inherit the current Interrupt Mask Bits (DAIF)
27+
#[cfg(target_arch = "aarch64")]
2828
pub fn drop_exception_level(f: extern "C" fn() -> !, stack: Stack) -> ! {
2929
/// This function is the first thing that runs at the lower EL and serves
3030
/// as a "trampoline" into the user-defined entry point `f`. It does the
@@ -110,6 +110,7 @@ pub fn drop_exception_level(f: extern "C" fn() -> !, stack: Stack) -> ! {
110110
#[unsafe(naked)]
111111
#[unsafe(no_mangle)]
112112
#[unsafe(link_section = ".text._start")]
113+
#[cfg(target_arch = "aarch64")]
113114
pub unsafe extern "C" fn _default_start() -> ! {
114115
core::arch::naked_asm!(
115116
r#"
@@ -146,6 +147,7 @@ pub unsafe extern "C" fn _default_start() -> ! {
146147
/// This algorithm is as described by Arm in
147148
/// [Learn the Architecture - Booting the Cortex-R82 Guide](https://developer.arm.com/documentation/109917/0002/EL2-boot-steps?lang=en)
148149
#[unsafe(naked)]
150+
#[cfg(target_arch = "aarch64")]
149151
pub extern "C" fn get_cpuid() -> u64 {
150152
core::arch::naked_asm!(
151153
r#"
@@ -165,6 +167,7 @@ pub extern "C" fn get_cpuid() -> u64 {
165167
/// Called by `_default_start`, or by your start-up routine.
166168
///
167169
/// Does some Rust based initialisation, then calls `_rust_main`.
170+
#[cfg(target_arch = "aarch64")]
168171
extern "C" fn rust_start() -> ! {
169172
unsafe extern "Rust" {
170173
fn _rust_main() -> !;
@@ -178,6 +181,7 @@ extern "C" fn rust_start() -> ! {
178181
}
179182

180183
/// Set up the Vector Base Address Register (VBAR) for the current EL
184+
#[cfg(target_arch = "aarch64")]
181185
extern "C" fn set_vbar() {
182186
let el = registers::CurrentEL.read(registers::CurrentEL::EL);
183187

@@ -228,7 +232,8 @@ pub struct StackedRegisters {
228232

229233
// NOTE this size must match stack space reserved in the prologue of the
230234
// exception handlers
231-
const _: () = assert!(8 * 24 == mem::size_of::<StackedRegisters>());
235+
#[cfg(target_arch = "aarch64")]
236+
const _: () = assert!(8 * 24 == core::mem::size_of::<StackedRegisters>());
232237

233238
/// Registers exception handlers
234239
///

0 commit comments

Comments
 (0)