aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-12-01 13:38:21 -0800
committerDavid 'Digit' Turner <digit@google.com>2009-12-01 14:16:04 -0800
commit8b657e5deaa03b989b0b36791fcf2aa6b2882656 (patch)
tree7bebb5ed69bce8d88d6c4f47caa6694db909f3c9 /hw
parent5bc6182ae984796a6d14be7f7b8eb73c1b630b8e (diff)
downloadexternal_qemu-8b657e5deaa03b989b0b36791fcf2aa6b2882656.zip
external_qemu-8b657e5deaa03b989b0b36791fcf2aa6b2882656.tar.gz
external_qemu-8b657e5deaa03b989b0b36791fcf2aa6b2882656.tar.bz2
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.
Diffstat (limited to 'hw')
-rw-r--r--hw/goldfish_mmc.c8
1 files changed, 6 insertions, 2 deletions
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]