summaryrefslogtreecommitdiffstats
path: root/hw/loader.h
diff options
context:
space:
mode:
authorFabien Chouteau2013-02-19 05:41:11 +0100
committerAlexander Graf2013-03-08 21:04:52 +0100
commitd60fa42e8bae39440f997ebfe8fe328269a57d16 (patch)
tree23e40a2deb58d4dac1c90bb75d3b5e3660746dd9 /hw/loader.h
parentpseries: Implement h_read hcall (diff)
downloadqemu-d60fa42e8bae39440f997ebfe8fe328269a57d16.tar.gz
qemu-d60fa42e8bae39440f997ebfe8fe328269a57d16.tar.xz
qemu-d60fa42e8bae39440f997ebfe8fe328269a57d16.zip
Save memory allocation in the elf loader
The current elf loader uses too much memory. For example, I have a executable with a bss section of 400 MB and I set the ram size to 512 MB. Qemu uses about 780MB of RAM (which is fine), but there's a peak at 1.6 GB during initialization (this is not fine). This patch fixes two things: 1) do not allocate each elf program twice. 2) do not allocate memory for areas that are only zeros. For this we need a new field in Rom: "datasize" which is the size of the allocated data. If datasize is less than romsize, it means that the area from datasize to romsize is filled with zeros. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/loader.h')
-rw-r--r--hw/loader.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/loader.h b/hw/loader.h
index 5e61c95b84..0958f06934 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -27,6 +27,8 @@ int rom_add_file(const char *file, const char *fw_dir,
hwaddr addr, int32_t bootindex);
int rom_add_blob(const char *name, const void *blob, size_t len,
hwaddr addr);
+int rom_add_elf_program(const char *name, void *data, size_t datasize,
+ size_t romsize, hwaddr addr);
int rom_load_all(void);
void rom_set_fw(void *f);
int rom_copy(uint8_t *dest, hwaddr addr, size_t size);