Skip to content
Snippets Groups Projects
Commit f49fa07a authored by Martin Unzner's avatar Martin Unzner
Browse files

Changed BufferCache Backend to STL (as proposed), added IOPortEvent-Cache, updated class diagram

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1325 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
parent db88736b
No related branches found
No related tags found
No related merge requests found
...@@ -2932,19 +2932,19 @@ ...@@ -2932,19 +2932,19 @@
</dia:object> </dia:object>
<dia:object type="UML - Class" version="0" id="O5"> <dia:object type="UML - Class" version="0" id="O5">
<dia:attribute name="obj_pos"> <dia:attribute name="obj_pos">
<dia:point val="45.95,-20.85"/> <dia:point val="45.95,-24.35"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="45.9,-20.9;69.215,-3"/> <dia:rectangle val="45.9,-24.4;69.215,-2.5"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_corner"> <dia:attribute name="elem_corner">
<dia:point val="45.95,-20.85"/> <dia:point val="45.95,-24.35"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_width"> <dia:attribute name="elem_width">
<dia:real val="23.215"/> <dia:real val="23.215"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_height"> <dia:attribute name="elem_height">
<dia:real val="17.800000000000004"/> <dia:real val="21.800000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#EventList#</dia:string> <dia:string>#EventList#</dia:string>
...@@ -3149,6 +3149,29 @@ ...@@ -3149,6 +3149,29 @@
<dia:boolean val="false"/> <dia:boolean val="false"/>
</dia:attribute> </dia:attribute>
</dia:composite> </dia:composite>
<dia:composite type="umlattribute">
<dia:attribute name="name">
<dia:string>#m_Io_cache#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BufferCache&lt;IOPortEvent*&gt;#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
</dia:composite>
</dia:attribute> </dia:attribute>
<dia:attribute name="operations"> <dia:attribute name="operations">
<dia:composite type="umloperation"> <dia:composite type="umloperation">
...@@ -3420,54 +3443,6 @@ ...@@ -3420,54 +3443,6 @@
</dia:attribute> </dia:attribute>
<dia:attribute name="parameters"/> <dia:attribute name="parameters"/>
</dia:composite> </dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#makeActive#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#void#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="0"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#ev#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BaseEvent*#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation"> <dia:composite type="umloperation">
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#makeActive#</dia:string> <dia:string>#makeActive#</dia:string>
...@@ -3797,6 +3772,192 @@ ...@@ -3797,6 +3772,192 @@
</dia:attribute> </dia:attribute>
<dia:attribute name="parameters"/> <dia:attribute name="parameters"/>
</dia:composite> </dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#getBPBuffer#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BufferCache&lt;BPEvent*&gt;&amp;#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="0"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters"/>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#getIOBuffer#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BufferCache&lt;IOPortEvent*&gt;&amp;#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="0"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters"/>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#addToCaches#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#void#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#ev#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BaseEvent*#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#removeFromCaches#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#void#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#ev#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#BaseEvent*#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#clearCaches#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#void#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters"/>
</dia:composite>
</dia:attribute> </dia:attribute>
<dia:attribute name="template"> <dia:attribute name="template">
<dia:boolean val="false"/> <dia:boolean val="false"/>
...@@ -4374,17 +4535,17 @@ ...@@ -4374,17 +4535,17 @@
<dia:boolean val="false"/> <dia:boolean val="false"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_pos"> <dia:attribute name="obj_pos">
<dia:point val="69.165,-16.55"/> <dia:point val="69.165,-20.05"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="68.415,-17.35;85.62,-14.15"/> <dia:rectangle val="68.415,-20.85;85.62,-14.15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="meta"> <dia:attribute name="meta">
<dia:composite type="dict"/> <dia:composite type="dict"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="orth_points"> <dia:attribute name="orth_points">
<dia:point val="69.165,-16.55"/> <dia:point val="69.165,-20.05"/>
<dia:point val="85.035,-16.55"/> <dia:point val="85.035,-20.05"/>
<dia:point val="85.035,-14.95"/> <dia:point val="85.035,-14.95"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="orth_orient"> <dia:attribute name="orth_orient">
...@@ -17451,19 +17612,19 @@ ...@@ -17451,19 +17612,19 @@
</dia:object> </dia:object>
<dia:object type="UML - Class" version="0" id="O86"> <dia:object type="UML - Class" version="0" id="O86">
<dia:attribute name="obj_pos"> <dia:attribute name="obj_pos">
<dia:point val="18,-20.35"/> <dia:point val="13.6,-17.95"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="17.95,-21.1;38.97,-8.9"/> <dia:rectangle val="13.55,-18.7;38.42,-9.7"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_corner"> <dia:attribute name="elem_corner">
<dia:point val="18,-20.35"/> <dia:point val="13.6,-17.95"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_width"> <dia:attribute name="elem_width">
<dia:real val="20.52"/> <dia:real val="24.370000000000001"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="elem_height"> <dia:attribute name="elem_height">
<dia:real val="11.399999999999999"/> <dia:real val="8.1999999999999993"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#BufferCache#</dia:string> <dia:string>#BufferCache#</dia:string>
...@@ -17558,30 +17719,7 @@ ...@@ -17558,30 +17719,7 @@
<dia:string>#m_Buffer#</dia:string> <dia:string>#m_Buffer#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#T**#</dia:string> <dia:string>#std::list&lt;T&gt;#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
</dia:composite>
<dia:composite type="umlattribute">
<dia:attribute name="name">
<dia:string>#m_BufferCount#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="value"> <dia:attribute name="value">
<dia:string>##</dia:string> <dia:string>##</dia:string>
...@@ -17601,102 +17739,6 @@ ...@@ -17601,102 +17739,6 @@
</dia:composite> </dia:composite>
</dia:attribute> </dia:attribute>
<dia:attribute name="operations"> <dia:attribute name="operations">
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#setCount#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#void#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="1"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#new_count#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#reallocate_buffer#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#new_size#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation"> <dia:composite type="umloperation">
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#add#</dia:string> <dia:string>#add#</dia:string>
...@@ -17731,7 +17773,7 @@ ...@@ -17731,7 +17773,7 @@
<dia:string>#val#</dia:string> <dia:string>#val#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#T#</dia:string> <dia:string>#const T&amp;#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="value"> <dia:attribute name="value">
<dia:string>##</dia:string> <dia:string>##</dia:string>
...@@ -17779,7 +17821,7 @@ ...@@ -17779,7 +17821,7 @@
<dia:string>#val#</dia:string> <dia:string>#val#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#T#</dia:string> <dia:string>#const T&amp;#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="value"> <dia:attribute name="value">
<dia:string>##</dia:string> <dia:string>##</dia:string>
...@@ -17801,7 +17843,7 @@ ...@@ -17801,7 +17843,7 @@
<dia:string>##</dia:string> <dia:string>##</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#int#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="visibility"> <dia:attribute name="visibility">
<dia:enum val="0"/> <dia:enum val="0"/>
...@@ -17827,7 +17869,7 @@ ...@@ -17827,7 +17869,7 @@
<dia:string>#idx#</dia:string> <dia:string>#idx#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#int#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="value"> <dia:attribute name="value">
<dia:string>##</dia:string> <dia:string>##</dia:string>
...@@ -17873,61 +17915,13 @@ ...@@ -17873,61 +17915,13 @@
</dia:composite> </dia:composite>
<dia:composite type="umloperation"> <dia:composite type="umloperation">
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#get#</dia:string> <dia:string>#begin#</dia:string>
</dia:attribute>
<dia:attribute name="stereotype">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#T#</dia:string>
</dia:attribute>
<dia:attribute name="visibility">
<dia:enum val="0"/>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="abstract">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="inheritance_type">
<dia:enum val="2"/>
</dia:attribute>
<dia:attribute name="query">
<dia:boolean val="true"/>
</dia:attribute>
<dia:attribute name="class_scope">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="parameters">
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#idx#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite>
<dia:composite type="umloperation">
<dia:attribute name="name">
<dia:string>#set#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="stereotype"> <dia:attribute name="stereotype">
<dia:string>##</dia:string> <dia:string>##</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#void#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="visibility"> <dia:attribute name="visibility">
<dia:enum val="0"/> <dia:enum val="0"/>
...@@ -17947,52 +17941,17 @@ ...@@ -17947,52 +17941,17 @@
<dia:attribute name="class_scope"> <dia:attribute name="class_scope">
<dia:boolean val="false"/> <dia:boolean val="false"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="parameters"> <dia:attribute name="parameters"/>
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#idx#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#int#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
<dia:composite type="umlparameter">
<dia:attribute name="name">
<dia:string>#val#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>#T#</dia:string>
</dia:attribute>
<dia:attribute name="value">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="kind">
<dia:enum val="1"/>
</dia:attribute>
</dia:composite>
</dia:attribute>
</dia:composite> </dia:composite>
<dia:composite type="umloperation"> <dia:composite type="umloperation">
<dia:attribute name="name"> <dia:attribute name="name">
<dia:string>#getCount#</dia:string> <dia:string>#end#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="stereotype"> <dia:attribute name="stereotype">
<dia:string>##</dia:string> <dia:string>##</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#int#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="visibility"> <dia:attribute name="visibility">
<dia:enum val="0"/> <dia:enum val="0"/>
...@@ -18007,7 +17966,7 @@ ...@@ -18007,7 +17966,7 @@
<dia:enum val="2"/> <dia:enum val="2"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="query"> <dia:attribute name="query">
<dia:boolean val="true"/> <dia:boolean val="false"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="class_scope"> <dia:attribute name="class_scope">
<dia:boolean val="false"/> <dia:boolean val="false"/>
...@@ -18022,7 +17981,7 @@ ...@@ -18022,7 +17981,7 @@
<dia:string>##</dia:string> <dia:string>##</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#int#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="visibility"> <dia:attribute name="visibility">
<dia:enum val="0"/> <dia:enum val="0"/>
...@@ -18065,7 +18024,7 @@ ...@@ -18065,7 +18024,7 @@
<dia:string>#idx#</dia:string> <dia:string>#idx#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="type"> <dia:attribute name="type">
<dia:string>#int#</dia:string> <dia:string>#iterator#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="value"> <dia:attribute name="value">
<dia:string>##</dia:string> <dia:string>##</dia:string>
...@@ -18132,19 +18091,19 @@ ...@@ -18132,19 +18091,19 @@
<dia:boolean val="false"/> <dia:boolean val="false"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_pos"> <dia:attribute name="obj_pos">
<dia:point val="38.52,-14.25"/> <dia:point val="37.97,-14.25"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="38.47,-14.3;46,-9.95"/> <dia:rectangle val="37.92,-15.05;46,-13.45"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="meta"> <dia:attribute name="meta">
<dia:composite type="dict"/> <dia:composite type="dict"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="orth_points"> <dia:attribute name="orth_points">
<dia:point val="38.52,-14.25"/> <dia:point val="37.97,-14.25"/>
<dia:point val="41.6707,-14.25"/>
<dia:point val="41.6707,-14.25"/> <dia:point val="41.6707,-14.25"/>
<dia:point val="41.6707,-11.55"/> <dia:point val="45.95,-14.25"/>
<dia:point val="45.95,-11.55"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="orth_orient"> <dia:attribute name="orth_orient">
<dia:enum val="0"/> <dia:enum val="0"/>
...@@ -18161,8 +18120,8 @@ ...@@ -18161,8 +18120,8 @@
<dia:color val="#000000"/> <dia:color val="#000000"/>
</dia:attribute> </dia:attribute>
<dia:connections> <dia:connections>
<dia:connection handle="0" to="O86" connection="19"/> <dia:connection handle="0" to="O86" connection="13"/>
<dia:connection handle="1" to="O5" connection="26"/> <dia:connection handle="1" to="O5" connection="28"/>
</dia:connections> </dia:connections>
</dia:object> </dia:object>
</dia:layer> </dia:layer>
......
doc/class-diagram.png

755 KiB | W: | H:

doc/class-diagram.png

761 KiB | W: | H:

doc/class-diagram.png
doc/class-diagram.png
doc/class-diagram.png
doc/class-diagram.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -7,87 +7,11 @@ ...@@ -7,87 +7,11 @@
namespace fail { namespace fail {
template<class T> template<class T>
void BufferCache<T>::add(T val) typename BufferCache<T>::iterator BufferCache<T>::makeActive(EventList &ev_list, BufferCache<T>::iterator idx)
{ {
int new_size = getCount() + 1; assert(idx != end() &&
int new_last_index = getCount();
int res = reallocate_buffer(new_size);
assert (res == 0 && "FATAL ERROR: Could not add event to cache");
set(new_last_index, val);
}
template<class T>
void BufferCache<T>::remove(T val)
{
bool do_remove = false;
for (int i = 0; i < getCount(); i++) {
if (get(i) == val) {
do_remove = true;
}
if (do_remove) {
if (i > getCount() - 1) {
set(i, get(i + 1));
}
}
}
if (do_remove) {
int new_size = getCount() - 1;
int res = reallocate_buffer(new_size);
assert (res == 0 && "FATAL ERROR: Could not remove event from cache");
}
}
template<class T>
void BufferCache<T>::clear()
{
setCount(0);
free(m_Buffer);
m_Buffer = NULL;
}
template<class T>
int BufferCache<T>::erase(int idx)
{
if(idx < 0 || idx >= getCount())
return -2;
for (int i = idx; i < getCount() - 1; i++) {
set(i, get(i + 1));
}
int new_size = getCount() - 1;
if (reallocate_buffer(new_size) != 0)
return -1;
return idx;
}
template<class T>
int BufferCache<T>::reallocate_buffer(int new_size)
{
if (new_size < 0)
return 20;
if (new_size == 0) {
clear();
return 0;
}
void *new_buffer = realloc(m_Buffer, new_size * sizeof(T));
if (new_buffer == NULL)
return 10;
m_Buffer = static_cast<T*>(new_buffer);
setCount(new_size);
return 0;
}
template<class T>
int BufferCache<T>::makeActive(EventList &ev_list, int idx)
{
assert(idx < getCount() &&
"FATAL ERROR: Index larger than cache!"); "FATAL ERROR: Index larger than cache!");
T ev = get(idx); T ev = *idx;
assert(ev && "FATAL ERROR: Object pointer cannot be NULL!"); assert(ev && "FATAL ERROR: Object pointer cannot be NULL!");
ev->decreaseCounter(); ev->decreaseCounter();
if (ev->getCounter() > 0) { if (ev->getCounter() > 0) {
...@@ -102,7 +26,8 @@ int BufferCache<T>::makeActive(EventList &ev_list, int idx) ...@@ -102,7 +26,8 @@ int BufferCache<T>::makeActive(EventList &ev_list, int idx)
return erase(idx); return erase(idx);
} }
// Declare whatever instances of the template you are going to use here: // Declare here whatever instances of the template you are going to use:
template class BufferCache<BPEvent*>; template class BufferCache<BPEvent*>;
template class BufferCache<IOPortEvent*>;
} // end-of-namespace: fail } // end-of-namespace: fail
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __BUFFER_CACHE_HPP__ #define __BUFFER_CACHE_HPP__
#include <stdlib.h> #include <stdlib.h>
#include <list>
namespace fail { namespace fail {
...@@ -12,74 +13,71 @@ class EventList; ...@@ -12,74 +13,71 @@ class EventList;
* *
* \brief A simple dynamic array * \brief A simple dynamic array
* *
* This class is intended to serve as a kind of cache for the entirely STL-based, * This class is intended to serve as a kind of cache for the
* untyped and therefore quite slow event handling mechanism of Fail*. * untyped and therefore quite slow event handling mechanism of Fail*.
* To keep the code easily readable, some buffer management methods
* perform suboptimally (remove() and erase() have linear complexity).
*
* FIXME: Why not using std::vector? ("A simple dynamic array")
*/ */
template<class T> template<class T>
class BufferCache { class BufferCache {
private: public:
// TODO: comments ("//!<") needed!
T *m_Buffer;
int m_BufferCount;
/** /**
* Changes m_BufferCount. Should be inlined. * The list type inherent to this class. Like bufferlist_t in EventList.hpp,
* @param new_count the new array length * but dynamically typed.
*/ */
inline void setCount(int new_count) { if(new_count >= 0) m_BufferCount = new_count; } typedef std::list<T> cachelist_t;
protected:
/** /**
* Reallocates the buffer. This implementation is extremely primitive, * The iterator of this class used to loop through the list of
* but since the amount of entries is small, * added events. To retrieve an iterator to the first element, call
* this will not be significant, hopefully. Should be inlined. * begin(). end() returns the iterator, pointing after the last element.
* @param new_size the new number of elements in the array * (This behaviour equals the STL iterator in C++.)
* @return 0 if successful, an error code otherwise (10 if realloc() fails, 20 for an invalid new size)
*/ */
inline int reallocate_buffer(int new_size); typedef typename cachelist_t::iterator iterator;
private:
cachelist_t m_Buffer; //!< The list holding the cached elements
public: public:
BufferCache() BufferCache() {}
: m_Buffer(NULL), m_BufferCount(0) {}
~BufferCache() {} ~BufferCache() {}
/** /**
* Add an element to the array. The object pointed to remains untouched. * Add an element to the array. The object pointed to remains untouched.
* @param val the element to add * @param val the element to add
*/ */
void add(T val); inline void add(const T &val) { m_Buffer.push_back(val); }
/** /**
* Remove an element from the array. The object pointed to remains untouched. * Remove an element from the array. The object pointed to remains untouched.
* @param val the element to remove * @param val the element to remove
*/ */
void remove(T val); inline void remove(const T &val) { m_Buffer.remove(val); }
/** /**
* Remove an element at a specific position. The object pointed to remains untouched. * Remove an element at a specific position. The object pointed to remains untouched.
* @param val the element to remove * @param val the element to remove
* @return a pointer to the given element's successor if successful, a negative value otherwise * @return a pointer to the given element's successor if successful, a negative value otherwise
*/ */
int erase(int i); inline iterator erase(iterator i) { return m_Buffer.erase(i); }
/** /**
* Clears the array, removing all elements. The objects pointed to remain untouched. * Clears the array, removing all elements. The objects pointed to remain untouched.
*/ */
void clear(); inline void clear() { m_Buffer.clear(); }
/**
* Retrieve an element from the array. Should be inlined.
* @param idx the position to retrieve the element from
* @return the element at the given position
*/
inline T get(int idx) const { return (idx >= 0 && idx < getCount() ? m_Buffer[idx] : NULL); }
/** /**
* Set an element at a given position. Should be inlined. * Returns an iterator to the beginning of the internal data structure.
* @param idx the position to change an element at * Don't forget to update the returned iterator when calling one of the
* @param val the new value of the given element * modifying methods like makeActive() or remove(). Therefore you need
* to call the iterator-based variants of makeActive() and remove().
* \code
* [X|1|2| ... |n]
* ^
* \endcode
*/ */
inline void set(int idx, T val) { if(idx >= 0 && idx < getCount()) m_Buffer[idx] = val; } inline iterator begin() { return m_Buffer.begin(); }
/** /**
* Retrieves the current length of the array. Should be inlined. * Returns an iterator to the end of the interal data structure.
* @return the array length * Don't forget to update the returned iterator when calling one of the
* modifying methods like makeActive() or remove(). Therefore you need
* to call the iterator-based variants of makeActive() and remove().
* \code
* [1|2| ... |n]X
* ^
* \endcode
*/ */
inline int getCount() const { return m_BufferCount; } inline iterator end() { return m_Buffer.end(); }
/** /**
* Acts as a replacement for EventList::makeActive, manipulating * Acts as a replacement for EventList::makeActive, manipulating
* the buffer cache exclusively. EventList::fireActiveEvents needs * the buffer cache exclusively. EventList::fireActiveEvents needs
...@@ -88,7 +86,7 @@ public: ...@@ -88,7 +86,7 @@ public:
* @param idx the index of the event to trigger * @param idx the index of the event to trigger
* @returns an updated index which can be used to update a loop counter * @returns an updated index which can be used to update a loop counter
*/ */
int makeActive(EventList &ev_list, int idx); iterator makeActive(EventList &ev_list, iterator idx);
}; };
} // end-of-namespace: fail } // end-of-namespace: fail
......
...@@ -4,7 +4,34 @@ ...@@ -4,7 +4,34 @@
#include "SALInst.hpp" #include "SALInst.hpp"
namespace fail { namespace fail {
void EventList::addToCaches(BaseEvent *ev)
{
BPEvent *bps_ev;
if((bps_ev = dynamic_cast<BPEvent*>(ev)) != NULL)
m_Bp_cache.add(bps_ev);
IOPortEvent *io_ev;
if((io_ev = dynamic_cast<IOPortEvent*>(ev)) != NULL)
m_Io_cache.add(io_ev);
}
void EventList::removeFromCaches(BaseEvent *ev)
{
BPEvent *bpr_ev;
if((bpr_ev = dynamic_cast<BPEvent*>(ev)) != NULL)
m_Bp_cache.remove(bpr_ev);
IOPortEvent *io_ev;
if((io_ev = dynamic_cast<IOPortEvent*>(ev)) != NULL)
m_Io_cache.remove(io_ev);
}
void EventList::clearCaches() {
m_Bp_cache.clear();
m_Io_cache.clear();
}
EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp) EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp)
{ {
assert(ev != NULL && "FATAL ERROR: Event (of base type BaseEvent*) cannot be NULL!"); assert(ev != NULL && "FATAL ERROR: Event (of base type BaseEvent*) cannot be NULL!");
...@@ -12,9 +39,7 @@ EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp) ...@@ -12,9 +39,7 @@ EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp)
assert(ev->getCounter() != 0); assert(ev->getCounter() != 0);
ev->setParent(pExp); // event is linked to experiment flow ev->setParent(pExp); // event is linked to experiment flow
BPEvent *bp_ev; addToCaches(ev);
if((bp_ev = dynamic_cast<BPEvent*>(ev)) != NULL)
m_Bp_cache.add(bp_ev);
m_BufferList.push_back(ev); m_BufferList.push_back(ev);
return (ev->getId()); return (ev->getId());
} }
...@@ -30,7 +55,7 @@ void EventList::remove(BaseEvent* ev) ...@@ -30,7 +55,7 @@ void EventList::remove(BaseEvent* ev)
simulator.onEventDeletion(*it); simulator.onEventDeletion(*it);
for (firelist_t::iterator it = m_FireList.begin(); it != m_FireList.end(); it++) for (firelist_t::iterator it = m_FireList.begin(); it != m_FireList.end(); it++)
simulator.onEventDeletion(*it); simulator.onEventDeletion(*it);
m_Bp_cache.clear(); clearCaches();
m_BufferList.clear(); m_BufferList.clear();
// all remaining active events must not fire anymore // all remaining active events must not fire anymore
m_DeleteList.insert(m_DeleteList.end(), m_FireList.begin(), m_FireList.end()); m_DeleteList.insert(m_DeleteList.end(), m_FireList.begin(), m_FireList.end());
...@@ -41,9 +66,7 @@ void EventList::remove(BaseEvent* ev) ...@@ -41,9 +66,7 @@ void EventList::remove(BaseEvent* ev)
} else { } else {
simulator.onEventDeletion(ev); simulator.onEventDeletion(ev);
BPEvent *bp_ev; removeFromCaches(ev);
if((bp_ev = dynamic_cast<BPEvent*>(ev)) != NULL)
m_Bp_cache.remove(bp_ev);
m_BufferList.remove(ev); m_BufferList.remove(ev);
firelist_t::const_iterator it = firelist_t::const_iterator it =
std::find(m_FireList.begin(), m_FireList.end(), ev); std::find(m_FireList.begin(), m_FireList.end(), ev);
...@@ -75,9 +98,7 @@ EventList::iterator EventList::m_remove(iterator it, bool skip_deletelist) ...@@ -75,9 +98,7 @@ EventList::iterator EventList::m_remove(iterator it, bool skip_deletelist)
// BufferCache<T>::remove() from m_remove(). // BufferCache<T>::remove() from m_remove().
// NOTE: in case the semantics of skip_deletelist change, please adapt the following lines // NOTE: in case the semantics of skip_deletelist change, please adapt the following lines
BPEvent *bp_ev; removeFromCaches((*it));
if((bp_ev = dynamic_cast<BPEvent*>(*it)) != NULL)
m_Bp_cache.remove(bp_ev);
} }
return (m_BufferList.erase(it)); return (m_BufferList.erase(it));
...@@ -99,7 +120,7 @@ void EventList::remove(ExperimentFlow* flow) ...@@ -99,7 +120,7 @@ void EventList::remove(ExperimentFlow* flow)
for (bufferlist_t::iterator it = m_BufferList.begin(); for (bufferlist_t::iterator it = m_BufferList.begin();
it != m_BufferList.end(); it++) it != m_BufferList.end(); it++)
simulator.onEventDeletion(*it); // invoke event handler simulator.onEventDeletion(*it); // invoke event handler
m_Bp_cache.clear(); clearCaches();
m_BufferList.clear(); m_BufferList.clear();
} else { // remove all events corresponding to a specific experiment ("flow"): } else { // remove all events corresponding to a specific experiment ("flow"):
for (bufferlist_t::iterator it = m_BufferList.begin(); for (bufferlist_t::iterator it = m_BufferList.begin();
......
...@@ -30,6 +30,14 @@ typedef std::vector<BaseEvent*> firelist_t; ...@@ -30,6 +30,14 @@ typedef std::vector<BaseEvent*> firelist_t;
*/ */
typedef std::vector<BaseEvent*> deletelist_t; typedef std::vector<BaseEvent*> deletelist_t;
/**
* Cache classes for the most commonly used types of events, utilising static typing.
* Apart from that, they work like bufferlist_t.
*/
typedef BufferCache<BPEvent*> bp_cache_t;
typedef bp_cache_t::iterator bp_iter_t;
typedef BufferCache<IOPortEvent*> io_cache_t;
typedef io_cache_t::iterator io_iter_t;
/** /**
* \class EventList * \class EventList
* *
...@@ -37,7 +45,7 @@ typedef std::vector<BaseEvent*> deletelist_t; ...@@ -37,7 +45,7 @@ typedef std::vector<BaseEvent*> deletelist_t;
* *
* If a event is triggered, the internal data structure will be updated (id est, * If a event is triggered, the internal data structure will be updated (id est,
* the event will be removed from the so called buffer-list and added to the * the event will be removed from the so called buffer-list and added to the
* fire-list). Additionaly, if an experiment-flow deletes an "active" event * fire-list). Additionally, if an experiment-flow deletes an "active" event
* which is currently stored in the fire-list, the event (to be removed) will * which is currently stored in the fire-list, the event (to be removed) will
* be added to a -so called- delete-list. This ensures to prevent triggering * be added to a -so called- delete-list. This ensures to prevent triggering
* "active" events which have already been deleted by a previous experiment * "active" events which have already been deleted by a previous experiment
...@@ -53,8 +61,10 @@ class EventList ...@@ -53,8 +61,10 @@ class EventList
firelist_t m_FireList; //!< the active events (used temporarily) firelist_t m_FireList; //!< the active events (used temporarily)
deletelist_t m_DeleteList; //!< the deleted events (used temporarily) deletelist_t m_DeleteList; //!< the deleted events (used temporarily)
BaseEvent* m_pFired; //!< the recently fired Event-object BaseEvent* m_pFired; //!< the recently fired Event-object
BufferCache<BPEvent*> m_Bp_cache; bp_cache_t m_Bp_cache; //!< the storage cache for breakpoint events
friend int BufferCache<BPEvent*>::makeActive(EventList &ev_list, int idx); io_cache_t m_Io_cache; //!< the storage cache for port i/o events
friend bp_iter_t bp_cache_t::makeActive(EventList &ev_list, bp_iter_t idx);
friend io_iter_t io_cache_t::makeActive(EventList &ev_list, io_iter_t idx);
public: public:
/** /**
* The iterator of this class used to loop through the list of * The iterator of this class used to loop through the list of
...@@ -186,7 +196,27 @@ class EventList ...@@ -186,7 +196,27 @@ class EventList
* Retrieves the BPEvent buffer cache. * Retrieves the BPEvent buffer cache.
* @returns the buffer cache * @returns the buffer cache
*/ */
inline BufferCache<BPEvent*> *getBPBuffer() { return &m_Bp_cache; } inline bp_cache_t &getBPBuffer() { return m_Bp_cache; }
/**
* Retrieves the IOPortEvent buffer cache.
* @returns the buffer cache
*/
inline io_cache_t &getIOBuffer() { return m_Io_cache; }
private:
/**
* Add an event to its appropriate cache.
* @param the event to add
*/
void addToCaches(BaseEvent *ev);
/**
* Remove an event from its cache.
* @param the event to remove
*/
void removeFromCaches(BaseEvent *ev);
/**
* Clear the event caches.
*/
void clearCaches();
}; };
} // end-of-namespace: fail } // end-of-namespace: fail
......
...@@ -91,33 +91,34 @@ void BochsController::dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* ...@@ -91,33 +91,34 @@ void BochsController::dbgEnableInstrPtrOutput(unsigned regularity, std::ostream*
void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_space) void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_space)
{ {
#if 0
//the original code - performs magnitudes worse than
//the code below and is responsible for most (~87 per cent)
//of the slowdown of FailBochs
#ifdef DEBUG #ifdef DEBUG
if(m_Regularity != 0 && ++m_Counter % m_Regularity == 0) if(m_Regularity != 0 && ++m_Counter % m_Regularity == 0)
(*m_pDest) << "0x" << std::hex << instrPtr; (*m_pDest) << "0x" << std::hex << instrPtr;
#endif #endif
bool do_fire = false;
// Check for active breakpoint-events: // Check for active breakpoint-events:
EventList::iterator it = m_EvList.begin(); bp_cache_t &buffer_cache = m_EvList.getBPBuffer();
while(it != m_EvList.end()) bp_cache_t::iterator it = buffer_cache.begin();
while(it != buffer_cache.end())
{ {
// FIXME: Maybe we need to improve the performance of this check. BPEvent* pEvBreakpt = *it;
BPEvent* pEvBreakpt = dynamic_cast<BPEvent*>(*it); if(pEvBreakpt->isMatching(instrPtr, address_space))
if(pEvBreakpt && pEvBreakpt->isMatching(instrPtr, address_space))
{ {
pEvBreakpt->setTriggerInstructionPointer(instrPtr); pEvBreakpt->setTriggerInstructionPointer(instrPtr);
it = m_EvList.makeActive(it); it = buffer_cache.makeActive(m_EvList, it);
do_fire = true;
// "it" has already been set to the next element (by calling // "it" has already been set to the next element (by calling
// makeActive()): // makeActive()):
continue; // -> skip iterator increment continue; // -> skip iterator increment
} }
it++; it++;
} }
m_EvList.fireActiveEvents(); if(do_fire)
#endif m_EvList.fireActiveEvents();
//this code is highly optimised for the average case, so it me appear a bit ugly // Note: SimulatorController::onBreakpointEvent will not be invoked in this
// implementation.
#if 0
//deprecated - this code is ugly
bool do_fire = false; bool do_fire = false;
int i = 0; int i = 0;
BufferCache<BPEvent*> *buffer_cache = m_EvList.getBPBuffer(); BufferCache<BPEvent*> *buffer_cache = m_EvList.getBPBuffer();
...@@ -140,21 +141,20 @@ void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_sp ...@@ -140,21 +141,20 @@ void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_sp
} }
if(do_fire) if(do_fire)
m_EvList.fireActiveEvents(); m_EvList.fireActiveEvents();
// Note: SimulatorController::onBreakpointEvent will not be invoked in this #endif
// implementation.
} }
void BochsController::onIOPortEvent(unsigned char data, unsigned port, bool out) { void BochsController::onIOPortEvent(unsigned char data, unsigned port, bool out) {
// Check for active breakpoint-events: // Check for active breakpoint-events:
EventList::iterator it = m_EvList.begin(); io_cache_t &buffer_cache = m_EvList.getIOBuffer();
while(it != m_EvList.end()) io_cache_t::iterator it = buffer_cache.begin();
while(it != buffer_cache.end())
{ {
// FIXME: Maybe we need to improve the performance of this check. IOPortEvent* pIOPt = (*it);
IOPortEvent* pIOPt = dynamic_cast<IOPortEvent*>(*it); if(pIOPt->isMatching(port, out))
if(pIOPt && pIOPt->isMatching(port, out))
{ {
pIOPt->setData(data); pIOPt->setData(data);
it = m_EvList.makeActive(it); it = buffer_cache.makeActive(m_EvList, it);
// "it" has already been set to the next element (by calling // "it" has already been set to the next element (by calling
// makeActive()): // makeActive()):
continue; // -> skip iterator increment continue; // -> skip iterator increment
......
...@@ -49,7 +49,7 @@ istream& operator>>(istream& in, trace_instr &val) { ...@@ -49,7 +49,7 @@ istream& operator>>(istream& in, trace_instr &val) {
return in; return in;
} }
char const * const state_folder = "l4sys.state"; char const * const state_folder = "l4sys.state";
char const * const instr_list_fn = "ip.list"; char const * const instr_list_fn = "ip.list";
char const * const golden_run_fn = "golden.out"; char const * const golden_run_fn = "golden.out";
address_t const aspace = 0x01e00000; address_t const aspace = 0x01e00000;
...@@ -59,8 +59,7 @@ string golden_run; ...@@ -59,8 +59,7 @@ string golden_run;
//the program needs to run 5 times without a fault //the program needs to run 5 times without a fault
const unsigned times_run = 5; const unsigned times_run = 5;
string L4SysExperiment::sanitised(string in_str) string L4SysExperiment::sanitised(string in_str) {
{
string result; string result;
result.reserve(in_str.size()); result.reserve(in_str.size());
for (string::iterator it = in_str.begin(); it != in_str.end(); it++) { for (string::iterator it = in_str.begin(); it != in_str.end(); it++) {
...@@ -76,8 +75,7 @@ string L4SysExperiment::sanitised(string in_str) ...@@ -76,8 +75,7 @@ string L4SysExperiment::sanitised(string in_str)
return result; return result;
} }
BaseEvent* L4SysExperiment::waitIOOrOther(bool clear_output) BaseEvent* L4SysExperiment::waitIOOrOther(bool clear_output) {
{
IOPortEvent ev_ioport(0x3F8, true); IOPortEvent ev_ioport(0x3F8, true);
BaseEvent* ev = NULL; BaseEvent* ev = NULL;
if (clear_output) if (clear_output)
...@@ -95,8 +93,7 @@ BaseEvent* L4SysExperiment::waitIOOrOther(bool clear_output) ...@@ -95,8 +93,7 @@ BaseEvent* L4SysExperiment::waitIOOrOther(bool clear_output)
return ev; return ev;
} }
bool L4SysExperiment::run() bool L4SysExperiment::run() {
{
Logger log("L4Sys", false); Logger log("L4Sys", false);
BPSingleEvent bp(0, aspace); BPSingleEvent bp(0, aspace);
...@@ -109,8 +106,7 @@ bool L4SysExperiment::run() ...@@ -109,8 +106,7 @@ bool L4SysExperiment::run()
simulator.addEventAndWait(&bp); simulator.addEventAndWait(&bp);
log << "test function entry reached, saving state" << endl; log << "test function entry reached, saving state" << endl;
log << "EIP = " << hex << bp.getTriggerInstructionPointer() log << "EIP = " << hex << bp.getTriggerInstructionPointer() << " or "
<< " or "
<< simulator.getRegisterManager().getInstructionPointer() << simulator.getRegisterManager().getInstructionPointer()
<< endl; << endl;
simulator.save(state_folder); simulator.save(state_folder);
...@@ -213,7 +209,7 @@ bool L4SysExperiment::run() ...@@ -213,7 +209,7 @@ bool L4SysExperiment::run()
} }
// STEP 4: The actual experiment. // STEP 4: The actual experiment.
for (int i = 0; i < L4SYS_NUMINSTR; i++) { while (1) {
log << "restoring state" << endl; log << "restoring state" << endl;
simulator.restore(state_folder); simulator.restore(state_folder);
...@@ -247,9 +243,8 @@ bool L4SysExperiment::run() ...@@ -247,9 +243,8 @@ bool L4SysExperiment::run()
simulator.getRegisterManager().getInstructionPointer(); simulator.getRegisterManager().getInstructionPointer();
param.msg.set_injection_ip(injection_ip); param.msg.set_injection_ip(injection_ip);
log << "inject @ ip " << injection_ip << " (offset " << dec log << "inject @ ip " << injection_ip << " (offset " << dec
<< instr_offset << ")" << " bit " << bit_offset << ": 0x" << instr_offset << ")" << " bit " << bit_offset << ": 0x" << hex
<< hex << ((int) data) << " -> 0x" << ((int) newdata) << ((int) data) << " -> 0x" << ((int) newdata) << endl;
<< endl;
// sanity check (only works if we're working with an instruction trace) // sanity check (only works if we're working with an instruction trace)
if (injection_ip != instr_list[instr_offset].trigger_addr) { if (injection_ip != instr_list[instr_offset].trigger_addr) {
...@@ -263,7 +258,7 @@ bool L4SysExperiment::run() ...@@ -263,7 +258,7 @@ bool L4SysExperiment::run()
simulator.clearEvents(); simulator.clearEvents();
m_jc.sendResult(param); m_jc.sendResult(param);
continue; simulator.terminate(20);
} }
// aftermath // aftermath
...@@ -305,8 +300,7 @@ bool L4SysExperiment::run() ...@@ -305,8 +300,7 @@ bool L4SysExperiment::run()
simulator.getRegisterManager().getInstructionPointer()); simulator.getRegisterManager().getInstructionPointer());
param.msg.set_output(sanitised(output.c_str())); param.msg.set_output(sanitised(output.c_str()));
} else if (ev == &ev_trap) { } else if (ev == &ev_trap) {
log << dec << "Result TRAP #" << ev_trap.getTriggerNumber() log << dec << "Result TRAP #" << ev_trap.getTriggerNumber() << endl;
<< endl;
param.msg.set_resulttype(param.msg.TRAP); param.msg.set_resulttype(param.msg.TRAP);
param.msg.set_resultdata( param.msg.set_resultdata(
simulator.getRegisterManager().getInstructionPointer()); simulator.getRegisterManager().getInstructionPointer());
...@@ -339,6 +333,7 @@ bool L4SysExperiment::run() ...@@ -339,6 +333,7 @@ bool L4SysExperiment::run()
#ifdef HEADLESS_EXPERIMENT #ifdef HEADLESS_EXPERIMENT
simulator.terminate(0); simulator.terminate(0);
#endif #endif
// experiment successfully conducted
// experiment successfully conducted
return true; return true;
} }
#ifndef __EXPERIMENT_INFO_HPP__ #ifndef __EXPERIMENT_INFO_HPP__
#define __EXPERIMENT_INFO_HPP__ #define __EXPERIMENT_INFO_HPP__
// FIXME autogenerate this //experiment types:
#define GPRFLIP 10
#define IDCFLIP 20
#define L4SYS_FUNC_ENTRY 0x1007cd0 #define L4SYS_FUNC_ENTRY 0x1007cd0
#define L4SYS_FUNC_EXIT 0x1007d3a #define L4SYS_FUNC_EXIT 0x1007d3a
#define L4SYS_NUMINSTR 3184 #define L4SYS_NUMINSTR 3184
//#define HEADLESS_EXPERIMENT #define HEADLESS_EXPERIMENT
#define PREPARE_EXPERIMENT #define EXPERIMENT_TYPE IDCFLIP
//#define PREPARE_EXPERIMENT
#endif // __EXPERIMENT_INFO_HPP__ #endif // __EXPERIMENT_INFO_HPP__
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment