ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
emu_memmap.h
Go to the documentation of this file.
1
14
15#pragma once
16
17#include <stddef.h>
18#include <stdint.h>
19#include <unicorn/unicorn.h>
20
21#include "emu_memory_access.h"
22#include "ra8_attributes.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29typedef struct {
30 const char* name;
31 uint64_t base;
32 uint64_t size;
34
36typedef enum : uint32_t {
38 k_dtcm_base = 0x20000000U,
40 k_dtcm_end = 0x20010000U,
42 k_sram_base = 0x22000000U,
44 k_sram_end = 0x22100000U,
46 k_sdram_base = 0x68000000U,
48 k_sdram_end = 0x6C000000U,
50 k_ns_sdram_base = 0x78000000U,
52 k_page_size = 0x1000U,
54
60
68
75
77typedef struct {
78 uint8_t* host;
79 uint64_t size;
81
83typedef struct {
84 uc_engine* uc;
85 bool active;
87
97
113
135
158 uc_engine* uc);
159
177bool emu_memmap_detach(emu_memmap_workspace_t* workspace, uc_engine* uc);
178
196
212const mem_region_t* emu_memmap_regions(uint32_t* count);
213
227uint64_t emu_memmap_mram_base(void);
228
229#ifdef __cplusplus
230}
231#endif
emu_memmap_result_t emu_memmap_open(emu_memmap_workspace_t *workspace)
Create three independent, lazily-committed host aperture mappings.
Definition emu_memmap.c:439
emu_memmap_result_t emu_memmap_requirements(void)
Report the immutable aliased-aperture backing geometry.
Definition emu_memmap.c:434
struct emu_memmap_workspace emu_memmap_workspace_t
Independent aperture backing with at most two engine bindings.
emu_memmap_status_t
Semantic result for backing lifecycle operations.
Definition emu_memmap.h:62
@ k_emu_memmap_ok
Operation completed exactly.
Definition emu_memmap.h:63
@ k_emu_memmap_backing
A host aperture mapping could not be made.
Definition emu_memmap.h:65
@ k_emu_memmap_invalid
Pointer, state, or engine was invalid.
Definition emu_memmap.h:64
@ k_emu_memmap_unicorn
Unicorn map or window install failed.
Definition emu_memmap.h:66
emu_memmap_limit_t
Fixed backing and binding limits.
Definition emu_memmap.h:56
@ k_emu_memmap_binding_count
CPU0 and optional CPU1 engines.
Definition emu_memmap.h:58
@ k_emu_memmap_backing_count
SRAM, SDRAM, and OSPI host mappings.
Definition emu_memmap.h:57
emu_memmap_result_t emu_memmap_attach(emu_memmap_workspace_t *workspace, uc_engine *uc)
Map one Unicorn engine onto the shared aperture backing.
Definition emu_memmap.c:463
ram_region_t
Address constants shared with framebuffer and alias validation.
Definition emu_memmap.h:36
@ k_sdram_base
External SDRAM start.
Definition emu_memmap.h:46
@ k_sram_end
CPU0 SRAM end used by framebuffer checks.
Definition emu_memmap.h:44
@ k_page_size
Unicorn and host mapping granule.
Definition emu_memmap.h:52
@ k_dtcm_base
Data TCM start.
Definition emu_memmap.h:38
@ k_sram_base
On-chip SRAM start.
Definition emu_memmap.h:42
@ k_dtcm_end
Data TCM end.
Definition emu_memmap.h:40
@ k_ns_sdram_base
Non-secure SDRAM alias.
Definition emu_memmap.h:50
@ k_sdram_end
External SDRAM end.
Definition emu_memmap.h:48
bool emu_memmap_detach(emu_memmap_workspace_t *workspace, uc_engine *uc)
Remove one engine binding before closing that Unicorn engine.
Definition emu_memmap.c:486
bool emu_memmap_close(emu_memmap_workspace_t *workspace)
Release every host aperture mapping after all engines detached.
Definition emu_memmap.c:500
uint64_t emu_memmap_mram_base(void)
Return the MRAM boot-vector base.
Definition emu_memmap.c:523
const mem_region_t * emu_memmap_regions(uint32_t *count)
Return the static emulated memory-region table.
Definition emu_memmap.c:516
Central first-party Unicorn memory access seam.
Annotation-attribute framework macros for ra8-firmware.
One owned host aperture mapping.
Definition emu_memmap.h:77
uint8_t * host
Page-aligned host mapping, or nullptr.
Definition emu_memmap.h:78
uint64_t size
Exact logical byte length.
Definition emu_memmap.h:79
One caller-owned association between a Unicorn engine and backing.
Definition emu_memmap.h:83
bool active
Binding occupies this slot and must be undone.
Definition emu_memmap.h:85
uc_engine * uc
Bound Unicorn engine.
Definition emu_memmap.h:84
Exact requirements and operation outcome.
Definition emu_memmap.h:70
int os_error
Captured errno for host mapping.
Definition emu_memmap.h:73
uint64_t logical_backing_bytes
Sum of the three aperture lengths.
Definition emu_memmap.h:72
emu_memmap_status_t status
Semantic completion status.
Definition emu_memmap.h:71
Independent aperture backing with at most two engine bindings.
Definition emu_memmap.h:89
emu_memmap_binding_t bindings[k_emu_memmap_binding_count]
Active Unicorn engine views.
Definition emu_memmap.h:93
bool open
Whether the host mappings are owned.
Definition emu_memmap.h:95
emu_memmap_backing_t backings[k_emu_memmap_backing_count]
Owned host aperture mappings.
Definition emu_memmap.h:91
One emulated memory-region table row.
Definition emu_memmap.h:29
const char * name
Human-readable region name.
Definition emu_memmap.h:30
uint64_t size
Region byte length.
Definition emu_memmap.h:32
uint64_t base
Guest base address.
Definition emu_memmap.h:31