mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-04-17 14:51:50 +00:00
exec.c: subpage->sub_section is already initialized to 0
In subpage_init(), we will set subpage->sub_section to PHYS_SECTION_UNASSIGNED by subpage_register. Since PHYS_SECTION_UNASSIGNED is defined to be 0, and we allocate subpage with g_malloc0, this means subpage->sub_section is already initialized to 0. This patch removes the redundant setup for a new subpage and also fix the code style. Backports commit b797ab1a15ba8d2b2fc4ec3e1f24d755f6855d05 from qemu
This commit is contained in:
parent
ef3cf096e7
commit
2e55ddd339
10
qemu/exec.c
10
qemu/exec.c
|
@ -1002,8 +1002,8 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,
|
|||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
||||
static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
|
||||
uint16_t section);
|
||||
static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,
|
||||
uint16_t section);
|
||||
static subpage_t *subpage_init(FlatView *fv, hwaddr base);
|
||||
|
||||
static void *(*phys_mem_alloc)(size_t size, uint64_t *align) =
|
||||
|
@ -1674,8 +1674,8 @@ static const MemoryRegionOps subpage_ops = {
|
|||
}
|
||||
};
|
||||
|
||||
static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
|
||||
uint16_t section)
|
||||
static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,
|
||||
uint16_t section)
|
||||
{
|
||||
int idx, eidx;
|
||||
|
||||
|
@ -1745,6 +1745,7 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base)
|
|||
AddressSpaceDispatch *d = flatview_to_dispatch(fv);
|
||||
subpage_t *mmio;
|
||||
|
||||
/* mmio->sub_section is set to PHYS_SECTION_UNASSIGNED with g_malloc0 */
|
||||
mmio = g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint16_t));
|
||||
|
||||
mmio->fv = fv;
|
||||
|
@ -1756,7 +1757,6 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base)
|
|||
printf("%s: %p base " TARGET_FMT_plx " len %08x\n", __func__,
|
||||
mmio, base, TARGET_PAGE_SIZE);
|
||||
#endif
|
||||
subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, PHYS_SECTION_UNASSIGNED);
|
||||
|
||||
return mmio;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue