From 1351700cf2eec9fd928dace86de0aabdb34dfeb5 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 11 Apr 2018 22:02:08 -0700 Subject: bootvx: x86: Explicitly clear the bootloader image size VxWorks bootloader stores its size at a pre-defined offset @ 0x5004. Later when VxWorks kernel boots up and system memory information is retrieved from the E820 table, the bootloader size will be subtracted from the total system memory size to calculate the size of available memory for the OS. Explicitly clear the bootloader image size otherwise if memory at this offset happens to contain some garbage data, the final available memory size for the kernel is insane. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- cmd/elf.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd/elf.c') diff --git a/cmd/elf.c b/cmd/elf.c index ea09506c64..22d1918144 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -348,6 +348,13 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) info->entries = install_e820_map(E820MAX, data); info->addr = (info->entries - 1) * sizeof(struct e820entry) + E820_DATA_OFFSET; + + /* + * Explicitly clear the bootloader image size otherwise if memory + * at this offset happens to contain some garbage data, the final + * available memory size for the kernel is insane. + */ + *(u32 *)(base + BOOT_IMAGE_SIZE_OFFSET) = 0; #endif /* -- cgit v1.2.3