spl: fix entry_point equal to load_addr
authorGiulio Benetti <giulio.benetti@benettiengineering.com>
Mon, 25 Nov 2019 16:18:20 +0000 (17:18 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 5 Dec 2019 15:28:39 +0000 (10:28 -0500)
At the moment entry_point is set to image_get_load(header) that sets it
to "load address" instead of "entry point", assuming entry_point is
equal to load_addr, but it's not true. Then load_addr is set to
"entry_point - header_size", but this is wrong too since load_addr is
not an entry point.

So use image_get_ep() for entry_point assignment and image_get_load()
for load_addr assignment.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
common/spl/spl.c

index d51dbe9942fc9f3be482ffd8d141d853bcb67d64..24da164b43889c896dce5bddb6bded16c8d2651b 100644 (file)
@@ -264,9 +264,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
                        spl_image->entry_point = image_get_ep(header);
                        spl_image->size = image_get_data_size(header);
                } else {
-                       spl_image->entry_point = image_get_load(header);
+                       spl_image->entry_point = image_get_ep(header);
                        /* Load including the header */
-                       spl_image->load_addr = spl_image->entry_point -
+                       spl_image->load_addr = image_get_load(header) -
                                header_size;
                        spl_image->size = image_get_data_size(header) +
                                header_size;