#include "temu-c/Support/Objsys.h"
#include <stdint.h>
Go to the source code of this file.
#define TEMU_MT_BYPASS_CACHE (1 << 1) |
#define TEMU_MT_CACHEABLE 1 |
#define TEMU_MT_FORCE_CACHE_MISS (1 << 2) |
Memory access interface implemented by all memory mapped devices Exposed to the emulator core by a memory object.
For objects which have actual memory (not just registers) This is for the simulator (not the emu core). The procedures should write the data given in bytes to the given physical offset. The offset is a 64 bit uint to support 64 bit targets. The interface is used for example by DMA transactions.
The swap argument is used to swap bytes to the host endianess. Specify the log size of the read data types. 0: We are reading bytes (bytes will be in target memory order) 1: We are reading half words (will be swapped to host order) 2: We are reading words (will be swapped) 3: We are reading double words (will be swapped) With 0 for swap, we are basically reading a byte array
Standard interface for memory space objects
Users should not implement their own memory spaces. No stability guarantees are made about this interface at the moment.
Generic memory transaction.
This type is kept in sync with the emulator core. The layout is guaranteed. and will remain as is, although more fields may be added (at the bottom).
When the emulator core issues a memory transaction (assuming no ATC hit), the core allocates this structure on the stack and fills in some of the fields with default values. The memory transaction is passed by pointer or reference. By filling in the different fields you can adapt the result of the memory transaction.
Memory attribute enumeration.
The emulator provides 5 standard attributes, and 3 user defined ones. The attributes are set in the memory space (not the memory models), so it is possible to set a watch point on memory mapped devices. When an attribute is set on a page, that page will get a shadow attribute page (same size as the page), enabling attributes to be set on a per byte level.
Attributes are only checked on the address being accessed, the transaction size is not taken into account.
Enumerator |
---|
teMA_Break |
Breakpoint set.
|
teMA_WatchRead |
Read watchpoint set.
|
teMA_WatchWrite |
Write watchpoint set.
|
teMA_Upset |
Single event upset.
|
teMA_Faulty |
Multiple event upset / uncorrectable.
|
teMA_User1 |
User definable.
|
teMA_User2 |
User definable.
|
teMA_User3 |
User definable.
|
Definition at line 133 of file Memory.h.
Enumerator |
---|
teMK_RAM |
|
teMK_ROM |
|
teMK_MMIO |
|
Definition at line 20 of file Memory.h.
void temu_clearMemAttr |
( |
void * |
Obj, |
|
|
uint64_t |
Addr, |
|
|
uint64_t |
Len, |
|
|
temu_MemoryAttr |
Attr |
|
) |
| |
Clear attribute on memory space location
- Parameters
-
Obj | The memory space object |
Addr | Physical address where to map the device |
Len | Length in bytes of area where the attribute should be set. |
Attr | The attribute to clear. |
TEMU_IFACE_REFERENCE_TYPE |
( |
temu_MemAccess |
| ) |
|
TEMU_IFACE_REFERENCE_TYPE |
( |
temu_Memory |
| ) |
|
TEMU_IFACE_REFERENCE_TYPE |
( |
temu_MemoryMap |
| ) |
|
void temu_mapMemorySpace |
( |
void * |
Obj, |
|
|
uint64_t |
Addr, |
|
|
uint64_t |
Len, |
|
|
void * |
MemObj |
|
) |
| |
Map memory object into address space
- Parameters
-
Obj | The memory space object |
Addr | Physical address where to map the device |
Len | Length in bytes of area where the object is mapped. |
MemObj | The memory object. This object must correspond to the MemAccessIface |
void temu_setMemAttr |
( |
void * |
Obj, |
|
|
uint64_t |
Addr, |
|
|
uint64_t |
Len, |
|
|
temu_MemoryAttr |
Attr |
|
) |
| |
Set attribute on memory space location
- Parameters
-
Obj | The memory space object |
Addr | Physical address where to map the device |
Len | Length in bytes of area where the attribute should be set. |
Attr | The attribute to set. |