On 16 October 2018 at 11:02, Andre Przywara <andre.przyw...@arm.com> wrote: > On Tue, 16 Oct 2018 01:19:35 +0000 > Stewart Hildebrand <stewart.hildebr...@dornerworks.com> wrote: > > Hi, > > Stewart, thanks a lot for picking this up! > >> On Monday, October 15, 2018 6:05 PM, Philippe Mathieu-Daudé wrote: >> > Hi Stewart, >> > >> > On 15/10/2018 23:26, Stewart Hildebrand wrote: >> > > + /* For the virt board, we write our startup >> > > "bootloader" at the very >> > > + * bottom of RAM, so that bit can't be used for the >> > > image. To avoid >> > > + * overlap in case the image requests to be loaded >> > > at an offset >> > > + * smaller than our bootloader, we increment the >> > > load offset to the >> > > + * next 2MB. >> > > + */ >> > > + if (kernel_load_offset < FIXUP_MAX) { >> > >> > I don't understand how this is related to FIXUP_MAX... >> >> You're right, my apologies, it's not directly related. >> write_bootloader() calculates the size of the bootloader like so: >> len = 0; >> while (insns[len].fixup != FIXUP_TERMINATOR) { >> len++; >> } >> >> The size of the bootloader then would be len * sizeof(uint32_t) >> >> It would be nice not to have to repeat that logic in >> load_aarch64_image(). I'll send out a v2 after I take some time to >> wrap my head around it... > > I wonder if this could be done much easier, since TEXT_OFFSET must > actually be page aligned. So all we would need is an *upper bound* for > the bootloader size, as long as that is below 4K we wouldn't even loose > anything.
Yes, I think it would be fine to just set a max bootloader size of 4K and check against that. (If so, assert() in write_bootloader that we did stay below the max.) thanks -- PMM