* optimize ram block handling Save the last element of the ram_list. This allows to faster find where to add new elements when they are not bigger then page size. * save ram_list freed this keeps the optimization for find_ram_offset() intact after snapshot restore. * cow only clear the tlb of affected pages * update flatview when possible Building each flatview new when the memory has changed is quite expensive when many MemoryRegions are used. This is an issue when using snapshots. * update benchmark for new api * save flatview in context this avoids rebuilding the flatview when restore a context. * init context flatview with zero * address_space_dispatch_clear remove subpage with higher priority * docutemnt the options for UC_CTL_CONTEXT_MODE Specialy stress that with UC_CTL_CONTEXT_MEMORY it is not possible to use the context with a different unicorn object.
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
/* By Dang Hoang Vu <dang.hvu -at- gmail.com>, 2015 */
|
|
/* Modified for Unicorn Engine by Chen Huitao<chenhuitao@hfmrit.com>, 2020 */
|
|
|
|
#ifndef UC_QEMU_H
|
|
#define UC_QEMU_H
|
|
|
|
struct uc_struct;
|
|
|
|
#define OPC_BUF_SIZE 640
|
|
|
|
#include "sysemu/sysemu.h"
|
|
#include "sysemu/cpus.h"
|
|
#include "exec/cpu-common.h"
|
|
#include "exec/memory.h"
|
|
|
|
#include "qemu/thread.h"
|
|
#include "hw/core/cpu.h"
|
|
|
|
#include "vl.h"
|
|
|
|
// This struct is originally from qemu/include/exec/ramblock.h
|
|
// Temporarily moved here since there is circular inclusion.
|
|
struct RAMBlock {
|
|
struct MemoryRegion *mr;
|
|
uint8_t *host;
|
|
ram_addr_t offset;
|
|
ram_addr_t used_length;
|
|
ram_addr_t max_length;
|
|
uint32_t flags;
|
|
/* RCU-enabled, writes protected by the ramlist lock */
|
|
QLIST_ENTRY(RAMBlock) next;
|
|
size_t page_size;
|
|
};
|
|
|
|
typedef struct {
|
|
MemoryRegion *mr;
|
|
void *buffer;
|
|
hwaddr addr;
|
|
hwaddr len;
|
|
} BounceBuffer;
|
|
|
|
// This struct is originally from qemu/include/exec/ramlist.h
|
|
typedef struct RAMList {
|
|
bool freed;
|
|
RAMBlock *mru_block;
|
|
RAMBlock *last_block;
|
|
QLIST_HEAD(, RAMBlock) blocks;
|
|
} RAMList;
|
|
|
|
#endif
|