|
libmicroemu 0.2.0
ARM Microcontroller Emulator Library
|
Represents the main emulation machine for handling microcontroller emulation. More...
#include <machine.h>
Public Member Functions | |
| Machine () noexcept | |
| ~Machine () noexcept | |
| StatusCode | Load (const char *elf_file, bool set_entry_point=false) noexcept |
| Loads an ELF file into memory and optionally sets the entry point. | |
| StatusCode | Reset () noexcept |
| ExecResult | Exec (i64 max_instructions=-1, FPreExecStepCallback cb_pre_exec=nullptr, FPostExecStepCallback cb_post_exec=nullptr) noexcept |
| Executes the loaded program. | |
| void | SetFlashSegment (u8 *seg_ptr, me_size_t seg_size, me_adr_t seg_vadr) noexcept |
| Sets the Flash segment The flash segment is where a microcontroller stores its program code. A flash segment is read-only. | |
| void | SetRam1Segment (u8 *seg_ptr, me_size_t seg_size, me_adr_t seg_vadr) noexcept |
| Sets the RAM1 segment The RAM1 segment is where a microcontroller stores its data. A RAM1 segment is read-write. | |
| void | SetRam2Segment (u8 *seg_ptr, me_size_t seg_size, me_adr_t seg_vadr) noexcept |
| Sets the RAM2 segment The RAM2 segment is were a microcontroller stores its data. A RAM2 segment is read-write. | |
| void | EvaluateState (FStateCallback cb) noexcept |
| Evaluates the state of the processor This function evaluates the state of the processor by calling a function which gives access to the registers and special registers. | |
| std::string_view | GetVersion () noexcept |
| Gets the version of the library. | |
Static Public Member Functions | |
| static void | RegisterLoggerCallback (void(*callback)(libmicroemu::LogLevel level, const char *,...) noexcept) noexcept |
Represents the main emulation machine for handling microcontroller emulation.
The Machine class is responsible for loading ELF files, setting up memory segments, executing programs, and evaluating the processor state. It provides various utilities to configure and control the emulation process.
|
noexcept |
Constructor
|
noexcept |
Deconstructor
|
noexcept |
Evaluates the state of the processor This function evaluates the state of the processor by calling a function which gives access to the registers and special registers.
| cb | Callback function to evaluate the state |
|
noexcept |
Executes the loaded program.
| max_instructions | Maximum number of instructions to execute. -1 means infinite |
| cb_pre_exec | Callback function to be called before each instruction is executed |
| cb_post_exec | Callback function to be called after each instruction is executed |
|
noexcept |
Gets the version of the library.
|
noexcept |
Loads an ELF file into memory and optionally sets the entry point.
Initializes memory, reads the ELF file, and loads its segments into appropriate memory regions. Optionally sets the entry point for execution.
| elf_file | Path to the ELF file. |
| set_entry_point | Whether to set the entry point in the emulator. |
|
noexcept |
Sets the Flash segment The flash segment is where a microcontroller stores its program code. A flash segment is read-only.
| seg_ptr | Pointer to the flash segment |
| seg_size | Size of the flash segment |
| seg_vadr | Virtual address of the flash segment |
|
noexcept |
Sets the RAM1 segment The RAM1 segment is where a microcontroller stores its data. A RAM1 segment is read-write.
| seg_ptr | Pointer to the RAM1 segment |
| seg_size | Size of the RAM1 segment |
| seg_vadr | Virtual address of the RAM1 segment |
|
noexcept |
Sets the RAM2 segment The RAM2 segment is were a microcontroller stores its data. A RAM2 segment is read-write.
| seg_ptr | Pointer to the RAM2 segment |
| seg_size | Size of the RAM2 segment |
| seg_vadr | Virtual address of the RAM2 segment |