sparc: Fix assertion caused by empty memory slot with 0 byte

If the memory size given on the command line is equal to the
maximum size of memory defined by the hardware, there is no
"empty slot" after physical memory.

The following command

		qemu-system-sparc -m 256

raised an assertion:
exec.c:2614: cpu_register_physical_memory_offset: Assertion `size' failed

This can be fixed either at the caller side (don't call empty_slot_init)
or in empty_slot_init (do nothing) when size == 0. The second solution
was choosen here because it is more robust.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
This commit is contained in:
Stefan Weil 2011-04-14 19:19:00 +02:00 committed by Blue Swirl
parent cb842c90a4
commit 1a00282a73

View File

@ -53,6 +53,8 @@ static CPUWriteMemoryFunc * const empty_slot_write[3] = {
void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size)
{
if (slot_size > 0) {
/* Only empty slots larger than 0 byte need handling. */
DeviceState *dev;
SysBusDevice *s;
EmptySlot *e;
@ -66,6 +68,7 @@ void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size)
sysbus_mmio_map(s, 0, addr);
}
}
static int empty_slot_init1(SysBusDevice *dev)
{