diff options
Diffstat (limited to 'html/subx')
-rw-r--r-- | html/subx/011direct_addressing.cc.html | 2 | ||||
-rw-r--r-- | html/subx/013immediate_addressing.cc.html | 104 |
2 files changed, 56 insertions, 50 deletions
diff --git a/html/subx/011direct_addressing.cc.html b/html/subx/011direct_addressing.cc.html index a08f0e3f..f9508be6 100644 --- a/html/subx/011direct_addressing.cc.html +++ b/html/subx/011direct_addressing.cc.html @@ -300,7 +300,7 @@ if ('onhashchange' in window) { <span id="L235" class="LineNr">235 </span><span class="Normal">case</span> <span class="Constant">0x54</span>: <span id="L236" class="LineNr">236 </span><span class="Normal">case</span> <span class="Constant">0x55</span>: <span id="L237" class="LineNr">237 </span><span class="Normal">case</span> <span class="Constant">0x56</span>: -<span id="L238" class="LineNr">238 </span><span class="Normal">case</span> <span class="Constant">0x57</span>: <span class="Delimiter">{</span> +<span id="L238" class="LineNr">238 </span><span class="Normal">case</span> <span class="Constant">0x57</span>: <span class="Delimiter">{</span> <span class="Comment">// push r32 to stack</span> <span id="L239" class="LineNr">239 </span> <span class="Normal">uint8_t</span> <a href='010core.cc.html#L17'>reg</a> = op & <span class="Constant">0x7</span><span class="Delimiter">;</span> <span id="L240" class="LineNr">240 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"push <a href='010core.cc.html#L17'>reg</a> "</span> << <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span><a href='010core.cc.html#L17'>reg</a><span class="Delimiter">)</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> <span id="L241" class="LineNr">241 </span> <span class="Normal">const</span> <span class="Normal">int32_t</span> val = Reg[reg]<span class="Delimiter">.</span>u<span class="Delimiter">;</span> diff --git a/html/subx/013immediate_addressing.cc.html b/html/subx/013immediate_addressing.cc.html index 6215b01c..80939a21 100644 --- a/html/subx/013immediate_addressing.cc.html +++ b/html/subx/013immediate_addressing.cc.html @@ -396,58 +396,64 @@ if ('onhashchange' in window) { <span id="L332" class="LineNr">332 </span> <span id="L333" class="LineNr">333 </span><span class="Delimiter">:(scenario copy_imm32_to_r32)</span> <span id="L334" class="LineNr">334 </span><span class="Comment"># op ModRM SIB displacement immediate</span> -<span id="L335" class="LineNr">335 </span> b8 <span class="PreProc">0</span><span class="Constant">3</span> 0a 0b 0c 0d <span class="Comment"># copy 0x0d0c0b0a to EBX (reg 3)</span> +<span id="L335" class="LineNr">335 </span> bb 0a 0b 0c 0d <span class="Comment"># copy 0x0d0c0b0a to EBX (reg 3)</span> <span id="L336" class="LineNr">336 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L219'>imm32</a> 0x0d0c0b0a to <a href='010core.cc.html#L17'>reg</a> 3</span> <span id="L337" class="LineNr">337 </span> <span id="L338" class="LineNr">338 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> -<span id="L339" class="LineNr">339 </span><span class="Normal">case</span> <span class="Constant">0xb8</span>: <span class="Delimiter">{</span> <span class="Comment">// copy imm32 to r32</span> -<span id="L340" class="LineNr">340 </span> <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L214'>next</a><span class="Delimiter">();</span> -<span id="L341" class="LineNr">341 </span> <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> -<span id="L342" class="LineNr">342 </span> <span class="Normal">uint8_t</span> reg1 = modrm&<span class="Constant">0x7</span><span class="Delimiter">;</span> <span class="Comment">// ignore mod bits</span> -<span id="L343" class="LineNr">343 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << arg2 << <span class="Constant">" to <a href='010core.cc.html#L17'>reg</a> "</span> << <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span>reg1<span class="Delimiter">)</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> -<span id="L344" class="LineNr">344 </span> Reg[reg1]<span class="Delimiter">.</span>i = arg2<span class="Delimiter">;</span> -<span id="L345" class="LineNr">345 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L346" class="LineNr">346 </span><span class="Delimiter">}</span> -<span id="L347" class="LineNr">347 </span> -<span id="L348" class="LineNr">348 </span><span class="Comment">//:</span> -<span id="L349" class="LineNr">349 </span> -<span id="L350" class="LineNr">350 </span><span class="Delimiter">:(scenario copy_imm32_to_mem_at_r32)</span> -<span id="L351" class="LineNr">351 </span><span class="Special">% Reg[3].i = 0x60;</span> -<span id="L352" class="LineNr">352 </span><span class="Comment"># op ModRM SIB displacement immediate</span> -<span id="L353" class="LineNr">353 </span> c7 <span class="PreProc">0</span><span class="Constant">3</span> 0a 0b 0c 0d <span class="Comment"># copy 0x0d0c0b0a to *EBX (reg 3)</span> -<span id="L354" class="LineNr">354 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L219'>imm32</a> 0x0d0c0b0a to effective address</span> -<span id="L355" class="LineNr">355 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 3)</span> -<span id="L356" class="LineNr">356 </span> -<span id="L357" class="LineNr">357 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> -<span id="L358" class="LineNr">358 </span><span class="Normal">case</span> <span class="Constant">0xc7</span>: <span class="Delimiter">{</span> <span class="Comment">// copy imm32 to r32</span> -<span id="L359" class="LineNr">359 </span> <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L214'>next</a><span class="Delimiter">();</span> -<span id="L360" class="LineNr">360 </span> <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> -<span id="L361" class="LineNr">361 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << arg2 << <span class="Constant">" to effective address"</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> -<span id="L362" class="LineNr">362 </span> <span class="Normal">int32_t</span>* arg1 = <a href='011direct_addressing.cc.html#L26'>effective_address</a><span class="Delimiter">(</span>modrm<span class="Delimiter">);</span> -<span id="L363" class="LineNr">363 </span> *arg1 = arg2<span class="Delimiter">;</span> -<span id="L364" class="LineNr">364 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L365" class="LineNr">365 </span><span class="Delimiter">}</span> -<span id="L366" class="LineNr">366 </span> -<span id="L367" class="LineNr">367 </span><span class="SalientComment">//:: push</span> -<span id="L368" class="LineNr">368 </span> -<span id="L369" class="LineNr">369 </span><span class="Delimiter">:(scenario push_imm32)</span> -<span id="L370" class="LineNr">370 </span><span class="Special">% Reg[ESP].u = 0x14;</span> -<span id="L371" class="LineNr">371 </span><span class="Comment"># op ModRM SIB displacement immediate</span> -<span id="L372" class="LineNr">372 </span> <span class="Constant">68</span> af <span class="PreProc">0</span><span class="Constant">0</span> <span class="PreProc">0</span><span class="Constant">0</span> <span class="PreProc">0</span><span class="Constant">0</span> <span class="Comment"># push *EAX (reg 0) to stack</span> -<span id="L373" class="LineNr">373 </span><span class="traceContains">+run: push <a href='010core.cc.html#L219'>imm32</a> 0x000000af</span> -<span id="L374" class="LineNr">374 </span><span class="traceContains">+run: <a href='010core.cc.html#L11'>ESP</a> is now 0x00000010</span> -<span id="L375" class="LineNr">375 </span><span class="traceContains">+run: <a href='003trace.cc.html#L74'>contents</a> at <a href='010core.cc.html#L11'>ESP</a>: 0x000000af</span> -<span id="L376" class="LineNr">376 </span> -<span id="L377" class="LineNr">377 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> -<span id="L378" class="LineNr">378 </span><span class="Normal">case</span> <span class="Constant">0x68</span>: <span class="Delimiter">{</span> -<span id="L379" class="LineNr">379 </span> <span class="Normal">int32_t</span> val = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> -<span id="L380" class="LineNr">380 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"push <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << val << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> -<span id="L381" class="LineNr">381 </span> Reg[ESP]<span class="Delimiter">.</span>u -= <span class="Constant">4</span><span class="Delimiter">;</span> -<span id="L382" class="LineNr">382 </span> *<span class="Normal">reinterpret_cast</span><<span class="Normal">uint32_t</span>*><span class="Delimiter">(</span>&Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> = val<span class="Delimiter">;</span> -<span id="L383" class="LineNr">383 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ESP is now 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << Reg[ESP]<span class="Delimiter">.</span>u << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> -<span id="L384" class="LineNr">384 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"contents at <a href='010core.cc.html#L11'>ESP</a>: 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << *<span class="Normal">reinterpret_cast</span><<span class="Normal">uint32_t</span>*><span class="Delimiter">(</span>&Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> -<span id="L385" class="LineNr">385 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L386" class="LineNr">386 </span><span class="Delimiter">}</span> +<span id="L339" class="LineNr">339 </span><span class="Normal">case</span> <span class="Constant">0xb8</span>: +<span id="L340" class="LineNr">340 </span><span class="Normal">case</span> <span class="Constant">0xb9</span>: +<span id="L341" class="LineNr">341 </span><span class="Normal">case</span> <span class="Constant">0xba</span>: +<span id="L342" class="LineNr">342 </span><span class="Normal">case</span> <span class="Constant">0xbb</span>: +<span id="L343" class="LineNr">343 </span><span class="Normal">case</span> <span class="Constant">0xbc</span>: +<span id="L344" class="LineNr">344 </span><span class="Normal">case</span> <span class="Constant">0xbd</span>: +<span id="L345" class="LineNr">345 </span><span class="Normal">case</span> <span class="Constant">0xbe</span>: +<span id="L346" class="LineNr">346 </span><span class="Normal">case</span> <span class="Constant">0xbf</span>: <span class="Delimiter">{</span> <span class="Comment">// copy imm32 to r32</span> +<span id="L347" class="LineNr">347 </span> <span class="Normal">uint8_t</span> reg1 = op & <span class="Constant">0x7</span><span class="Delimiter">;</span> +<span id="L348" class="LineNr">348 </span> <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> +<span id="L349" class="LineNr">349 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << arg2 << <span class="Constant">" to <a href='010core.cc.html#L17'>reg</a> "</span> << <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span>reg1<span class="Delimiter">)</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> +<span id="L350" class="LineNr">350 </span> Reg[reg1]<span class="Delimiter">.</span>i = arg2<span class="Delimiter">;</span> +<span id="L351" class="LineNr">351 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L352" class="LineNr">352 </span><span class="Delimiter">}</span> +<span id="L353" class="LineNr">353 </span> +<span id="L354" class="LineNr">354 </span><span class="Comment">//:</span> +<span id="L355" class="LineNr">355 </span> +<span id="L356" class="LineNr">356 </span><span class="Delimiter">:(scenario copy_imm32_to_mem_at_r32)</span> +<span id="L357" class="LineNr">357 </span><span class="Special">% Reg[3].i = 0x60;</span> +<span id="L358" class="LineNr">358 </span><span class="Comment"># op ModRM SIB displacement immediate</span> +<span id="L359" class="LineNr">359 </span> c7 <span class="PreProc">0</span><span class="Constant">3</span> 0a 0b 0c 0d <span class="Comment"># copy 0x0d0c0b0a to *EBX (reg 3)</span> +<span id="L360" class="LineNr">360 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L219'>imm32</a> 0x0d0c0b0a to effective address</span> +<span id="L361" class="LineNr">361 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 3)</span> +<span id="L362" class="LineNr">362 </span> +<span id="L363" class="LineNr">363 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> +<span id="L364" class="LineNr">364 </span><span class="Normal">case</span> <span class="Constant">0xc7</span>: <span class="Delimiter">{</span> <span class="Comment">// copy imm32 to r32</span> +<span id="L365" class="LineNr">365 </span> <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L214'>next</a><span class="Delimiter">();</span> +<span id="L366" class="LineNr">366 </span> <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> +<span id="L367" class="LineNr">367 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"copy <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << arg2 << <span class="Constant">" to effective address"</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> +<span id="L368" class="LineNr">368 </span> <span class="Normal">int32_t</span>* arg1 = <a href='011direct_addressing.cc.html#L26'>effective_address</a><span class="Delimiter">(</span>modrm<span class="Delimiter">);</span> +<span id="L369" class="LineNr">369 </span> *arg1 = arg2<span class="Delimiter">;</span> +<span id="L370" class="LineNr">370 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L371" class="LineNr">371 </span><span class="Delimiter">}</span> +<span id="L372" class="LineNr">372 </span> +<span id="L373" class="LineNr">373 </span><span class="SalientComment">//:: push</span> +<span id="L374" class="LineNr">374 </span> +<span id="L375" class="LineNr">375 </span><span class="Delimiter">:(scenario push_imm32)</span> +<span id="L376" class="LineNr">376 </span><span class="Special">% Reg[ESP].u = 0x14;</span> +<span id="L377" class="LineNr">377 </span><span class="Comment"># op ModRM SIB displacement immediate</span> +<span id="L378" class="LineNr">378 </span> <span class="Constant">68</span> af <span class="PreProc">0</span><span class="Constant">0</span> <span class="PreProc">0</span><span class="Constant">0</span> <span class="PreProc">0</span><span class="Constant">0</span> <span class="Comment"># push *EAX (reg 0) to stack</span> +<span id="L379" class="LineNr">379 </span><span class="traceContains">+run: push <a href='010core.cc.html#L219'>imm32</a> 0x000000af</span> +<span id="L380" class="LineNr">380 </span><span class="traceContains">+run: <a href='010core.cc.html#L11'>ESP</a> is now 0x00000010</span> +<span id="L381" class="LineNr">381 </span><span class="traceContains">+run: <a href='003trace.cc.html#L74'>contents</a> at <a href='010core.cc.html#L11'>ESP</a>: 0x000000af</span> +<span id="L382" class="LineNr">382 </span> +<span id="L383" class="LineNr">383 </span><span class="Delimiter">:(before "End Single-Byte Opcodes")</span> +<span id="L384" class="LineNr">384 </span><span class="Normal">case</span> <span class="Constant">0x68</span>: <span class="Delimiter">{</span> +<span id="L385" class="LineNr">385 </span> <span class="Normal">int32_t</span> val = <a href='010core.cc.html#L219'>imm32</a><span class="Delimiter">();</span> +<span id="L386" class="LineNr">386 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"push <a href='010core.cc.html#L219'>imm32</a> 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << val << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> +<span id="L387" class="LineNr">387 </span> Reg[ESP]<span class="Delimiter">.</span>u -= <span class="Constant">4</span><span class="Delimiter">;</span> +<span id="L388" class="LineNr">388 </span> *<span class="Normal">reinterpret_cast</span><<span class="Normal">uint32_t</span>*><span class="Delimiter">(</span>&Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> = val<span class="Delimiter">;</span> +<span id="L389" class="LineNr">389 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ESP is now 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << Reg[ESP]<span class="Delimiter">.</span>u << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> +<span id="L390" class="LineNr">390 </span> <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"contents at <a href='010core.cc.html#L11'>ESP</a>: 0x"</span> << <a href='010core.cc.html#L230'>HEXWORD</a> << *<span class="Normal">reinterpret_cast</span><<span class="Normal">uint32_t</span>*><span class="Delimiter">(</span>&Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> << <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span> +<span id="L391" class="LineNr">391 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L392" class="LineNr">392 </span><span class="Delimiter">}</span> </pre> </body> </html> |