ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
emu_engine.h
Go to the documentation of this file.
1
20
21#pragma once
22
23#include <stdint.h>
24#include <unicorn/unicorn.h>
25
26#include "emu_memory_access.h"
27#include "ra8_attributes.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
48extern const int k_arm_reg_id[16];
49
67static inline uint32_t rd32(uc_engine* uc, uint64_t addr)
68{
69 uint32_t v = 0U;
70 (void)emu_mem_read(uc, addr, &v, sizeof(v));
71 return v;
72}
73
91static inline void wr32(uc_engine* uc, uint64_t addr, uint32_t v)
92{
93 (void)emu_mem_write(uc, addr, &v, sizeof(v));
94}
95
113static inline uint32_t reg_get(uc_engine* uc, int reg)
114{
115 uint32_t v = 0U;
116 (void)uc_reg_read(uc, reg, &v);
117 return v;
118}
119
137static inline void reg_set(uc_engine* uc, int reg, uint32_t v)
138{
139 (void)uc_reg_write(uc, reg, &v);
140}
141
161
179bool emu_seam_take_relaunch(void);
180
181#ifdef __cplusplus
182}
183#endif
static uint32_t reg_get(uc_engine *uc, int reg)
Read a Unicorn 32-bit register by its UC_ARM_REG_* id.
Definition emu_engine.h:113
void emu_seam_request_relaunch(void)
Mark the pending engine stop as a zero-time seam relaunch.
Definition emu_engine.c:52
static uint32_t rd32(uc_engine *uc, uint64_t addr)
Read a 32-bit little-endian word from emulated memory.
Definition emu_engine.h:67
const int k_arm_reg_id[16]
ARM register index (0..15) -> Unicorn register id.
Definition emu_engine.c:17
bool emu_seam_take_relaunch(void)
Consume the zero-time seam-relaunch latch.
Definition emu_engine.c:58
static void wr32(uc_engine *uc, uint64_t addr, uint32_t v)
Write a 32-bit little-endian word to emulated memory.
Definition emu_engine.h:91
static void reg_set(uc_engine *uc, int reg, uint32_t v)
Write a Unicorn 32-bit register by its UC_ARM_REG_* id.
Definition emu_engine.h:137
Central first-party Unicorn memory access seam.
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.
Annotation-attribute framework macros for ra8-firmware.