mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-16 04:01:31 +00:00
elf: fix cache flushing in 'bootelf -p' command
Currently there are two problems in 'bootelf -p' (load elf by segments) command: - bss section is not flushed, so booted elf can have non zero values in bss; - at least on ARM there are 'CACHE: Misaligned operation at range...' warnings Use p_memsz instead of p_filesz during cache flushing for elf segment. p_filesz doesn't include zero initialized memory (e.g. bss section), which also should be flushed. Align these cache flushes to line boundaries. Signed-off-by: Kurban Mallachiev <mallachiev@ispras.ru>
This commit is contained in:
parent
eaba7df704
commit
957f51e863
1 changed files with 4 additions and 2 deletions
|
@ -53,7 +53,8 @@ static unsigned long load_elf64_image_phdr(unsigned long addr)
|
|||
if (phdr->p_filesz != phdr->p_memsz)
|
||||
memset(dst + phdr->p_filesz, 0x00,
|
||||
phdr->p_memsz - phdr->p_filesz);
|
||||
flush_cache((unsigned long)dst, phdr->p_filesz);
|
||||
flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN),
|
||||
roundup(phdr->p_memsz, ARCH_DMA_MINALIGN));
|
||||
++phdr;
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,8 @@ static unsigned long load_elf_image_phdr(unsigned long addr)
|
|||
if (phdr->p_filesz != phdr->p_memsz)
|
||||
memset(dst + phdr->p_filesz, 0x00,
|
||||
phdr->p_memsz - phdr->p_filesz);
|
||||
flush_cache((unsigned long)dst, phdr->p_filesz);
|
||||
flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN),
|
||||
roundup(phdr->p_memsz, ARCH_DMA_MINALIGN));
|
||||
++phdr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue