mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hostmem: allow preallocation of any memory region
And allow preallocation of file-based memory even without -mem-prealloc. Some care is necessary because -mem-prealloc does not allow disabling preallocation for hostmem-file. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
605d0a945d
commit
a35ba7be4b
7 changed files with 75 additions and 0 deletions
11
memory.c
11
memory.c
|
@ -1271,6 +1271,17 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,
|
|||
cpu_physical_memory_reset_dirty(mr->ram_addr + addr, size, client);
|
||||
}
|
||||
|
||||
int memory_region_get_fd(MemoryRegion *mr)
|
||||
{
|
||||
if (mr->alias) {
|
||||
return memory_region_get_fd(mr->alias);
|
||||
}
|
||||
|
||||
assert(mr->terminates);
|
||||
|
||||
return qemu_get_ram_fd(mr->ram_addr & TARGET_PAGE_MASK);
|
||||
}
|
||||
|
||||
void *memory_region_get_ram_ptr(MemoryRegion *mr)
|
||||
{
|
||||
if (mr->alias) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue