summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongxue Zhang <elta.era@gmail.com>2015-09-15 08:14:07 -0500
committerDongxue Zhang <elta.era@gmail.com>2015-09-15 08:14:07 -0500
commit58ec70444d9cfa50c7405d76a04cda5f9a43e1a1 (patch)
tree229f98ff34894b74747e9c7ec4e9ca3ac0674e32
parent8dfa45e03cded21e071bb6e652ad9a8d9e0ef7b4 (diff)
downloadgem5-58ec70444d9cfa50c7405d76a04cda5f9a43e1a1.tar.xz
dev: IDE Disk: Handle bad IDE image size
Handle bad IDE disk image size 0. When image size is 0, gem5 will cause an exception with log "Floating point exception (core dumped)". Committed by: Nilay Vaish <nilay@cs.wisc.edu>
-rw-r--r--src/dev/ide_disk.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dev/ide_disk.cc b/src/dev/ide_disk.cc
index 7298da521..2c8dfceb1 100644
--- a/src/dev/ide_disk.cc
+++ b/src/dev/ide_disk.cc
@@ -90,6 +90,8 @@ IdeDisk::IdeDisk(const Params *p)
} else {
if (lba_size >= 63)
sectors = 63;
+ else if (lba_size == 0)
+ panic("Bad IDE image size: 0\n");
else
sectors = lba_size;