提交 7bd4f430 编写于 作者: P Paolo Bonzini 提交者: Michael S. Tsirkin

memory: move RAM_PREALLOC_MASK to exec.c, rename

Prepare for adding more flags.  The "_MASK" suffix is unique, kill it.
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 38183310
...@@ -70,6 +70,9 @@ AddressSpace address_space_memory; ...@@ -70,6 +70,9 @@ AddressSpace address_space_memory;
MemoryRegion io_mem_rom, io_mem_notdirty; MemoryRegion io_mem_rom, io_mem_notdirty;
static MemoryRegion io_mem_unassigned; static MemoryRegion io_mem_unassigned;
/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
#define RAM_PREALLOC (1 << 0)
#endif #endif
struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
...@@ -1325,7 +1328,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, ...@@ -1325,7 +1328,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
new_block->fd = -1; new_block->fd = -1;
new_block->host = host; new_block->host = host;
if (host) { if (host) {
new_block->flags |= RAM_PREALLOC_MASK; new_block->flags |= RAM_PREALLOC;
} }
return ram_block_add(new_block); return ram_block_add(new_block);
} }
...@@ -1364,7 +1367,7 @@ void qemu_ram_free(ram_addr_t addr) ...@@ -1364,7 +1367,7 @@ void qemu_ram_free(ram_addr_t addr)
QTAILQ_REMOVE(&ram_list.blocks, block, next); QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL; ram_list.mru_block = NULL;
ram_list.version++; ram_list.version++;
if (block->flags & RAM_PREALLOC_MASK) { if (block->flags & RAM_PREALLOC) {
; ;
} else if (xen_enabled()) { } else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host); xen_invalidate_map_cache_entry(block->host);
...@@ -1396,7 +1399,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) ...@@ -1396,7 +1399,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
offset = addr - block->offset; offset = addr - block->offset;
if (offset < block->length) { if (offset < block->length) {
vaddr = block->host + offset; vaddr = block->host + offset;
if (block->flags & RAM_PREALLOC_MASK) { if (block->flags & RAM_PREALLOC) {
; ;
} else if (xen_enabled()) { } else if (xen_enabled()) {
abort(); abort();
......
...@@ -297,9 +297,6 @@ CPUArchState *cpu_copy(CPUArchState *env); ...@@ -297,9 +297,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
/* memory API */ /* memory API */
/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
#define RAM_PREALLOC_MASK (1 << 0)
typedef struct RAMBlock { typedef struct RAMBlock {
struct MemoryRegion *mr; struct MemoryRegion *mr;
uint8_t *host; uint8_t *host;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册