diff options
Diffstat (limited to 'html/011run.cc.html')
-rw-r--r-- | html/011run.cc.html | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/html/011run.cc.html b/html/011run.cc.html index 4f30046d..b8a0963e 100644 --- a/html/011run.cc.html +++ b/html/011run.cc.html @@ -152,11 +152,11 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <span class="Comment">// convenience to keep tests concise: 'Entry' label need not be provided</span> <span id="L93" class="LineNr"> 93 </span> <span class="Comment">// not allowed in real programs</span> <span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">.</span><a href='011run.cc.html#L106'>entry</a><span class="Delimiter">)</span> -<span id="L95" class="LineNr"> 95 </span> <a href='010---vm.cc.html#L29'>EIP</a> = p<span class="Delimiter">.</span><a href='011run.cc.html#L106'>entry</a><span class="Delimiter">;</span> +<span id="L95" class="LineNr"> 95 </span> <a href='010---vm.cc.html#L32'>EIP</a> = p<span class="Delimiter">.</span><a href='011run.cc.html#L106'>entry</a><span class="Delimiter">;</span> <span id="L96" class="LineNr"> 96 </span> <span class="Normal">else</span> -<span id="L97" class="LineNr"> 97 </span> <a href='010---vm.cc.html#L29'>EIP</a> = find<span class="Delimiter">(</span>p<span class="Delimiter">,</span> <span class="Constant">"code"</span><span class="Delimiter">)-></span>start<span class="Delimiter">;</span> -<span id="L98" class="LineNr"> 98 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='010---vm.cc.html#L29'>EIP</a> < <span class="Special"><a href='010---vm.cc.html#L160'>End_of_program</a></span><span class="Delimiter">)</span> -<span id="L99" class="LineNr"> 99 </span> <a href='010---vm.cc.html#L267'>run_one_instruction</a><span class="Delimiter">();</span> +<span id="L97" class="LineNr"> 97 </span> <a href='010---vm.cc.html#L32'>EIP</a> = find<span class="Delimiter">(</span>p<span class="Delimiter">,</span> <span class="Constant">"code"</span><span class="Delimiter">)-></span>start<span class="Delimiter">;</span> +<span id="L98" class="LineNr"> 98 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='010---vm.cc.html#L32'>EIP</a> < <span class="Special"><a href='010---vm.cc.html#L163'>End_of_program</a></span><span class="Delimiter">)</span> +<span id="L99" class="LineNr"> 99 </span> <a href='010---vm.cc.html#L270'>run_one_instruction</a><span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span><span class="Delimiter">}</span> <span id="L101" class="LineNr">101 </span> <span id="L102" class="LineNr">102 </span><span class="SalientComment">//:: core data structures</span> @@ -229,7 +229,7 @@ if ('onhashchange' in window) { <span id="L169" class="LineNr">169 </span> curr_segment<span class="Delimiter">-></span><a href='011run.cc.html#L112'>name</a> = segment_name<span class="Delimiter">;</span> <span id="L170" class="LineNr">170 </span> curr_segment<span class="Delimiter">-></span>start = seg_start<span class="Delimiter">;</span> <span id="L171" class="LineNr">171 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='003trace.cc.html#L262'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L172" class="LineNr">172 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"starts at address 0x"</span> << <a href='010---vm.cc.html#L398'>HEXWORD</a> << curr_segment<span class="Delimiter">-></span>start << end<span class="Delimiter">();</span> +<span id="L172" class="LineNr">172 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"starts at address 0x"</span> << <a href='010---vm.cc.html#L401'>HEXWORD</a> << curr_segment<span class="Delimiter">-></span>start << end<span class="Delimiter">();</span> <span id="L173" class="LineNr">173 </span> <span class="Delimiter">}</span> <span id="L174" class="LineNr">174 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// skip rest of line</span> <span id="L175" class="LineNr">175 </span> <span class="Delimiter">}</span> @@ -330,8 +330,8 @@ if ('onhashchange' in window) { <span id="L270" class="LineNr">270 </span> <span class="Normal">const</span> segment& seg = p<span class="Delimiter">.</span><a href='011run.cc.html#L107'>segments</a><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L271" class="LineNr">271 </span> <span class="Normal">uint32_t</span> addr = seg<span class="Delimiter">.</span>start<span class="Delimiter">;</span> <span id="L272" class="LineNr">272 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!already_allocated<span class="Delimiter">(</span>addr<span class="Delimiter">))</span> -<span id="L273" class="LineNr">273 </span> <span class="Special"><a href='010---vm.cc.html#L157'>Mem</a></span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>vma<span class="Delimiter">(</span>seg<span class="Delimiter">.</span>start<span class="Delimiter">));</span> -<span id="L274" class="LineNr">274 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">99</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"loading segment "</span> << i << <span class="Constant">" from "</span> << <a href='010---vm.cc.html#L398'>HEXWORD</a> << addr << end<span class="Delimiter">();</span> +<span id="L273" class="LineNr">273 </span> <span class="Special"><a href='010---vm.cc.html#L160'>Mem</a></span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>vma<span class="Delimiter">(</span>seg<span class="Delimiter">.</span>start<span class="Delimiter">));</span> +<span id="L274" class="LineNr">274 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">99</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"loading segment "</span> << i << <span class="Constant">" from "</span> << <a href='010---vm.cc.html#L401'>HEXWORD</a> << addr << end<span class="Delimiter">();</span> <span id="L275" class="LineNr">275 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Constant">0</span><span class="Delimiter">;</span> j < <a href='001help.cc.html#L164'>SIZE</a><span class="Delimiter">(</span>seg<span class="Delimiter">.</span><a href='011run.cc.html#L114'>lines</a><span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L276" class="LineNr">276 </span> <span class="Normal">const</span> line& l = seg<span class="Delimiter">.</span><a href='011run.cc.html#L114'>lines</a><span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> <span id="L277" class="LineNr">277 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> k = <span class="Constant">0</span><span class="Delimiter">;</span> k < <a href='001help.cc.html#L164'>SIZE</a><span class="Delimiter">(</span>l<span class="Delimiter">.</span><a href='011run.cc.html#L123'>words</a><span class="Delimiter">);</span> ++k<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -339,14 +339,14 @@ if ('onhashchange' in window) { <span id="L279" class="LineNr">279 </span> <span class="Normal">uint8_t</span> val = <a href='011run.cc.html#L302'>hex_byte</a><span class="Delimiter">(</span>w<span class="Delimiter">.</span>data<span class="Delimiter">);</span> <span id="L280" class="LineNr">280 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='003trace.cc.html#L262'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L281" class="LineNr">281 </span> assert<span class="Delimiter">(</span>overlap<span class="Delimiter">.</span>find<span class="Delimiter">(</span>addr<span class="Delimiter">)</span> == overlap<span class="Delimiter">.</span>end<span class="Delimiter">());</span> -<span id="L282" class="LineNr">282 </span> <a href='010---vm.cc.html#L234'>write_mem_u8</a><span class="Delimiter">(</span>addr<span class="Delimiter">,</span> val<span class="Delimiter">);</span> +<span id="L282" class="LineNr">282 </span> <a href='010---vm.cc.html#L237'>write_mem_u8</a><span class="Delimiter">(</span>addr<span class="Delimiter">,</span> val<span class="Delimiter">);</span> <span id="L283" class="LineNr">283 </span> overlap<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>addr<span class="Delimiter">);</span> -<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">99</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"0x"</span> << <a href='010---vm.cc.html#L398'>HEXWORD</a> << addr << <span class="Constant">" -> "</span> << <a href='010---vm.cc.html#L397'>HEXBYTE</a> << <a href='010---vm.cc.html#L400'>NUM</a><span class="Delimiter">(</span><a href='010---vm.cc.html#L168'>read_mem_u8</a><span class="Delimiter">(</span>addr<span class="Delimiter">))</span> << end<span class="Delimiter">();</span> +<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Constant">99</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"0x"</span> << <a href='010---vm.cc.html#L401'>HEXWORD</a> << addr << <span class="Constant">" -> "</span> << <a href='010---vm.cc.html#L400'>HEXBYTE</a> << <a href='010---vm.cc.html#L403'>NUM</a><span class="Delimiter">(</span><a href='010---vm.cc.html#L171'>read_mem_u8</a><span class="Delimiter">(</span>addr<span class="Delimiter">))</span> << end<span class="Delimiter">();</span> <span id="L285" class="LineNr">285 </span> ++addr<span class="Delimiter">;</span> <span id="L286" class="LineNr">286 </span> <span class="Delimiter">}</span> <span id="L287" class="LineNr">287 </span> <span class="Delimiter">}</span> <span id="L288" class="LineNr">288 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>seg<span class="Delimiter">.</span><a href='011run.cc.html#L112'>name</a> == <span class="Constant">"code"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L289" class="LineNr">289 </span> <span class="Special"><a href='010---vm.cc.html#L160'>End_of_program</a></span> = addr<span class="Delimiter">;</span> +<span id="L289" class="LineNr">289 </span> <span class="Special"><a href='010---vm.cc.html#L163'>End_of_program</a></span> = addr<span class="Delimiter">;</span> <span id="L290" class="LineNr">290 </span> <span class="Delimiter">}</span> <span id="L291" class="LineNr">291 </span> <span class="Delimiter">}</span> <span id="L292" class="LineNr">292 </span><span class="Delimiter">}</span> @@ -479,15 +479,15 @@ if ('onhashchange' in window) { <span id="L419" class="LineNr">419 </span><span class="SalientComment">//:: run</span> <span id="L420" class="LineNr">420 </span> <span id="L421" class="LineNr">421 </span><span class="Delimiter">:(before "End Initialize Op Names")</span> -<span id="L422" class="LineNr">422 </span><a href='001help.cc.html#L260'>put_new</a><span class="Delimiter">(</span><span class="Special"><a href='010---vm.cc.html#L345'>Name</a></span><span class="Delimiter">,</span> <span class="Constant">"b8"</span><span class="Delimiter">,</span> <span class="Constant">"copy imm32 to <a href='010---vm.cc.html#L13'>EAX</a> (mov)"</span><span class="Delimiter">);</span> +<span id="L422" class="LineNr">422 </span><a href='001help.cc.html#L260'>put_new</a><span class="Delimiter">(</span><span class="Special"><a href='010---vm.cc.html#L348'>Name</a></span><span class="Delimiter">,</span> <span class="Constant">"b8"</span><span class="Delimiter">,</span> <span class="Constant">"copy imm32 to <a href='010---vm.cc.html#L16'>EAX</a> (mov)"</span><span class="Delimiter">);</span> <span id="L423" class="LineNr">423 </span> <span id="L424" class="LineNr">424 </span><span class="Comment">//: our first opcode</span> <span id="L425" class="LineNr">425 </span> <span id="L426" class="LineNr">426 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> <span id="L427" class="LineNr">427 </span><span class="Normal">case</span> <span class="Constant">0xb8</span>: <span class="Delimiter">{</span> <span class="Comment">// copy imm32 to EAX</span> <span id="L428" class="LineNr">428 </span> <span class="Normal">const</span> <span class="Normal">int32_t</span> src = <a href='011run.cc.html#L447'>next32</a><span class="Delimiter">();</span> -<span id="L429" class="LineNr">429 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Special">Callstack_depth</span>+<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy imm32 0x"</span> << <a href='010---vm.cc.html#L398'>HEXWORD</a> << src << <span class="Constant">" to EAX"</span> << end<span class="Delimiter">();</span> -<span id="L430" class="LineNr">430 </span> <span class="Special"><a href='010---vm.cc.html#L28'>Reg</a></span>[EAX]<span class="Delimiter">.</span>i = src<span class="Delimiter">;</span> +<span id="L429" class="LineNr">429 </span> <a href='003trace.cc.html#L96'>trace</a><span class="Delimiter">(</span><span class="Special">Callstack_depth</span>+<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy imm32 0x"</span> << <a href='010---vm.cc.html#L401'>HEXWORD</a> << src << <span class="Constant">" to EAX"</span> << end<span class="Delimiter">();</span> +<span id="L430" class="LineNr">430 </span> <span class="Special"><a href='010---vm.cc.html#L31'>Reg</a></span>[EAX]<span class="Delimiter">.</span>i = src<span class="Delimiter">;</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L432" class="LineNr">432 </span><span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </span> @@ -505,7 +505,7 @@ if ('onhashchange' in window) { <span id="L445" class="LineNr">445 </span> <span id="L446" class="LineNr">446 </span><span class="Comment">// read a 32-bit int in little-endian order from the instruction stream</span> <span id="L447" class="LineNr">447 </span><span class="Normal">int32_t</span> <a href='011run.cc.html#L447'>next32</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L448" class="LineNr">448 </span> <span class="Normal">int32_t</span> result = <a href='010---vm.cc.html#L179'>read_mem_i32</a><span class="Delimiter">(</span><a href='010---vm.cc.html#L29'>EIP</a><span class="Delimiter">);</span> +<span id="L448" class="LineNr">448 </span> <span class="Normal">int32_t</span> result = <a href='010---vm.cc.html#L182'>read_mem_i32</a><span class="Delimiter">(</span><a href='010---vm.cc.html#L32'>EIP</a><span class="Delimiter">);</span> <span id="L449" class="LineNr">449 </span> EIP+=<span class="Constant">4</span><span class="Delimiter">;</span> <span id="L450" class="LineNr">450 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L451" class="LineNr">451 </span><span class="Delimiter">}</span> |