#include "temu-c/Support/Memory.h"
#include "temu-c/Support/Objsys.h"
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
|
| TEMU_IFACE_REFERENCE_TYPE (temu_MemAccess) |
|
| TEMU_IFACE_REFERENCE_TYPE (temu_Memory) |
|
int | temu_mapMemorySpace (void *Obj, uint64_t Addr, uint64_t Len, temu_Object_ *MemObj) |
|
int | temu_mapMemorySpaceFlags (void *Obj, uint64_t Addr, uint64_t Len, temu_Object_ *MemObj, uint32_t Flags) |
|
void | temu_setMemAttr (void *Obj, uint64_t Addr, uint64_t Len, temu_MemoryAttr Attr) |
|
void | temu_clearMemAttr (void *Obj, uint64_t Addr, uint64_t Len, temu_MemoryAttr Attr) |
|
int | temu_memoryExchangeTransaction (void *Obj, temu_MemTransaction *MT) |
|
int | temu_memoryWriteTransaction (void *Obj, temu_MemTransaction *MT) |
|
int | temu_memoryReadTransaction (void *Obj, temu_MemTransaction *MT) |
|
int | temu_memoryFetchTransaction (void *Obj, temu_MemTransaction *MT) |
|
◆ TEMU_MEM_ACCESS_CAP_E16
#define TEMU_MEM_ACCESS_CAP_E16 (1 << (1 + 12)) |
◆ TEMU_MEM_ACCESS_CAP_E32
#define TEMU_MEM_ACCESS_CAP_E32 (1 << (2 + 12)) |
◆ TEMU_MEM_ACCESS_CAP_E64
#define TEMU_MEM_ACCESS_CAP_E64 (1 << (3 + 12)) |
◆ TEMU_MEM_ACCESS_CAP_E8
#define TEMU_MEM_ACCESS_CAP_E8 (1 << (0 + 12)) |
◆ TEMU_MEM_ACCESS_CAP_E_ALL
#define TEMU_MEM_ACCESS_CAP_E_ALL (0xf << 12) |
◆ TEMU_MEM_ACCESS_CAP_F16
#define TEMU_MEM_ACCESS_CAP_F16 (1 << 1) |
◆ TEMU_MEM_ACCESS_CAP_F32
#define TEMU_MEM_ACCESS_CAP_F32 (1 << 2) |
◆ TEMU_MEM_ACCESS_CAP_F64
#define TEMU_MEM_ACCESS_CAP_F64 (1 << 3) |
◆ TEMU_MEM_ACCESS_CAP_F8
#define TEMU_MEM_ACCESS_CAP_F8 (1 << 0) |
◆ TEMU_MEM_ACCESS_CAP_F_ALL
#define TEMU_MEM_ACCESS_CAP_F_ALL (0xf) |
◆ TEMU_MEM_ACCESS_CAP_R16
#define TEMU_MEM_ACCESS_CAP_R16 (1 << (1 + 4)) |
◆ TEMU_MEM_ACCESS_CAP_R32
#define TEMU_MEM_ACCESS_CAP_R32 (1 << (2 + 4)) |
◆ TEMU_MEM_ACCESS_CAP_R64
#define TEMU_MEM_ACCESS_CAP_R64 (1 << (3 + 4)) |
◆ TEMU_MEM_ACCESS_CAP_R8
#define TEMU_MEM_ACCESS_CAP_R8 (1 << (0 + 4)) |
◆ TEMU_MEM_ACCESS_CAP_R_ALL
#define TEMU_MEM_ACCESS_CAP_R_ALL (0xf << 4) |
◆ TEMU_MEM_ACCESS_CAP_W16
#define TEMU_MEM_ACCESS_CAP_W16 (1 << (1 + 8)) |
◆ TEMU_MEM_ACCESS_CAP_W32
#define TEMU_MEM_ACCESS_CAP_W32 (1 << (2 + 8)) |
◆ TEMU_MEM_ACCESS_CAP_W64
#define TEMU_MEM_ACCESS_CAP_W64 (1 << (3 + 8)) |
◆ TEMU_MEM_ACCESS_CAP_W8
#define TEMU_MEM_ACCESS_CAP_W8 (1 << (0 + 8)) |
◆ TEMU_MEM_ACCESS_CAP_W_ALL
#define TEMU_MEM_ACCESS_CAP_W_ALL (0xf << 8) |
◆ TEMU_MEM_ACCESS_IFACE_TYPE
#define TEMU_MEM_ACCESS_IFACE_TYPE "MemAccessIface" |
◆ TEMU_MEMORY_IFACE_TYPE
#define TEMU_MEMORY_IFACE_TYPE "MemoryIface" |
◆ TEMU_MT_ALLOC_IR
#define TEMU_MT_ALLOC_IR (1 << 20) |
◆ TEMU_MT_BIG_ENDIAN
#define TEMU_MT_BIG_ENDIAN (0 << 10) |
◆ TEMU_MT_BYPASS_CACHE
#define TEMU_MT_BYPASS_CACHE (1 << 1) |
◆ TEMU_MT_BYPASS_PROT
#define TEMU_MT_BYPASS_PROT (1 << 14) |
◆ TEMU_MT_CACHE_HIT
#define TEMU_MT_CACHE_HIT (1 << 4) |
◆ TEMU_MT_CACHEABLE
#define TEMU_MT_CACHEABLE 1 |
◆ TEMU_MT_CHECK_FETCH_ATTRIBS
#define TEMU_MT_CHECK_FETCH_ATTRIBS (1 << 19) |
◆ TEMU_MT_ENDIAN_BIT
#define TEMU_MT_ENDIAN_BIT 10 |
◆ TEMU_MT_FAILED
#define TEMU_MT_FAILED (1 << 3) |
◆ TEMU_MT_FORCE_CACHE_MISS
#define TEMU_MT_FORCE_CACHE_MISS (1 << 2) |
◆ TEMU_MT_FORCE_REBIND
#define TEMU_MT_FORCE_REBIND (1 << 21) |
◆ TEMU_MT_GET_ISA
#define TEMU_MT_GET_ISA |
( |
|
flags | ) |
((flags >> 11) & 7) |
◆ TEMU_MT_ISA_0
#define TEMU_MT_ISA_0 (0 << 11) |
◆ TEMU_MT_ISA_1
#define TEMU_MT_ISA_1 (1 << 11) |
◆ TEMU_MT_ISA_2
#define TEMU_MT_ISA_2 (2 << 11) |
◆ TEMU_MT_LITTLE_ENDIAN
#define TEMU_MT_LITTLE_ENDIAN (1 << 10) |
◆ TEMU_MT_LOCK_ACQUIRE
#define TEMU_MT_LOCK_ACQUIRE (1 << 17) |
◆ TEMU_MT_LOCK_ACQUIRE_AND_RELEASE
#define TEMU_MT_LOCK_ACQUIRE_AND_RELEASE (3 << 17) |
◆ TEMU_MT_LOCK_RELEASE
#define TEMU_MT_LOCK_RELEASE (1 << 18) |
◆ TEMU_MT_PRIV_HYPER
#define TEMU_MT_PRIV_HYPER (2 << 5) |
◆ TEMU_MT_PRIV_MASK
#define TEMU_MT_PRIV_MASK (7 << 5) |
◆ TEMU_MT_PRIV_SHIFT
#define TEMU_MT_PRIV_SHIFT (5) |
◆ TEMU_MT_PRIV_SUPER
#define TEMU_MT_PRIV_SUPER (1 << 5) |
◆ TEMU_MT_PRIV_USER
#define TEMU_MT_PRIV_USER (0 << 5) |
◆ TEMU_MT_PROBE
#define TEMU_MT_PROBE (1 << 8) |
◆ TEMU_MT_PROF_ACCESS
#define TEMU_MT_PROF_ACCESS (1 << 13) |
◆ TEMU_MT_PROF_ACCESS_BIT
#define TEMU_MT_PROF_ACCESS_BIT 13 |
◆ TEMU_MT_READ
#define TEMU_MT_READ (1 << 15) |
◆ TEMU_MT_SELF_MODIFYING
#define TEMU_MT_SELF_MODIFYING (1 << 9) |
◆ TEMU_MT_WRITE
#define TEMU_MT_WRITE (1 << 16) |
◆ temu_MemoryIface
For objects which have actualm 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 size argument is in bytes.
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
readBytes and writeBytes should return the number of bytes read / written or negative on error.
◆ temu_MemTransaction
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.
◆ temu_InitiatorType
Enumerator |
---|
teIT_Cpu | Memory transaction initiated by CPU.
|
teIT_Device | Memory transaction initiated by device.
|
teIT_Unknown | Memory transaction initiator unknown.
|
◆ temu_MemoryEndianness
Enumerator |
---|
teME_BigEndian | Memory access interface in big endian.
|
teME_LittleEndian | Memory access interface in little endian.
|
teME_UnspecifiedEndian | Memory access interface in undefined endian.
|
◆ temu_clearMemAttr()
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() [1/2]
TEMU_IFACE_REFERENCE_TYPE |
( |
temu_MemAccess |
| ) |
|
◆ TEMU_IFACE_REFERENCE_TYPE() [2/2]
TEMU_IFACE_REFERENCE_TYPE |
( |
temu_Memory |
| ) |
|
◆ temu_mapMemorySpace()
int temu_mapMemorySpace |
( |
void * |
Obj, |
|
|
uint64_t |
Addr, |
|
|
uint64_t |
Len, |
|
|
temu_Object_ * |
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 |
- Returns
- Zero on success, other values indicates that the mapping failed
◆ temu_mapMemorySpaceFlags()
int temu_mapMemorySpaceFlags |
( |
void * |
Obj, |
|
|
uint64_t |
Addr, |
|
|
uint64_t |
Len, |
|
|
temu_Object_ * |
MemObj, |
|
|
uint32_t |
Flags |
|
) |
| |
Map memory object into address space with flags
- 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 |
Flags | Sticky flags for memory accesses to that object (e.g. cachable) |
- Returns
- Zero on success, other values indicates that the mapping failed
◆ temu_memoryExchangeTransaction()
◆ temu_memoryFetchTransaction()
◆ temu_memoryReadTransaction()
◆ temu_memoryWriteTransaction()
◆ temu_setMemAttr()
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. |