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" ) ]
1817use aarch64_cpu:: registers:: { self , DAIF , Readable as _, Writeable as _} ;
1918
2019mod 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" ) ]
2828pub 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" ) ]
113114pub 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" ) ]
149151pub 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" ) ]
168171extern "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" ) ]
181185extern "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