Add a dtb_size output parameter to load_dtb() so that we can find out what its memory footprint is.
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- hw/arm/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index e32f2f415885..c103a8fdc941 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -312,7 +312,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info) } } -static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) +static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, + uint32_t *dtb_size) { void *fdt = NULL; int size, rc; @@ -340,6 +341,9 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) goto fail; } } + if (dtb_size != NULL) { + *dtb_size = size; + } acells = qemu_fdt_getprop_cell(fdt, "/", "#address-cells"); scells = qemu_fdt_getprop_cell(fdt, "/", "#size-cells"); @@ -569,7 +573,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) */ hwaddr dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size, 4096); - if (load_dtb(dtb_start, info)) { + if (load_dtb(dtb_start, info, NULL)) { exit(1); } fixupcontext[FIXUP_ARGPTR] = dtb_start; -- 1.8.3.2