From fb2ffe9552e166d751586c90669bde92249470bd Mon Sep 17 00:00:00 2001

From: Elta Era <[email protected]>

Date: Mon, 14 Sep 2015 15:33:07 +0800

Subject: [PATCH] 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)".


Signed-off-by: Elta Era <[email protected]>

---

 src/dev/ide_disk.cc | 2 ++

 1 file changed, 2 insertions(+)


diff --git a/src/dev/ide_disk.cc b/src/dev/ide_disk.cc

index 7298da5..2c8dfce 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;



-- 

2.3.2 (Apple Git-55)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to