Message ID | 20190722151804.25467-2-peter.maydell@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | arm: further improve initrd positioning | expand |
Peter Maydell <peter.maydell@linaro.org> writes: > Rename the elf_low_addr and elf_high_addr variables to image_low_addr > and image_high_addr -- in the next commit we will extend them to > be set for other kinds of image file and not just ELF files. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> > --- > hw/arm/boot.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c > index 1fb24fbef27..b7b31753aca 100644 > --- a/hw/arm/boot.c > +++ b/hw/arm/boot.c > @@ -986,7 +986,9 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > int kernel_size; > int initrd_size; > int is_linux = 0; > - uint64_t elf_entry, elf_low_addr, elf_high_addr; > + uint64_t elf_entry; > + /* Addresses of first byte used and first byte not used by the image */ > + uint64_t image_low_addr, image_high_addr; > int elf_machine; > hwaddr entry; > static const ARMInsnFixup *primary_loader; > @@ -1014,24 +1016,24 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > info->nb_cpus = 1; > > /* Assume that raw images are linux kernels, and ELF images are not. */ > - kernel_size = arm_load_elf(info, &elf_entry, &elf_low_addr, > - &elf_high_addr, elf_machine, as); > + kernel_size = arm_load_elf(info, &elf_entry, &image_low_addr, > + &image_high_addr, elf_machine, as); > if (kernel_size > 0 && have_dtb(info)) { > /* > * If there is still some room left at the base of RAM, try and put > * the DTB there like we do for images loaded with -bios or -pflash. > */ > - if (elf_low_addr > info->loader_start > - || elf_high_addr < info->loader_start) { > + if (image_low_addr > info->loader_start > + || image_high_addr < info->loader_start) { > /* > - * Set elf_low_addr as address limit for arm_load_dtb if it may be > + * Set image_low_addr as address limit for arm_load_dtb if it may be > * pointing into RAM, otherwise pass '0' (no limit) > */ > - if (elf_low_addr < info->loader_start) { > - elf_low_addr = 0; > + if (image_low_addr < info->loader_start) { > + image_low_addr = 0; > } > info->dtb_start = info->loader_start; > - info->dtb_limit = elf_low_addr; > + info->dtb_limit = image_low_addr; > } > } > entry = elf_entry; -- Alex Bennée
Peter Maydell <peter.maydell@linaro.org> writes: > Rename the elf_low_addr and elf_high_addr variables to image_low_addr > and image_high_addr -- in the next commit we will extend them to > be set for other kinds of image file and not just ELF files. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> > --- > hw/arm/boot.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c > index 1fb24fbef27..b7b31753aca 100644 > --- a/hw/arm/boot.c > +++ b/hw/arm/boot.c > @@ -986,7 +986,9 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > int kernel_size; > int initrd_size; > int is_linux = 0; > - uint64_t elf_entry, elf_low_addr, elf_high_addr; > + uint64_t elf_entry; > + /* Addresses of first byte used and first byte not used by the image */ > + uint64_t image_low_addr, image_high_addr; > int elf_machine; > hwaddr entry; > static const ARMInsnFixup *primary_loader; > @@ -1014,24 +1016,24 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > info->nb_cpus = 1; > > /* Assume that raw images are linux kernels, and ELF images are not. */ > - kernel_size = arm_load_elf(info, &elf_entry, &elf_low_addr, > - &elf_high_addr, elf_machine, as); > + kernel_size = arm_load_elf(info, &elf_entry, &image_low_addr, > + &image_high_addr, elf_machine, as); > if (kernel_size > 0 && have_dtb(info)) { > /* > * If there is still some room left at the base of RAM, try and put > * the DTB there like we do for images loaded with -bios or -pflash. > */ > - if (elf_low_addr > info->loader_start > - || elf_high_addr < info->loader_start) { > + if (image_low_addr > info->loader_start > + || image_high_addr < info->loader_start) { > /* > - * Set elf_low_addr as address limit for arm_load_dtb if it may be > + * Set image_low_addr as address limit for arm_load_dtb if it may be > * pointing into RAM, otherwise pass '0' (no limit) > */ > - if (elf_low_addr < info->loader_start) { > - elf_low_addr = 0; > + if (image_low_addr < info->loader_start) { > + image_low_addr = 0; > } > info->dtb_start = info->loader_start; > - info->dtb_limit = elf_low_addr; > + info->dtb_limit = image_low_addr; > } > } > entry = elf_entry; -- Alex Bennée
On 7/22/19 5:18 PM, Peter Maydell wrote: > Rename the elf_low_addr and elf_high_addr variables to image_low_addr > and image_high_addr -- in the next commit we will extend them to > be set for other kinds of image file and not just ELF files. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > hw/arm/boot.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c > index 1fb24fbef27..b7b31753aca 100644 > --- a/hw/arm/boot.c > +++ b/hw/arm/boot.c > @@ -986,7 +986,9 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > int kernel_size; > int initrd_size; > int is_linux = 0; > - uint64_t elf_entry, elf_low_addr, elf_high_addr; > + uint64_t elf_entry; > + /* Addresses of first byte used and first byte not used by the image */ > + uint64_t image_low_addr, image_high_addr; > int elf_machine; > hwaddr entry; > static const ARMInsnFixup *primary_loader; > @@ -1014,24 +1016,24 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, > info->nb_cpus = 1; > > /* Assume that raw images are linux kernels, and ELF images are not. */ > - kernel_size = arm_load_elf(info, &elf_entry, &elf_low_addr, > - &elf_high_addr, elf_machine, as); > + kernel_size = arm_load_elf(info, &elf_entry, &image_low_addr, > + &image_high_addr, elf_machine, as); > if (kernel_size > 0 && have_dtb(info)) { > /* > * If there is still some room left at the base of RAM, try and put > * the DTB there like we do for images loaded with -bios or -pflash. > */ > - if (elf_low_addr > info->loader_start > - || elf_high_addr < info->loader_start) { > + if (image_low_addr > info->loader_start > + || image_high_addr < info->loader_start) { > /* > - * Set elf_low_addr as address limit for arm_load_dtb if it may be > + * Set image_low_addr as address limit for arm_load_dtb if it may be > * pointing into RAM, otherwise pass '0' (no limit) > */ > - if (elf_low_addr < info->loader_start) { > - elf_low_addr = 0; > + if (image_low_addr < info->loader_start) { > + image_low_addr = 0; > } > info->dtb_start = info->loader_start; > - info->dtb_limit = elf_low_addr; > + info->dtb_limit = image_low_addr; > } > } > entry = elf_entry; > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 1fb24fbef27..b7b31753aca 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -986,7 +986,9 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, int kernel_size; int initrd_size; int is_linux = 0; - uint64_t elf_entry, elf_low_addr, elf_high_addr; + uint64_t elf_entry; + /* Addresses of first byte used and first byte not used by the image */ + uint64_t image_low_addr, image_high_addr; int elf_machine; hwaddr entry; static const ARMInsnFixup *primary_loader; @@ -1014,24 +1016,24 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, info->nb_cpus = 1; /* Assume that raw images are linux kernels, and ELF images are not. */ - kernel_size = arm_load_elf(info, &elf_entry, &elf_low_addr, - &elf_high_addr, elf_machine, as); + kernel_size = arm_load_elf(info, &elf_entry, &image_low_addr, + &image_high_addr, elf_machine, as); if (kernel_size > 0 && have_dtb(info)) { /* * If there is still some room left at the base of RAM, try and put * the DTB there like we do for images loaded with -bios or -pflash. */ - if (elf_low_addr > info->loader_start - || elf_high_addr < info->loader_start) { + if (image_low_addr > info->loader_start + || image_high_addr < info->loader_start) { /* - * Set elf_low_addr as address limit for arm_load_dtb if it may be + * Set image_low_addr as address limit for arm_load_dtb if it may be * pointing into RAM, otherwise pass '0' (no limit) */ - if (elf_low_addr < info->loader_start) { - elf_low_addr = 0; + if (image_low_addr < info->loader_start) { + image_low_addr = 0; } info->dtb_start = info->loader_start; - info->dtb_limit = elf_low_addr; + info->dtb_limit = image_low_addr; } } entry = elf_entry;
Rename the elf_low_addr and elf_high_addr variables to image_low_addr and image_high_addr -- in the next commit we will extend them to be set for other kinds of image file and not just ELF files. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- hw/arm/boot.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) -- 2.20.1