The current model of loader copy "rom blobs" and kept in memory until a reset occurs and waste host memory.
This serial of patches set uimage/initrd/vmlinux as reloadable images and use private reset handlers to load these images from hard disk on reset, which could make loader framework more dynamic and reduce the memory consumption of QEMU process. Olivia Yin (4): use image_file_reset to reload initrd use uimage_reset to reload uImage use elf_reset to reload elf image use info images to check images which could br reloaded on reset hw/elf_ops.h | 45 +++++++++++++++-- hw/loader.c | 136 +++++++++++++++++++++++++++++++++++++++++++++------- hw/loader.h | 41 ++++++++++++++-- hw/ppc/e500.c | 2 +- hw/ppc440_bamboo.c | 2 +- monitor.c | 7 +++ 6 files changed, 204 insertions(+), 29 deletions(-) v9: patch 4/4: set uimage/initrd/vmlinux as reloadable and free them on rom_reset; use 'info images' to display the information of reloadable images For example, (qemu) info images load_addr=0000000000000000 size=0x07cac80 type=UIMAGE file="uImage" load_addr=0000000002000000 size=0x188e844 type=FLAT file="ramdisk" (qemu) info images load_addr=0000000000000000 size=0x0709a0c type=FLAT file="vmlinux" load_addr=0000000002000000 size=0x188e844 type=FLAT file="ramdisk" v8: unify the structure ImageFile for uimage/initrd/vmlinux, and remove rom_reset(). v7: clean structure ImageFile v6: patch 3/4: load symbol only when startup v5: patch 2/4: remove global variables is_linux and kernel_loaded. patch 3/4: register reset handlers in loader.c for elf images. extract the duplicated source code into function elf_phy_loader(). patch 4/4: fix the issue of memory increasing (about 1.4MB) once reload elf image. v4: fix elf reload and register reset handler in hw/elf_ops.h v3: reload elf v2: Rename target_phys_addr_t to hwaddr v1: support uimage/initrd reload