mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
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>
This commit is contained in:
parent
6bbd5dde9a
commit
d60fa42e8b
3 changed files with 75 additions and 21 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue