From cdfff1a18d2203b8493f8700ab694c1c05ef6161 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 16 Dec 2018 20:52:47 -0800 Subject: 4869 --- html/subx/015immediate_addressing.cc.html | 90 +++++++++++++++---------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'html/subx/015immediate_addressing.cc.html') diff --git a/html/subx/015immediate_addressing.cc.html b/html/subx/015immediate_addressing.cc.html index edf0fbec..989e30a5 100644 --- a/html/subx/015immediate_addressing.cc.html +++ b/html/subx/015immediate_addressing.cc.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { 1 //: instructions that (immediately) contain an argument to act with 2 3 :(before "End Initialize Op Names") - 4 put_new(Name, "81", "combine rm32 with imm32 based on subop (add/sub/and/or/xor/cmp)"); + 4 put_new(Name, "81", "combine rm32 with imm32 based on subop (add/sub/and/or/xor/cmp)"); 5 6 :(scenario add_imm32_to_r32) 7 % Reg[EBX].i = 1; @@ -84,15 +84,15 @@ if ('onhashchange' in window) { 17 18 :(before "End Single-Byte Opcodes") 19 case 0x81: { // combine imm32 with r/m32 - 20 trace(90, "run") << "combine imm32 with r/m32" << end(); + 20 trace(90, "run") << "combine imm32 with r/m32" << end(); 21 const uint8_t modrm = next(); 22 int32_t* arg1 = effective_address(modrm); 23 const int32_t arg2 = next32(); - 24 trace(90, "run") << "imm32 is 0x" << HEXWORD << arg2 << end(); + 24 trace(90, "run") << "imm32 is 0x" << HEXWORD << arg2 << end(); 25 const uint8_t subop = (modrm>>3)&0x7; // middle 3 'reg opcode' bits 26 switch (subop) { 27 case 0: - 28 trace(90, "run") << "subop add" << end(); + 28 trace(90, "run") << "subop add" << end(); 29 BINARY_ARITHMETIC_OP(+, *arg1, arg2); 30 break; 31 // End Op 81 Subops @@ -122,7 +122,7 @@ if ('onhashchange' in window) { 55 //:: subtract 56 57 :(before "End Initialize Op Names") - 58 put_new(Name, "2d", "subtract imm32 from EAX (sub)"); + 58 put_new(Name, "2d", "subtract imm32 from EAX (sub)"); 59 60 :(scenario subtract_imm32_from_eax) 61 % Reg[EAX].i = 0x0d0c0baa; @@ -135,7 +135,7 @@ if ('onhashchange' in window) { 68 :(before "End Single-Byte Opcodes") 69 case 0x2d: { // subtract imm32 from EAX 70 const int32_t arg2 = next32(); - 71 trace(90, "run") << "subtract imm32 0x" << HEXWORD << arg2 << " from EAX" << end(); + 71 trace(90, "run") << "subtract imm32 0x" << HEXWORD << arg2 << " from EAX" << end(); 72 BINARY_ARITHMETIC_OP(-, Reg[EAX].i, arg2); 73 break; 74 } @@ -158,7 +158,7 @@ if ('onhashchange' in window) { 91 92 :(before "End Op 81 Subops") 93 case 5: { - 94 trace(90, "run") << "subop subtract" << end(); + 94 trace(90, "run") << "subop subtract" << end(); 95 BINARY_ARITHMETIC_OP(-, *arg1, arg2); 96 break; 97 } @@ -180,7 +180,7 @@ if ('onhashchange' in window) { 113 //:: shift left 114 115 :(before "End Initialize Op Names") -116 put_new(Name, "c1", "shift rm32 by imm8 bits depending on subop (sal/sar/shl/shr)"); +116 put_new(Name, "c1", "shift rm32 by imm8 bits depending on subop (sal/sar/shl/shr)"); 117 118 :(scenario shift_left_r32_with_imm8) 119 % Reg[EBX].i = 13; @@ -196,12 +196,12 @@ if ('onhashchange' in window) { 129 :(before "End Single-Byte Opcodes") 130 case 0xc1: { 131 const uint8_t modrm = next(); -132 trace(90, "run") << "operate on r/m32" << end(); +132 trace(90, "run") << "operate on r/m32" << end(); 133 int32_t* arg1 = effective_address(modrm); 134 const uint8_t subop = (modrm>>3)&0x7; // middle 3 'reg opcode' bits 135 switch (subop) { 136 case 4: { // shift left r/m32 by CL -137 trace(90, "run") << "subop: shift left by CL bits" << end(); +137 trace(90, "run") << "subop: shift left by CL bits" << end(); 138 uint8_t count = next() & 0x1f; 139 // OF is only defined if count is 1 140 if (count == 1) { @@ -212,7 +212,7 @@ if ('onhashchange' in window) { 145 *arg1 = (*arg1 << count); 146 ZF = (*arg1 == 0); 147 SF = (*arg1 < 0); -148 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); +148 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); 149 break; 150 } 151 // End Op c1 Subops @@ -238,14 +238,14 @@ if ('onhashchange' in window) { 171 172 :(before "End Op c1 Subops") 173 case 7: { // shift right r/m32 by CL, preserving sign -174 trace(90, "run") << "subop: shift right by CL bits, while preserving sign" << end(); +174 trace(90, "run") << "subop: shift right by CL bits, while preserving sign" << end(); 175 uint8_t count = next() & 0x1f; 176 *arg1 = (*arg1 >> count); 177 ZF = (*arg1 == 0); 178 SF = (*arg1 < 0); 179 // OF is only defined if count is 1 180 if (count == 1) OF = false; -181 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); +181 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); 182 break; 183 } 184 @@ -288,7 +288,7 @@ if ('onhashchange' in window) { 221 222 :(before "End Op c1 Subops") 223 case 5: { // shift right r/m32 by CL, preserving sign -224 trace(90, "run") << "subop: shift right by CL bits, while padding zeroes" << end(); +224 trace(90, "run") << "subop: shift right by CL bits, while padding zeroes" << end(); 225 uint8_t count = next() & 0x1f; 226 // OF is only defined if count is 1 227 if (count == 1) { @@ -301,7 +301,7 @@ if ('onhashchange' in window) { 234 ZF = (*uarg1 == 0); 235 // result is always positive by definition 236 SF = false; -237 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); +237 trace(90, "run") << "storing 0x" << HEXWORD << *arg1 << end(); 238 break; 239 } 240 @@ -331,7 +331,7 @@ if ('onhashchange' in window) { 264 //:: and 265 266 :(before "End Initialize Op Names") -267 put_new(Name, "25", "EAX = bitwise AND of imm32 with EAX (and)"); +267 put_new(Name, "25", "EAX = bitwise AND of imm32 with EAX (and)"); 268 269 :(scenario and_imm32_with_eax) 270 % Reg[EAX].i = 0xff; @@ -344,7 +344,7 @@ if ('onhashchange' in window) { 277 :(before "End Single-Byte Opcodes") 278 case 0x25: { // and imm32 with EAX 279 const int32_t arg2 = next32(); -280 trace(90, "run") << "and imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); +280 trace(90, "run") << "and imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); 281 BINARY_BITWISE_OP(&, Reg[EAX].i, arg2); 282 break; 283 } @@ -367,7 +367,7 @@ if ('onhashchange' in window) { 300 301 :(before "End Op 81 Subops") 302 case 4: { -303 trace(90, "run") << "subop and" << end(); +303 trace(90, "run") << "subop and" << end(); 304 BINARY_BITWISE_OP(&, *arg1, arg2); 305 break; 306 } @@ -389,7 +389,7 @@ if ('onhashchange' in window) { 322 //:: or 323 324 :(before "End Initialize Op Names") -325 put_new(Name, "0d", "EAX = bitwise OR of imm32 with EAX (or)"); +325 put_new(Name, "0d", "EAX = bitwise OR of imm32 with EAX (or)"); 326 327 :(scenario or_imm32_with_eax) 328 % Reg[EAX].i = 0xd0c0b0a0; @@ -402,7 +402,7 @@ if ('onhashchange' in window) { 335 :(before "End Single-Byte Opcodes") 336 case 0x0d: { // or imm32 with EAX 337 const int32_t arg2 = next32(); -338 trace(90, "run") << "or imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); +338 trace(90, "run") << "or imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); 339 BINARY_BITWISE_OP(|, Reg[EAX].i, arg2); 340 break; 341 } @@ -425,7 +425,7 @@ if ('onhashchange' in window) { 358 359 :(before "End Op 81 Subops") 360 case 1: { -361 trace(90, "run") << "subop or" << end(); +361 trace(90, "run") << "subop or" << end(); 362 BINARY_BITWISE_OP(|, *arg1, arg2); 363 break; 364 } @@ -445,7 +445,7 @@ if ('onhashchange' in window) { 378 //:: xor 379 380 :(before "End Initialize Op Names") -381 put_new(Name, "35", "EAX = bitwise XOR of imm32 with EAX (xor)"); +381 put_new(Name, "35", "EAX = bitwise XOR of imm32 with EAX (xor)"); 382 383 :(scenario xor_imm32_with_eax) 384 % Reg[EAX].i = 0xddccb0a0; @@ -458,7 +458,7 @@ if ('onhashchange' in window) { 391 :(before "End Single-Byte Opcodes") 392 case 0x35: { // xor imm32 with EAX 393 const int32_t arg2 = next32(); -394 trace(90, "run") << "xor imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); +394 trace(90, "run") << "xor imm32 0x" << HEXWORD << arg2 << " with EAX" << end(); 395 BINARY_BITWISE_OP(^, Reg[EAX].i, arg2); 396 break; 397 } @@ -481,7 +481,7 @@ if ('onhashchange' in window) { 414 415 :(before "End Op 81 Subops") 416 case 6: { -417 trace(90, "run") << "subop xor" << end(); +417 trace(90, "run") << "subop xor" << end(); 418 BINARY_BITWISE_OP(^, *arg1, arg2); 419 break; 420 } @@ -501,7 +501,7 @@ if ('onhashchange' in window) { 434 //:: compare (cmp) 435 436 :(before "End Initialize Op Names") -437 put_new(Name, "3d", "compare: set SF if EAX < imm32 (cmp)"); +437 put_new(Name, "3d", "compare: set SF if EAX < imm32 (cmp)"); 438 439 :(scenario compare_imm32_with_eax_greater) 440 % Reg[EAX].i = 0x0d0c0b0a; @@ -515,13 +515,13 @@ if ('onhashchange' in window) { 448 case 0x3d: { // compare EAX with imm32 449 const int32_t arg1 = Reg[EAX].i; 450 const int32_t arg2 = next32(); -451 trace(90, "run") << "compare EAX and imm32 0x" << HEXWORD << arg2 << end(); +451 trace(90, "run") << "compare EAX and imm32 0x" << HEXWORD << arg2 << end(); 452 const int32_t tmp1 = arg1 - arg2; 453 SF = (tmp1 < 0); 454 ZF = (tmp1 == 0); 455 const int64_t tmp2 = arg1 - arg2; 456 OF = (tmp1 != tmp2); -457 trace(90, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); +457 trace(90, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); 458 break; 459 } 460 @@ -556,13 +556,13 @@ if ('onhashchange' in window) { 489 490 :(before "End Op 81 Subops") 491 case 7: { -492 trace(90, "run") << "subop compare" << end(); +492 trace(90, "run") << "subop compare" << end(); 493 const int32_t tmp1 = *arg1 - arg2; 494 SF = (tmp1 < 0); 495 ZF = (tmp1 == 0); 496 const int64_t tmp2 = *arg1 - arg2; 497 OF = (tmp1 != tmp2); -498 trace(90, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); +498 trace(90, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); 499 break; 500 } 501 @@ -631,14 +631,14 @@ if ('onhashchange' in window) { 564 //:: copy (mov) 565 566 :(before "End Initialize Op Names") -567 put_new(Name, "b8", "copy imm32 to EAX (mov)"); -568 put_new(Name, "b9", "copy imm32 to ECX (mov)"); -569 put_new(Name, "ba", "copy imm32 to EDX (mov)"); -570 put_new(Name, "bb", "copy imm32 to EBX (mov)"); -571 put_new(Name, "bc", "copy imm32 to ESP (mov)"); -572 put_new(Name, "bd", "copy imm32 to EBP (mov)"); -573 put_new(Name, "be", "copy imm32 to ESI (mov)"); -574 put_new(Name, "bf", "copy imm32 to EDI (mov)"); +567 put_new(Name, "b8", "copy imm32 to EAX (mov)"); +568 put_new(Name, "b9", "copy imm32 to ECX (mov)"); +569 put_new(Name, "ba", "copy imm32 to EDX (mov)"); +570 put_new(Name, "bb", "copy imm32 to EBX (mov)"); +571 put_new(Name, "bc", "copy imm32 to ESP (mov)"); +572 put_new(Name, "bd", "copy imm32 to EBP (mov)"); +573 put_new(Name, "be", "copy imm32 to ESI (mov)"); +574 put_new(Name, "bf", "copy imm32 to EDI (mov)"); 575 576 :(scenario copy_imm32_to_r32) 577 == 0x1 @@ -657,7 +657,7 @@ if ('onhashchange' in window) { 590 case 0xbf: { // copy imm32 to r32 591 const uint8_t rdest = op & 0x7; 592 const int32_t src = next32(); -593 trace(90, "run") << "copy imm32 0x" << HEXWORD << src << " to " << rname(rdest) << end(); +593 trace(90, "run") << "copy imm32 0x" << HEXWORD << src << " to " << rname(rdest) << end(); 594 Reg[rdest].i = src; 595 break; 596 } @@ -665,7 +665,7 @@ if ('onhashchange' in window) { 598 //: 599 600 :(before "End Initialize Op Names") -601 put_new(Name, "c7", "copy imm32 to rm32 (mov)"); +601 put_new(Name, "c7", "copy imm32 to rm32 (mov)"); 602 603 :(scenario copy_imm32_to_mem_at_r32) 604 % Reg[EBX].i = 0x60; @@ -680,10 +680,10 @@ if ('onhashchange' in window) { 613 :(before "End Single-Byte Opcodes") 614 case 0xc7: { // copy imm32 to r32 615 const uint8_t modrm = next(); -616 trace(90, "run") << "copy imm32 to r/m32" << end(); +616 trace(90, "run") << "copy imm32 to r/m32" << end(); 617 int32_t* dest = effective_address(modrm); 618 const int32_t src = next32(); -619 trace(90, "run") << "imm32 is 0x" << HEXWORD << src << end(); +619 trace(90, "run") << "imm32 is 0x" << HEXWORD << src << end(); 620 *dest = src; 621 break; 622 } @@ -691,7 +691,7 @@ if ('onhashchange' in window) { 624 //:: push 625 626 :(before "End Initialize Op Names") -627 put_new(Name, "68", "push imm32 to stack (push)"); +627 put_new(Name, "68", "push imm32 to stack (push)"); 628 629 :(scenario push_imm32) 630 % Reg[ESP].u = 0x14; @@ -705,11 +705,11 @@ if ('onhashchange' in window) { 638 :(before "End Single-Byte Opcodes") 639 case 0x68: { 640 const uint32_t val = static_cast<uint32_t>(next32()); -641 trace(90, "run") << "push imm32 0x" << HEXWORD << val << end(); +641 trace(90, "run") << "push imm32 0x" << HEXWORD << val << end(); 642 //? cerr << "push: " << val << " => " << Reg[ESP].u << '\n'; 643 push(val); -644 trace(90, "run") << "ESP is now 0x" << HEXWORD << Reg[ESP].u << end(); -645 trace(90, "run") << "contents at ESP: 0x" << HEXWORD << read_mem_u32(Reg[ESP].u) << end(); +644 trace(90, "run") << "ESP is now 0x" << HEXWORD << Reg[ESP].u << end(); +645 trace(90, "run") << "contents at ESP: 0x" << HEXWORD << read_mem_u32(Reg[ESP].u) << end(); 646 break; 647 } -- cgit 1.4.1-2-gfad0