From 8b657e5deaa03b989b0b36791fcf2aa6b2882656 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Tue, 1 Dec 2009 13:38:21 -0800 Subject: Fix a crash when using an 8MB SD Card image file. The minimum size is now 9MB. This appears to be a limitation of the emulated MMC hardware code and/or kernel device driver. --- hw/goldfish_mmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'hw') diff --git a/hw/goldfish_mmc.c b/hw/goldfish_mmc.c index 2295d2d..3824db9 100644 --- a/hw/goldfish_mmc.c +++ b/hw/goldfish_mmc.c @@ -287,9 +287,13 @@ static void goldfish_mmc_do_command(struct goldfish_mmc_state *s, uint32_t cmd, capacity >>= 1; } capacity -= 1; + if (exponent < 2) { + cpu_abort(cpu_single_env, "SDCard too small, must be at least 9MB\n"); + } exponent -= 2; - if (exponent > 7) - cpu_abort(cpu_single_env, "exponent %d too big\n", exponent); + if (exponent > 7) { + cpu_abort(cpu_single_env, "SDCard too large.\n"); + } s->resp[2] |= (((uint32_t)capacity >> 2) & 0x3FF); // high 10 bits to bottom of resp[2] s->resp[1] |= (((uint32_t)capacity & 3) << 30); // low 2 bits to top of resp[1] -- cgit v1.1