simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Simulavr-devel] [PATCH 03/13] Prevent segfaults for devices where not a


From: Onno Kortmann
Subject: [Simulavr-devel] [PATCH 03/13] Prevent segfaults for devices where not all I/O registers have been filled
Date: Tue, 3 Mar 2009 23:45:55 +0100

Simply fill with 'NotAvailableIo'.

Signed-off-by: Onno Kortmann <address@hidden>
---
 src/avrdevice.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/avrdevice.cpp b/src/avrdevice.cpp
index 6556f10..1007b67 100644
--- a/src/avrdevice.cpp
+++ b/src/avrdevice.cpp
@@ -209,8 +209,15 @@ ioSpaceSize(_ioSpaceSize) {
         currentOffset++;
     }      
 
-    // no way to generate a generic IO-Space here, so we need a gap
-    currentOffset+=ioSpaceSize;
+    /* Create invalid registers in I/O space which will fail on access (to
+       make simulavrxx more robust!)  In all well implemented devices, these
+       should be overwritten by the particular device type. But accessing such
+       a register will at least notify the user that there is an unimplemented
+       feature. */
+    for (unsigned int ii=0; ii<ioSpaceSize; ii++ ) {
+       rw[currentOffset]=new NotAvailableIo(this, currentOffset);
+       currentOffset++;
+    }
 
     //create the internal ram handlers 
     for (unsigned int ii=0; ii<IRamSize; ii++ ) {
-- 
1.5.6.5






reply via email to

[Prev in Thread] Current Thread [Next in Thread]