Skip to content

Commit 19c9159

Browse files
committed
More information about which modes the ASM handlers call the C handler from.
1 parent a84d201 commit 19c9159

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

cortex-a-rt/src/lib.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,39 +365,43 @@
365365
//! These are the naked 'raw' assembly functions the run-time requires:
366366
//!
367367
//! * `_start` - a Reset handler. Our linker script PROVIDEs a default function
368-
//! at `_default_start` but you can override it. Some SoCs require a chip
369-
//! specific startup for tasks like MMU initialization or chip specific
370-
//! initialization routines, so if our start-up routine doesn't work for you,
371-
//! supply your own `_start` function (but feel free to call our
372-
//! `_default_start` as part of it).
368+
//! at `_default_start` but you can override it. The provided default start
369+
//! function will initialise all global variables and then call `kmain` in SYS
370+
//! mode. Some SoCs require a chip specific startup for tasks like MMU
371+
//! initialization or chip specific initialization routines, so if our
372+
//! start-up routine doesn't work for you, supply your own `_start` function
373+
//! (but feel free to call our `_default_start` as part of it).
373374
//!
374375
//! * `_asm_undefined_handler` - a naked function to call when an Undefined
375376
//! Exception occurs. Our linker script PROVIDEs a default function at
376377
//! `_asm_default_undefined_handler` but you can override it. The provided
377-
//! default handler will call `_undefined_handler`, saving state as required.
378+
//! default handler will call `_undefined_handler` in UND mode, saving state
379+
//! as required.
378380
//!
379-
//! * `_asm_svc_handler` - a naked function to call when an SVC Exception
380-
//! occurs. Our linker script PROVIDEs a default function at
381+
//! * `_asm_svc_handler` - a naked function to call when an Supervisor Call
382+
//! (SVC) Exception occurs. Our linker script PROVIDEs a default function at
381383
//! `_asm_default_svc_handler` but you can override it. The provided default
382-
//! handler will call `_svc_handler`, saving state as required.
384+
//! handler will call `_svc_handler` in SVC mode, saving state as required.
383385
//!
384386
//! * `_asm_prefetch_abort_handler` - a naked function to call when a Prefetch
385-
//! Exception occurs. Our linker script PROVIDEs a default function at
387+
//! Abort Exception occurs. Our linker script PROVIDEs a default function at
386388
//! `_asm_default_prefetch_abort_handler` but you can override it. The
387389
//! provided default handler will call `_prefetch_abort_handler`, saving state
388-
//! as required. Note that Prefetch Abort Exceptions are handled in Abort
389-
//! Mode, Monitor Mode or Hyp Mode, depending on CPU configuration. There is
390-
//! no Prefetch Abort mode, so there is no Prefetch Abort Mode stack.
390+
//! as required. Note that Prefetch Abort Exceptions are handled in Abort Mode
391+
//! (ABT), Monitor Mode (MON) or Hyp Mode (HYP), depending on CPU
392+
//! configuration.
391393
//!
392-
//! * `_asm_data_abort_handler` - a naked function to call when an Abort
394+
//! * `_asm_data_abort_handler` - a naked function to call when a Data Abort
393395
//! Exception occurs. Our linker script PROVIDEs a default function at
394396
//! `_asm_default_data_abort_handler` but you can override it. The provided
395-
//! default handler will call `_data_abort_handler`, saving state as required.
397+
//! default handler will call `_data_abort_handler` in ABT mode, saving state
398+
//! as required.
396399
//!
397400
//! * `_asm_irq_handler` - a naked function to call when an Undefined Exception
398401
//! occurs. Our linker script PROVIDEs a default function at
399402
//! `_asm_default_irq_handler` but you can override it. The provided default
400-
//! handler will call `_irq_handler`, saving state as required.
403+
//! handler will call `_irq_handler` in SYS mode (not IRQ mode), saving state
404+
//! as required.
401405
//!
402406
//! * `_asm_fiq_handler` - a naked function to call when a Fast Interrupt
403407
//! Request (FIQ) occurs. Our linker script PROVIDEs a default function at

cortex-r-rt/src/lib.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,39 +364,43 @@
364364
//! These are the naked 'raw' assembly functions the run-time requires:
365365
//!
366366
//! * `_start` - a Reset handler. Our linker script PROVIDEs a default function
367-
//! at `_default_start` but you can override it. Some SoCs require a chip
368-
//! specific startup for tasks like MMU initialization or chip specific
369-
//! initialization routines, so if our start-up routine doesn't work for you,
370-
//! supply your own `_start` function (but feel free to call our
371-
//! `_default_start` as part of it).
367+
//! at `_default_start` but you can override it. The provided default start
368+
//! function will initialise all global variables and then call `kmain` in SYS
369+
//! mode. Some SoCs require a chip specific startup for tasks like MPU
370+
//! initialization or chip specific initialization routines, so if our
371+
//! start-up routine doesn't work for you, supply your own `_start` function
372+
//! (but feel free to call our `_default_start` as part of it).
372373
//!
373374
//! * `_asm_undefined_handler` - a naked function to call when an Undefined
374375
//! Exception occurs. Our linker script PROVIDEs a default function at
375376
//! `_asm_default_undefined_handler` but you can override it. The provided
376-
//! default handler will call `_undefined_handler`, saving state as required.
377+
//! default handler will call `_undefined_handler` in UND mode, saving state
378+
//! as required.
377379
//!
378-
//! * `_asm_svc_handler` - a naked function to call when an SVC Exception
379-
//! occurs. Our linker script PROVIDEs a default function at
380+
//! * `_asm_svc_handler` - a naked function to call when an Supervisor Call
381+
//! (SVC) Exception occurs. Our linker script PROVIDEs a default function at
380382
//! `_asm_default_svc_handler` but you can override it. The provided default
381-
//! handler will call `_svc_handler`, saving state as required.
383+
//! handler will call `_svc_handler` in SVC mode, saving state as required.
382384
//!
383385
//! * `_asm_prefetch_abort_handler` - a naked function to call when a Prefetch
384-
//! Exception occurs. Our linker script PROVIDEs a default function at
386+
//! Abort Exception occurs. Our linker script PROVIDEs a default function at
385387
//! `_asm_default_prefetch_abort_handler` but you can override it. The
386388
//! provided default handler will call `_prefetch_abort_handler`, saving state
387-
//! as required. Note that Prefetch Abort Exceptions are handled in Abort
388-
//! Mode, Monitor Mode or Hyp Mode, depending on CPU configuration. There is
389-
//! no Prefetch Abort mode, so there is no Prefetch Abort Mode stack.
389+
//! as required. Note that Prefetch Abort Exceptions are handled in Abort Mode
390+
//! (ABT), Monitor Mode (MON) or Hyp Mode (HYP), depending on CPU
391+
//! configuration.
390392
//!
391-
//! * `_asm_data_abort_handler` - a naked function to call when an Abort
393+
//! * `_asm_data_abort_handler` - a naked function to call when a Data Abort
392394
//! Exception occurs. Our linker script PROVIDEs a default function at
393395
//! `_asm_default_data_abort_handler` but you can override it. The provided
394-
//! default handler will call `_data_abort_handler`, saving state as required.
396+
//! default handler will call `_data_abort_handler` in ABT mode, saving state
397+
//! as required.
395398
//!
396399
//! * `_asm_irq_handler` - a naked function to call when an Undefined Exception
397400
//! occurs. Our linker script PROVIDEs a default function at
398401
//! `_asm_default_irq_handler` but you can override it. The provided default
399-
//! handler will call `_irq_handler`, saving state as required.
402+
//! handler will call `_irq_handler` in SYS mode (not IRQ mode), saving state
403+
//! as required.
400404
//!
401405
//! * `_asm_fiq_handler` - a naked function to call when a Fast Interrupt
402406
//! Request (FIQ) occurs. Our linker script PROVIDEs a default function at

0 commit comments

Comments
 (0)