ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
emu_memory_access.c File Reference

Central Unicorn memory access seam (see emu_memory_access.h). More...

Include dependency graph for emu_memory_access.c:

Go to the source code of this file.

Functions

uc_err emu_mem_read (uc_engine *uc, uint64_t address, void *bytes, size_t count)
 Read guest memory through the central access seam.
uc_err emu_mem_write (uc_engine *uc, uint64_t address, const void *bytes, size_t count)
 Write guest memory through the central access seam.

Detailed Description

Central Unicorn memory access seam (see emu_memory_access.h).

Kept in its own translation unit so every consumer – the engine, the peripheral models and the ELF-parser unit target – links the SAME definition. It previously had a second, test-only definition; two definitions of one access seam is exactly how a test can stop exercising the production path without anything reporting it.

Since
0.1.0

Definition in file emu_memory_access.c.

Function Documentation

◆ emu_mem_read()

uc_err emu_mem_read ( uc_engine * uc,
uint64_t address,
void * bytes,
size_t count )

Read guest memory through the central access seam.

Reads count bytes starting at address. For an aliased aperture the bytes come from the shared host mapping, so a Secure read observes what was written through the Non-secure alias or by the other CPU engine without any explicit synchronisation.

Parameters
[in,out]ucEngine whose guest memory is read.
[in]addressFirst guest byte address.
[out]bytesDestination spanning count bytes.
[in]countExact transfer length.
Returns
Unicorn-compatible completion status.
Return values
UC_ERR_OKEvery requested byte was read.
UC_ERR_ARGA null argument or a zero-length transfer was supplied.
UC_ERR_READ_UNMAPPEDThe range is not mapped in uc.
Precondition
uc, bytes are non-null and count is non-zero.
The call executes on the emulator's single owning thread.
Postcondition
No guest memory or engine state changes.
bytes is written only when the status is UC_ERR_OK.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 18 of file emu_memory_access.c.

Referenced by emu_mve_nocp_emulate(), emulate_mve(), idle_spin_at(), internal_dmac_copy_units(), internal_drw_render(), internal_drw_run_dlist(), internal_dtc_copy_units(), internal_dtc_mem_read(), internal_emu_tz_find_blxns(), internal_eth_desc_read(), internal_eth_desc_set_ds(), internal_eth_desc_set_dt(), internal_eth_tx_kick_queue(), internal_glcdc_hash_framebuffer(), internal_idle_back_edge(), internal_long_shift_begin(), internal_main_reset_vector(), internal_mve_mem_exec(), internal_npu_apply(), internal_npu_guest_word(), internal_on_blxns(), internal_on_hmsc_write10(), internal_on_icsr_write(), internal_on_intr(), internal_on_usbh_control_xfer(), internal_periph_rd32(), internal_read_tile(), internal_rtt_drain(), internal_rtt_rd32(), internal_rtt_scan(), internal_run_print_dump_syms(), internal_run_stop_sym(), internal_usbh_arg5(), internal_vmsc_fill_sector(), on_invalid_insn(), rd32(), and warm_reboot().

◆ emu_mem_write()

uc_err emu_mem_write ( uc_engine * uc,
uint64_t address,
const void * bytes,
size_t count )

Write guest memory through the central access seam.

Writes count bytes at address. For an aliased aperture the bytes land in the shared host mapping, so the write is immediately visible through the matching Secure/Non-secure alias and in every other engine bound to the same workspace.

Parameters
[in,out]ucEngine whose guest memory is written.
[in]addressFirst guest byte address.
[in]bytesSource spanning count bytes.
[in]countExact transfer length.
Returns
Unicorn-compatible completion status.
Return values
UC_ERR_OKEvery byte was written.
UC_ERR_ARGA null argument or a zero-length transfer was supplied.
UC_ERR_WRITE_UNMAPPEDThe range is not mapped in uc.
Precondition
uc, bytes are non-null and count is non-zero.
The call executes on the emulator's single owning thread.
Postcondition
Success updates every view of the addressed bytes.
A rejected call changes no guest memory.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 26 of file emu_memory_access.c.

Referenced by div0_patch_sites(), emu_tz_install(), emu_tz_patch_cmse(), internal_ceu_do_capture(), internal_dmac_copy_units(), internal_drw_render(), internal_dtc_copy_units(), internal_eth_desc_set_ds(), internal_eth_desc_set_dt(), internal_eth_rx_drain_peer(), internal_itm_seed_ready(), internal_maci_commit(), internal_mve_mem_exec(), internal_npu_apply(), internal_nvic_set_pending(), internal_on_hmsc_enumerate(), internal_on_hmsc_read10(), internal_on_hmsc_read_capacity(), internal_on_intr_sec_insn(), internal_on_sdmmc_read_block(), internal_on_usbh_bulk_in(), internal_on_usbh_control_xfer(), internal_rtt_drain(), internal_seed_tsn(), internal_stream_segment(), and wr32().