On Tue, 2 Nov 2021 at 14:04, Damien Hedde <damien.hedde@greensocs.com> wrote:
On 11/1/21 11:53, Peter Maydell wrote:
Won't this break the case of loading a file that spans two
consecutive-but-different memory regions ?
yes. I did not thought about that.
I think if we want
to catch "we tried to load something to an address not backed
by something" we should do that by making load_image_targetphys_as()
correctly handle errors from the memory accesses it makes and
propagate an error-return to the caller.
The problem is that load_image_targetphys_as() just uses rom_load_...().
And these macros/functions only put some "rom to load" objects in a list
without doing any real accesses.
Oh yes, I'd forgotten that this was all using the rom blob
mechanism underneath.
I think in that case that whatever we do we should aim
to be consistent between the different load-image functions;
we shouldn't add a check to load_image_targetphys_as() which
we don't do in eg load_elf_as(). That probably means we should
only be looking to warn or error at the point where we actually
load the ROM blobs into memory.
-- PMM