> No. This is a reset ordering problem. The CPU reset happens before the > 'rom blob loader' reset, so at this point the rom data (usually an ELF file > segment) has not been written into ram, and doing an > address_space_read() will just read zeroes. This is also why the aliasing > issue happens at all -- the rom blob is at a particular address, but if the > address we use here to try to read the data is an aliased variant of it > then rom_ptr() does the wrong thing. > > My preference for fixing this properly is: > * get Damien's three-phase-reset patchset into master > * make the ROM blob loader write its data into ram > in phase 2 ('hold') > * make the arm CPU reset read the data in phase 3 ('exit') > > This last matches better what the hardware does -- the M-profile CPU > reads the vector table in the first couple of clock cycles when it *leaves* > reset, not while the CPU is being *held* in reset. This kind of thing is > always awkward to model in an emulator, especially if you were hoping > to also handle allowing the PC to be set from an ELF file entrypoint or > by the user in the gdbstub on startup...
Makes perfect sense. Feel free to drop the patch. Thanks, Jh