39typedef enum : uint8_t {
157 uint64_t exc_ret_pc = 0U;
165 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
170 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
173 if (err != UC_ERR_OK) {
183 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
192 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
203 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
211 (void)uc_reg_read(uc, UC_ARM_REG_PC, run_pc);
217bool priv_run_inner(uc_engine* uc, uint32_t vtor_base, uint32_t* run_pc_io, uc_err* err_out)
219 uint32_t run_pc = *run_pc_io;
220 uc_err err = UC_ERR_OK;
221 bool faulted =
false;
222 for (uint32_t inner = 0U; inner < (uint32_t)
k_run_inner_max; inner++) {
225 err = uc_emu_start(uc, (uint64_t)run_pc | 1U, 0, 0, run_budget);
226 (void)uc_reg_read(uc, UC_ARM_REG_PC, &run_pc);
Shared Unicorn engine access utilities for the board emulator.
bool emu_seam_take_relaunch(void)
Consume the zero-time seam-relaunch latch.
Cortex-M exception model constants and interfaces for ra8_emulator.
bool emu_exc_take_exc_return(uint64_t *out_pc)
Consume a latched EXC_RETURN branch (read + clear).
void emu_exc_clear_pendsv_stop(void)
Clear the PendSV context-switch stop marker (per relaunch).
bool idle_spin_at(uc_engine *uc, uint32_t pc)
True if pc sits in a wait-for-interrupt spin (the core is idle).
bool emu_exc_bkpt_hit(void)
Whether the firmware executed a BKPT (deliberate trap / give-up).
bool emu_exc_pendsv_stop(void)
Whether the last engine stop was a PENDSVSET context-switch stop.
bool emu_exc_reboot_requested(void)
Whether AIRCR.SYSRESETREQ requested a warm reboot.
void exc_return(uc_engine *uc, uint32_t exc_ret)
Perform a Cortex-M exception return for an observed EXC_RETURN branch.
bool exc_take_pending(uc_engine *uc, uint32_t vtor_base, bool allow_systick)
Take the highest-priority pending exception, if one may activate now.
Armv8-M MPU enforcement model for ra8_emulator.
bool emu_mpu_fault_pending(void)
Whether an RO-region write violation is latched.
void emu_mpu_clear_fault(void)
Clear the latched MPU violation.
void mpu_synth_memmanage(uc_engine *uc, uint32_t vtor_base)
Synthesise a MemManage (#4) fault for a trapped RO-region write.
Firmware profiler (RA8_EMU_PROFILE): sampling, hooks, reports.
bool emu_prof_stop_hit(void)
Whether the RA8_EMU_STOP_PC address was reached.
@ k_run_inner_max
Per-chunk exception-resolve relaunch cap.
@ k_run_chunk_insns
Instructions per emulation chunk.
@ k_low_power_div
Low-power: shrink the chunk budget by.
@ k_idle_spin_insns
Budget when the core is parked on a wait-for-interrupt spin (a "b ." self-branch, wfi,...
static RA8_INTERNAL size_t internal_run_inner_budget(uc_engine *uc, uint32_t run_pc)
Compute one inner chunk's instruction budget for run_pc.
inner_action_t
Loop-control verdict a priv_run_inner boundary helper hands back.
@ k_inner_continue
Re-enter the inner loop (relaunch / tail-chain).
@ k_inner_break
End the inner loop (fault / BKPT / quiescent).
static RA8_INTERNAL inner_action_t internal_run_inner_take_exception(uc_engine *uc, uint32_t vtor_base, uint32_t *run_pc, uc_err err, bool *faulted)
Take the pending exception (or end) at the chunk boundary.
bool priv_run_inner(uc_engine *uc, uint32_t vtor_base, uint32_t *run_pc_io, uc_err *err_out)
Run one outer chunk's inner exception-resolve loop.
static RA8_INTERNAL bool internal_run_inner_check_stops(uc_engine *uc, bool *faulted, inner_action_t *act)
Resolve the zero-time relaunch and run-ending stop conditions.
Shared run-loop state + cross-TU run helpers (ra8_emulator internal).
Armv8.1-M instruction-emulation seams (M85 ops on Unicorn's M33).
bool emu_div0_fault_pending(void)
Whether a trapping divide-by-zero is latched for the run loop.
void div0_synth_usagefault(uc_engine *uc, uint32_t vtor_base)
Synthesise a UsageFault (#6) for a trapped divide-by-zero.
void emu_div0_clear_fault(void)
Clear the latched divide-by-zero fault.
bool emu_mve_nocp_take(void)
Test and clear the "NoCP fault serviced by the MVE seam" latch.
Board-view presentation: frames, composition, input routing, panels.
bool emu_low_power(void)
Whether the M33 4:1-slower low-power clock model is active.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).