On 07/25/13 14:28, Michael S. Tsirkin wrote:
> On Thu, Jul 25, 2013 at 02:14:40PM +0200, Gerd Hoffmann wrote:
>> On 07/24/13 18:01, Michael S. Tsirkin wrote:
>>> QTAILQ_FOREACH(rom, &roms, next) {
>>> + if (rom->mr) {
>>> + continue;
>>> + }
>>> if (rom->fw_file) {
>>> continue;
>>> }
>>> if (rom->data == NULL) {
>>> continue;
>>> }
>>> - cpu_physical_memory_write_rom(rom->addr, rom->data, rom->datasize);
>>> + if (rom->mr) {
>>> + void *host = memory_region_get_ram_ptr(rom->mr);
>>> + memcpy(host, rom->data, rom->datasize);
>>
>> I think this code never ever runs ...
>>
>> cheers,
>> Gerd
>>
>
>
> Could you be clearer please? This chunk is in rom_reset,
> I think it runs on reset.
You have the "if (rom->mr)" twice in the loop. The first does continue
so the second will never ever evaluate to true, thereby making the
memcpy dead code.
cheers,
Gerd