mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 05:21:10 +00:00
qemu_ram_block_by_name
Add a function to find a RAMBlock by name; use it in two of the places that already open code that loop; we've got another use later in postcopy. Backports commit e3dd74934f2d2c8c67083995928ff68e8c1d0030 from qemu
This commit is contained in:
parent
cc088f84b5
commit
60975685ce
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_aarch64
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_aarch64
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_aarch64
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_aarch64
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_aarch64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_aarch64
|
||||
#define qemu_ram_free qemu_ram_free_aarch64
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_aarch64eb
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_aarch64eb
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_aarch64eb
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_aarch64eb
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_aarch64eb
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_aarch64eb
|
||||
#define qemu_ram_free qemu_ram_free_aarch64eb
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_arm
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_arm
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_arm
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_arm
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_arm
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_arm
|
||||
#define qemu_ram_free qemu_ram_free_arm
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_armeb
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_armeb
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_armeb
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_armeb
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_armeb
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_armeb
|
||||
#define qemu_ram_free qemu_ram_free_armeb
|
||||
|
|
21
qemu/exec.c
21
qemu/exec.c
|
@ -1357,6 +1357,27 @@ found:
|
|||
return block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finds the named RAMBlock
|
||||
*
|
||||
* name: The name of RAMBlock to find
|
||||
*
|
||||
* Returns: RAMBlock (or NULL if not found)
|
||||
*/
|
||||
RAMBlock *qemu_ram_block_by_name(struct uc_struct* uc, const char *name)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
||||
// Unicorn: Changed from QLIST_FOREACH_RCU to QTAILQ_FOREACH
|
||||
QTAILQ_FOREACH(block, &uc->ram_list.blocks, next) {
|
||||
if (!strcmp(name, block->idstr)) {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Some of the softmmu routines need to translate from a host pointer
|
||||
(typically a TLB entry) back to a ram offset. */
|
||||
MemoryRegion *qemu_ram_addr_from_host(struct uc_struct* uc, void *ptr, ram_addr_t *ram_addr)
|
||||
|
|
|
@ -2442,6 +2442,7 @@ symbols = (
|
|||
'qemu_ram_alloc',
|
||||
'qemu_ram_alloc_from_ptr',
|
||||
'qemu_ram_alloc_resizeable',
|
||||
'qemu_ram_block_by_name',
|
||||
'qemu_ram_block_from_host',
|
||||
'qemu_ram_foreach_block',
|
||||
'qemu_ram_free',
|
||||
|
|
|
@ -49,6 +49,7 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);
|
|||
void qemu_ram_remap(struct uc_struct *uc, ram_addr_t addr, ram_addr_t length);
|
||||
/* This should not be used by devices. */
|
||||
MemoryRegion *qemu_ram_addr_from_host(struct uc_struct* uc, void *ptr, ram_addr_t *ram_addr);
|
||||
RAMBlock *qemu_ram_block_by_name(struct uc_struct* uc, const char *name);
|
||||
RAMBlock *qemu_ram_block_from_host(struct uc_struct* uc, void *ptr, bool round_offset,
|
||||
ram_addr_t *ram_addr, ram_addr_t *offset);
|
||||
void qemu_ram_set_idstr(struct uc_struct *uc, ram_addr_t addr, const char *name, DeviceState *dev);
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_m68k
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_m68k
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_m68k
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_m68k
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_m68k
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_m68k
|
||||
#define qemu_ram_free qemu_ram_free_m68k
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_mips
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_mips
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_mips
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_mips
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips
|
||||
#define qemu_ram_free qemu_ram_free_mips
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_mips64
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_mips64
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_mips64
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_mips64
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips64
|
||||
#define qemu_ram_free qemu_ram_free_mips64
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_mips64el
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_mips64el
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_mips64el
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_mips64el
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips64el
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips64el
|
||||
#define qemu_ram_free qemu_ram_free_mips64el
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_mipsel
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_mipsel
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_mipsel
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_mipsel
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mipsel
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mipsel
|
||||
#define qemu_ram_free qemu_ram_free_mipsel
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_powerpc
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_powerpc
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_powerpc
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_powerpc
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_powerpc
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_powerpc
|
||||
#define qemu_ram_free qemu_ram_free_powerpc
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_sparc
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_sparc
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_sparc
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_sparc
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_sparc
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_sparc
|
||||
#define qemu_ram_free qemu_ram_free_sparc
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_sparc64
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_sparc64
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_sparc64
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_sparc64
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_sparc64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_sparc64
|
||||
#define qemu_ram_free qemu_ram_free_sparc64
|
||||
|
|
|
@ -2436,6 +2436,7 @@
|
|||
#define qemu_ram_alloc qemu_ram_alloc_x86_64
|
||||
#define qemu_ram_alloc_from_ptr qemu_ram_alloc_from_ptr_x86_64
|
||||
#define qemu_ram_alloc_resizeable qemu_ram_alloc_resizeable_x86_64
|
||||
#define qemu_ram_block_by_name qemu_ram_block_by_name_x86_64
|
||||
#define qemu_ram_block_from_host qemu_ram_block_from_host_x86_64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_x86_64
|
||||
#define qemu_ram_free qemu_ram_free_x86_64
|
||||
|
|
Loading…
Reference in a new issue