On 23 December 2013 06:48, Hervé Poussineau <hpous...@reactos.org> wrote: > So, this patch is a small functional change, as it adds a copy of the > firmware in a new range 0xfff00000-0xfff7ffff, but I think we can live with > it. > > We'll be able to remove it once we switch to another firmware which uses the > right reset instruction pointer or whose size is 1MB. > >>> + /* Open Hack'Ware hack: bios size is 512K and is loaded at >>> 0xfff00000. >>> + * However, reset address is 0xfffffffc. Mirror the bios from >>> + * 0xfff00000 to 0xfff80000. >>> + */ >>> + memory_region_init_alias(bios, NULL, "bios-alias", sysmem, >>> 0xfff00000, >>> + 0x00080000); >>> + memory_region_add_subregion_overlap(sysmem, 0xfff80000, bios, 1);
This code creates the mirrored region regardless of the size of the firmware blob, right? I think that means that if we do supply a 1MB blob it'll do the wrong thing. You probably want to have some "mirror this object as many times as necessary to fill the space" logic. We could probably do with having a generic MemoryRegion API for that, actually -- it's not uncommon behaviour for devices to be accessible every N bytes because they simply don't decode the full set of address lines. memory_region_add_subregion_tiled(MemoryRegion *mr, hwaddr offset, hwaddr tilelen, MemoryRegion *subregion) to add copies of subregion to container mr starting at offset for tilelen bytes, maybe? (we assume subregion to be created at the length that each 'tile' should be, so don't need to pass that too). thanks -- PMM