From db8a9ab553535551ce80dcd5ce07cffb85f5cfb7 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 11 Jan 2019 18:08:21 -0800 Subject: 4921 --- html/subx/021byte_addressing.cc.html | 41 ++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'html/subx/021byte_addressing.cc.html') diff --git a/html/subx/021byte_addressing.cc.html b/html/subx/021byte_addressing.cc.html index 71b63a6a..0ddbdc29 100644 --- a/html/subx/021byte_addressing.cc.html +++ b/html/subx/021byte_addressing.cc.html @@ -15,6 +15,7 @@ body { font-size:12pt; font-family: monospace; color: #000000; background-color: a { color:inherit; } * { font-size:12pt; font-size: 1em; } .traceContains { color: #005f00; } +.PreProc { color: #c000c0; } .LineNr { } .Constant { color: #008787; } .Delimiter { color: #c000c0; } @@ -108,7 +109,7 @@ if ('onhashchange' in window) { 48 88 18 # copy BL to the byte at *EAX 49 # ModR/M in binary: 00 (indirect mode) 011 (src BL) 000 (dest EAX) 50 == 0x2000 - 51 f0 cc bb aa # 0xf0 with more data in following bytes + 51 f0 cc bb aa 52 +run: copy BL to r8/m8-at-r32 53 +run: effective address is 0x00002000 (EAX) 54 +run: storing 0xab @@ -158,7 +159,7 @@ if ('onhashchange' in window) { 98 trace(90, "run") << "storing 0x" << HEXBYTE << NUM(*src) << end(); 99 *dest = *src; 100 const uint8_t rdest_32bit = rdest & 0x3; -101 trace(90, "run") << rname(rdest_32bit) << " now contains 0x" << HEXWORD << Reg[rdest_32bit].u << end(); +101 trace(90, "run") << rname(rdest_32bit) << " now contains 0x" << HEXWORD << Reg[rdest_32bit].u << end(); 102 break; 103 } 104 @@ -174,6 +175,42 @@ if ('onhashchange' in window) { 114 +run: storing 0x44 115 # ensure ESI is unchanged 116 % CHECK_EQ(Reg[ESI].u, 0xaabbccdd); +117 +118 //: +119 +120 :(before "End Initialize Op Names") +121 put_new(Name, "c6", "copy imm8 to r8/m8-at-r32 (mov)"); +122 +123 :(scenario copy_imm8_to_mem_at_r32) +124 % Reg[EAX].i = 0x2000; +125 == 0x1 +126 # op ModR/M SIB displacement immediate +127 c6 00 dd # copy to the byte at *EAX +128 # ModR/M in binary: 00 (indirect mode) 000 (unused) 000 (dest EAX) +129 == 0x2000 +130 f0 cc bb aa +131 +run: copy imm8 to r8/m8-at-r32 +132 +run: effective address is 0x00002000 (EAX) +133 +run: storing 0xdd +134 % CHECK_EQ(0xaabbccdd, read_mem_u32(0x2000)); +135 +136 :(before "End Single-Byte Opcodes") +137 case 0xc6: { // copy imm8 to r/m8 +138 const uint8_t modrm = next(); +139 const uint8_t src = next(); +140 trace(90, "run") << "copy imm8 to r8/m8-at-r32" << end(); +141 trace(90, "run") << "imm8 is 0x" << HEXWORD << src << end(); +142 const uint8_t subop = (modrm>>3)&0x7; // middle 3 'reg opcode' bits +143 if (subop != 0) { +144 cerr << "unrecognized subop for opcode c6: " << NUM(subop) << " (only 0/copy currently implemented)\n"; +145 exit(1); +146 } +147 // use unsigned to zero-extend 8-bit value to 32 bits +148 uint8_t* dest = reinterpret_cast<uint8_t*>(effective_byte_address(modrm)); +149 *dest = src; +150 trace(90, "run") << "storing 0x" << HEXBYTE << NUM(*dest) << end(); +151 break; +152 } -- cgit 1.4.1-2-gfad0