mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 20:19:44 +00:00
b07c59f7c8
env->sps contains page size encoding information as an embedded structure. Since this information is specific to 64-bit hash MMUs, split it out into a separately allocated structure, to reduce the basic env size for other cpus. Along the way we make a few other cleanups: * Rename to PPCHash64Options which is more in line with qemu name conventions, and reflects that we're going to merge some more hash64 mmu specific details in there in future. Also rename its substructures to match qemu conventions. * Move structure definitions to the mmu-hash64.[ch] files. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/*
|
|
* QEMU PowerPC helper routines for the device tree.
|
|
*
|
|
* Copyright (C) 2016 IBM Corp.
|
|
*
|
|
* This code is licensed under the GPL version 2 or later. See the
|
|
* COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "target/ppc/cpu.h"
|
|
#include "target/ppc/mmu-hash64.h"
|
|
|
|
#include "hw/ppc/fdt.h"
|
|
|
|
#if defined(TARGET_PPC64)
|
|
size_t ppc_create_page_sizes_prop(PowerPCCPU *cpu, uint32_t *prop,
|
|
size_t maxsize)
|
|
{
|
|
size_t maxcells = maxsize / sizeof(uint32_t);
|
|
int i, j, count;
|
|
uint32_t *p = prop;
|
|
|
|
for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {
|
|
PPCHash64SegmentPageSizes *sps = &cpu->hash64_opts->sps[i];
|
|
|
|
if (!sps->page_shift) {
|
|
break;
|
|
}
|
|
for (count = 0; count < PPC_PAGE_SIZES_MAX_SZ; count++) {
|
|
if (sps->enc[count].page_shift == 0) {
|
|
break;
|
|
}
|
|
}
|
|
if ((p - prop) >= (maxcells - 3 - count * 2)) {
|
|
break;
|
|
}
|
|
*(p++) = cpu_to_be32(sps->page_shift);
|
|
*(p++) = cpu_to_be32(sps->slb_enc);
|
|
*(p++) = cpu_to_be32(count);
|
|
for (j = 0; j < count; j++) {
|
|
*(p++) = cpu_to_be32(sps->enc[j].page_shift);
|
|
*(p++) = cpu_to_be32(sps->enc[j].pte_enc);
|
|
}
|
|
}
|
|
|
|
return (p - prop) * sizeof(uint32_t);
|
|
}
|
|
#endif
|