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>
This commit is contained in:
Dongxue Zhang 2015-09-15 08:14:07 -05:00
parent 8dfa45e03c
commit 58ec70444d

View file

@ -90,6 +90,8 @@ IdeDisk::IdeDisk(const Params *p)
} else { } else {
if (lba_size >= 63) if (lba_size >= 63)
sectors = 63; sectors = 63;
else if (lba_size == 0)
panic("Bad IDE image size: 0\n");
else else
sectors = lba_size; sectors = lba_size;