Re: [PATCH v2 3/4] board: Add QEMU m68k virt board support

Daniel Palmer
2025-12-31T03:21:08Z

Hi Kuan-Wei,

On Mon, 29 Dec 2025 at 22:44, Kuan-Wei Chiu <visitorckw@gmail.com> wrote:
> > Yeah I think so, if you didn't find the last bootinfo entry within
> > some reasonable bounds everything is probably broken and you shouldn't
> > continue.
> > I think for most real machines (Amiga etc) there aren't many entries
> > but for the virt machine maybe there is an entry per virtio mmio
> > device so there might actually be a lot of them there.
>
> So the problem becomes determining a reasonable limit.
>
> I think we can safely assume the bootinfo buffer won't exceed a 4KB
> page size. Since the minimum record size is 4 bytes (tag + size),
> setting the maximum records to 4096 / 4 =1024 should be a safe
> assumption?

All of the bootinfo being on a single page makes sense to me[0] and if
an error is printed if the last entry is not found within that it'll
be easy to work out that there is more and adjust the limit.
That is a lot better than the bootinfo being corrupted and parsing
random memory until we hit something that looks like the last record.
;)

Cheers,

Daniel

0 - I feel like I saw that assumption somewhere but can't remember
where, maybe in the EMILE mac bootloader..