On Mon, 26 Oct 2020 at 13:37, Igor Mammedov <imamm...@redhat.com> wrote: > Peter Maydell <peter.mayd...@linaro.org> wrote: > > Hmm, maybe, maybe not. The original design idea here was that > > the boot loader code took a structure defining only the things > > that the bootloader needed to know. It doesn't really need to > > know about all the stuff that's in MachineState, which is > > the state structure for the machine. > > Yep It doesn't need all data the MachineState contains, but then we end up > with this kind of bugs which could be avoided if duplication were not there. > And some of the fields in MachineState are pure bootloader data.
I notice we already have arm_load_kernel() take a MachineState* and fill in the info->kernel_filename etc from the MachineState fields. I suppose we could do the same for a few more fields. I'm not very fond of the way that function takes the MachineState*, though. I think it would be nicer if the MachineState had a separate sub-struct which was "this is the stuff that's just data for the bootloader" and passed that, rather than throwing the entire state struct pointer around. thanks -- PMM