Loader
Generates loader assembly code for initializing the test runtime environment.
Boots at _start in machine mode, initializes registers (integer, floating-point, vector if supported) and CSRs, sets up paging and interrupts, and hands control to the scheduler.
Interface
The loader interface defines the following routines:
_start
Entry point required by the linker. Sets up integer GPRs and initial panic.
Any traps that occur before the loader sets up the trap handler will jump to eot__failed to end the test.
loader__initialize_runtime
Initializes runtime environment by setting up CSRs, paging, trap delegation, and privilege mode.
Any traps that occurs after mtvec has been set will jump to eot__test_end to end the test.
Includes any PRE_LOADER hooks that have been registered.
loader__done
Starts scheduler by jumping to scheduler__init.
Includes any POST_LOADER hooks that have been registered.
loader_panic
Panic routine to jump directly to eot__failed and end the test as a fail.
This assumes that the current privilege is M mode and bypasses eot__end_test sequence.
Note
Traps that occur after mtvec has been set will jump through trap_handler instead, and finish with eot__end_test.
graph LR
start[_start]
panic[loader__panic]
init[loader__initialize_runtime]
done[loader__done]
scheduler[scheduler__init]
eot[eot__fail]
start --> init
start -->|trap| panic
init --> done
init -->|trap| panic
done --> scheduler
panic --> eot
classDef mMode fill:#5164e0,stroke:#5164e0,stroke-width:3px,color:#fff
classDef handlerMode fill:#fa512e,stroke:#fa512e,stroke-width:3px,color:#000
classDef handlerBlock fill:#FEC3A4,stroke:#FEC3A4,stroke-width:3px,color:#0
classDef testMode fill:#7584e6,stroke:#7584e6,stroke-width:3px,color:#0
classDef testBlock fill:#C0C0E0,stroke:#C0C0E0,stroke-width:3px,color:#0
class start,init,eot,panic mMode
class done,scheduler handlerMode
class syscall_f0000002,syscall_f0000003,failed,end_test handlerBlock
Linux Mode
The linux loader targets application code is enabled with the linux_mode feature.
It is used to run tests in linux mode and skips all setup code to jump to scheduler__init.
wysiwyg mode
Returns the loader used for What You See Is What You Get (wysiwyg) mode.
Since wysiwyg mode doesn’t have a scheduler, the loader just initializes the GPRs and any init_csr_code and continues to test.
Configuration
priv_mode: Target privilege modepaging_mode: Paging mode to enable (SV39, SV48, SV57)bringup_pagetables: Skip scheduler and jump directly to first testlinux_mode: Enable Linux loader modewysiwyg: Minimal loader without runtime setupbig_endian: Enable big-endian modecsr_init: List of CSRs to initialize (format:csr=value)csr_init_mask: List of CSRs to initialize with mask (format:csr=mask=value)counter_event_path: Path to event file for enabling performance countersdisable_wfi_wait: Disable WFI waitingneeds_pma: Setup PMA regionssetup_pmp: Setup PMP regionssecure_mode: Enable secure modesetup_stateen: Setup mstateen registersenv: Test environment (TEST_ENV_VIRTUALIZED or standard)senvcfg: Value to write to senvcfgtrap_handler_label: Label for trap handler entry pointinterrupts_enabled: Enable interruptsdeleg_excp_to: Delegate exceptions to privilege levelpbmt_ncio: Enable SVPBMT NCIOsvadu: Enable SVADU extensionmenvcfg: Value to OR with default menvcfgmedeleg: Custom medeleg valueuser_interrupt_table: Use user-defined interrupt table