3434//!
3535//! ### Functions
3636//!
37- //! * `boot_core` - the `extern "C"` entry point to your application. The CPU ID
38- //! will be passed as the first argument to this function.
37+ //! * `kmain` - the `extern "C"` entry point to your application.
3938//!
4039//! Expected prototype:
4140//!
4241//! ```rust
4342//! #[unsafe(no_mangle)]
44- //! extern "C" fn boot_core(cpu_id: u32 ) -> !;
43+ //! extern "C" fn kmain( ) -> !;
4544//! ```
4645//!
4746//! * `_svc_handler` - an `extern "C"` function to call when an SVC Exception
113112//! `_asm_default_fiq_handler` but you can override it.
114113//! * `_asm_undefined_handler` - a naked function to call when an Undefined
115114//! Exception occurs. Our linker script PROVIDEs a default function at
116- //! `_asm_defeault_undefined_handler ` but you can override it.
115+ //! `_asm_default_undefined_handler ` but you can override it.
117116//! * `_asm_prefetch_handler` - a naked function to call when an Prefetch
118117//! Exception occurs. Our linker script PROVIDEs a default function at
119118//! `_asm_default_prefetch_handler` but you can override it. The provided default
@@ -217,12 +216,13 @@ core::arch::global_asm!(
217216) ;
218217
219218/// This macro expands to code for saving context on entry to an exception
220- /// handler, ignoring FPU registers .
219+ /// handler.
221220///
222221/// It should match `restore_context!`.
223222///
224223/// On entry to this block, we assume that we are in exception context.
225- macro_rules! save_context_ignore_fpu {
224+ #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
225+ macro_rules! save_context {
226226 ( ) => {
227227 r#"
228228 // save preserved registers (and gives us some working area)
@@ -238,10 +238,11 @@ macro_rules! save_context_ignore_fpu {
238238}
239239
240240/// This macro expands to code for restoring context on exit from an exception
241- /// handler, ignoring FPU registers .
241+ /// handler.
242242///
243243/// It should match `save_context!`.
244- macro_rules! restore_context_ignore_fpu {
244+ #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
245+ macro_rules! restore_context {
245246 ( ) => {
246247 r#"
247248 // restore alignment amount, and preserved register
@@ -254,30 +255,6 @@ macro_rules! restore_context_ignore_fpu {
254255 } ;
255256}
256257
257- /// This macro expands to code for saving context on entry to an exception
258- /// handler.
259- ///
260- /// It should match `restore_context!`.
261- ///
262- /// On entry to this block, we assume that we are in exception context.
263- #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
264- macro_rules! save_context {
265- ( ) => {
266- save_context_ignore_fpu!( )
267- } ;
268- }
269-
270- /// This macro expands to code for restoring context on exit from an exception
271- /// handler.
272- ///
273- /// It should match `save_context!`.
274- #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
275- macro_rules! restore_context {
276- ( ) => {
277- restore_context_ignore_fpu!( )
278- } ;
279- }
280-
281258/// This macro expands to code for saving context on entry to an exception
282259/// handler.
283260///
@@ -401,14 +378,14 @@ done:
401378 // state save from compiled code
402379 srsfd sp!, {und_mode}
403380 "# ,
404- save_context_ignore_fpu !( ) ,
381+ save_context !( ) ,
405382 r#"
406383 // Pass the faulting instruction address to the handler.
407384 mov r0, lr
408385 // call C handler
409386 bl _undefined_handler
410387 "# ,
411- restore_context_ignore_fpu !( ) ,
388+ restore_context !( ) ,
412389 r#"
413390 // Return to the failing instruction which is the recommended approach by ARM.
414391 rfefd sp!
@@ -426,14 +403,14 @@ done:
426403 // state save from compiled code
427404 srsfd sp!, {abt_mode}
428405 "# ,
429- save_context_ignore_fpu !( ) ,
406+ save_context !( ) ,
430407 r#"
431408 // Pass the faulting instruction address to the handler.
432409 mov r0, lr
433410 // call C handler
434411 bl _prefetch_handler
435412 "# ,
436- restore_context_ignore_fpu !( ) ,
413+ restore_context !( ) ,
437414 r#"
438415 // Return to the failing instruction which is the recommended approach by ARM.
439416 rfefd sp!
@@ -451,14 +428,14 @@ done:
451428 // state save from compiled code
452429 srsfd sp!, {abt_mode}
453430 "# ,
454- save_context_ignore_fpu !( ) ,
431+ save_context !( ) ,
455432 r#"
456433 // Pass the faulting instruction address to the handler.
457434 mov r0, lr
458435 // call C handler
459436 bl _abort_handler
460437 "# ,
461- restore_context_ignore_fpu !( ) ,
438+ restore_context !( ) ,
462439 r#"
463440 // Return to the failing instruction which is the recommended approach by ARM.
464441 rfefd sp!
0 commit comments