direct_memory_flush direct_memory_lookup_v2
API Reference Manual  /  5 Model-to-Simulator Interfaces  / 

direct_memory_lookup

Description

The direct_memory_lookup interface is implemented by Simics memory-spaces. The interface is used by simulator objects that want to do fast accesses to memory and/or want to build up a cached representation of memory. These objects are referred to as memory users, e.g., processors. Fast accesses are done via host pointers to simulated memory. The direct_memory_lookup interface is used in conjunction with the direct_memory interface which is implemented by objects that own the actual data storage, e.g., RAM/ROM objects. These objects are called direct-memory objects.

To access data, a memory-user object first calls the lookup method on the memory space obj. The requester is the memory-user doing the lookup. The lookup method traces the range specified by addr and size through memory spaces and translators until a direct-memory object is reached. The direct-memory object is returned in the target field and the offset into this object corresponding to addr is returned in the offs field.

The call to lookup fails if the specified range does not map continuously to a direct-memory object. A lookup failure is indicated by returning NULL in the target field.

The access argument is a bit field of at least one access_t value specifying what kind of accesses the memory user is interested in. All specified access types must reach the same direct-memory object and range for the lookup to succeed. If the memory space, for example, redirects reads and writes to different memory ranges or direct-memory objects, a lookup would fail if access specified both read and write. Note that the actual access permissions needed to access the real data must be requested from the direct-memory object using the request method of the direct_memory interface. The access argument is only used to locate the direct-memory object.

The return field access contains at least the access bits requested used in the lookup request, but may as an optimization contain a superset, indicating that the lookup result is valid for this superset. However, there is no guarantee that this optimization takes place.

Once a direct-memory object has been found, the direct_memory interface can be used to obtain a direct pointer to the contents of the direct-memory object.

The tracers and breakpoints fields in the return value contain information about installed tracers and breakpoints that intersect the range. Examples of tracers are timing models and snoop objects. In order to trigger breakpoints and invoke any tracers, the memory user should perform memory operations using the memory_space interface. Only breakpoints and tracers that overlap (binary and) with the provided access argument need to be considered.

typedef struct {
        conf_object_t     *target;
        uint64             offs;

        access_t           breakpoints;      // conflicting breakpoints
        access_t           tracers;          // conflicting tracers
        access_t           access;           // handle valid for access
} direct_memory_lookup_t;

SIM_INTERFACE(direct_memory_lookup) {
        direct_memory_lookup_t (*lookup)(conf_object_t *NOTNULL obj,
                                         conf_object_t *requester,
                                         physical_address_t addr,
                                         unsigned size,
                                         access_t access);
};

#define DIRECT_MEMORY_LOOKUP_INTERFACE "direct_memory_lookup"

The direct_memory_lookup and direct_memory interfaces replace the memory_page interface of Simics 4.8.

Execution Context
Cell Context for all methods.

direct_memory_flush direct_memory_lookup_v2