Skip to content
Snippets Groups Projects
Commit 1351700c authored by Bin Meng's avatar Bin Meng
Browse files

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: default avatarBin Meng <bmeng.cn@gmail.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent 2902be86
No related branches found
No related tags found
No related merge requests found
...@@ -348,6 +348,13 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -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->entries = install_e820_map(E820MAX, data);
info->addr = (info->entries - 1) * sizeof(struct e820entry) + info->addr = (info->entries - 1) * sizeof(struct e820entry) +
E820_DATA_OFFSET; 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 #endif
/* /*
......
...@@ -43,6 +43,15 @@ struct e820info { ...@@ -43,6 +43,15 @@ struct e820info {
u32 error; /* must be zero */ u32 error; /* must be zero */
}; };
/*
* 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.
*/
#define BOOT_IMAGE_SIZE_OFFSET 0x5004
int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
void boot_prep_vxworks(bootm_headers_t *images); void boot_prep_vxworks(bootm_headers_t *images);
void boot_jump_vxworks(bootm_headers_t *images); void boot_jump_vxworks(bootm_headers_t *images);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment