From cb7b403210f13e721739d58dab9000ec51ed2d0a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 25 Feb 2019 00:26:48 -0800 Subject: 4989 --- html/subx/014indirect_addressing.cc.html | 92 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'html/subx/014indirect_addressing.cc.html') diff --git a/html/subx/014indirect_addressing.cc.html b/html/subx/014indirect_addressing.cc.html index 70f76a80..2919e67e 100644 --- a/html/subx/014indirect_addressing.cc.html +++ b/html/subx/014indirect_addressing.cc.html @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 18 case 0: // indirect addressing 19 switch (rm) { 20 default: // address in register - 21 trace(90, "run") << "effective address is 0x" << HEXWORD << Reg[rm].u << " (" << rname(rm) << ")" << end(); + 21 trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << Reg[rm].u << " (" << rname(rm) << ")" << end(); 22 addr = Reg[rm].u; 23 break; 24 // End Mod 0 Special-cases(addr) @@ -91,7 +91,7 @@ if ('onhashchange' in window) { 28 //: 29 30 :(before "End Initialize Op Names") - 31 put_new(Name, "03", "add rm32 to r32 (add)"); + 31 put_new(Name, "03", "add rm32 to r32 (add)"); 32 33 :(scenario add_mem_at_r32_to_r32) 34 % Reg[EAX].i = 0x2000; @@ -108,9 +108,9 @@ if ('onhashchange' in window) { 45 46 :(before "End Single-Byte Opcodes") 47 case 0x03: { // add r/m32 to r32 - 48 const uint8_t modrm = next(); + 48 const uint8_t modrm = next(); 49 const uint8_t arg1 = (modrm>>3)&0x7; - 50 trace(90, "run") << "add r/m32 to " << rname(arg1) << end(); + 50 trace(Callstack_depth+1, "run") << "add r/m32 to " << rname(arg1) << end(); 51 const int32_t* arg2 = effective_address(modrm); 52 BINARY_ARITHMETIC_OP(+, Reg[arg1].i, *arg2); 53 break; @@ -134,7 +134,7 @@ if ('onhashchange' in window) { 71 //: 72 73 :(before "End Initialize Op Names") - 74 put_new(Name, "2b", "subtract rm32 from r32 (sub)"); + 74 put_new(Name, "2b", "subtract rm32 from r32 (sub)"); 75 76 :(scenario subtract_mem_at_r32_from_r32) 77 % Reg[EAX].i = 0x2000; @@ -151,9 +151,9 @@ if ('onhashchange' in window) { 88 89 :(before "End Single-Byte Opcodes") 90 case 0x2b: { // subtract r/m32 from r32 - 91 const uint8_t modrm = next(); + 91 const uint8_t modrm = next(); 92 const uint8_t arg1 = (modrm>>3)&0x7; - 93 trace(90, "run") << "subtract r/m32 from " << rname(arg1) << end(); + 93 trace(Callstack_depth+1, "run") << "subtract r/m32 from " << rname(arg1) << end(); 94 const int32_t* arg2 = effective_address(modrm); 95 BINARY_ARITHMETIC_OP(-, Reg[arg1].i, *arg2); 96 break; @@ -177,7 +177,7 @@ if ('onhashchange' in window) { 114 //: 115 116 :(before "End Initialize Op Names") -117 put_new(Name, "23", "r32 = bitwise AND of r32 with rm32 (and)"); +117 put_new(Name, "23", "r32 = bitwise AND of r32 with rm32 (and)"); 118 119 :(scenario and_mem_at_r32_with_r32) 120 % Reg[EAX].i = 0x2000; @@ -194,9 +194,9 @@ if ('onhashchange' in window) { 131 132 :(before "End Single-Byte Opcodes") 133 case 0x23: { // and r/m32 with r32 -134 const uint8_t modrm = next(); +134 const uint8_t modrm = next(); 135 const uint8_t arg1 = (modrm>>3)&0x7; -136 trace(90, "run") << "and r/m32 with " << rname(arg1) << end(); +136 trace(Callstack_depth+1, "run") << "and r/m32 with " << rname(arg1) << end(); 137 const int32_t* arg2 = effective_address(modrm); 138 BINARY_BITWISE_OP(&, Reg[arg1].u, *arg2); 139 break; @@ -220,7 +220,7 @@ if ('onhashchange' in window) { 157 //: 158 159 :(before "End Initialize Op Names") -160 put_new(Name, "0b", "r32 = bitwise OR of r32 with rm32 (or)"); +160 put_new(Name, "0b", "r32 = bitwise OR of r32 with rm32 (or)"); 161 162 :(scenario or_mem_at_r32_with_r32) 163 % Reg[EAX].i = 0x2000; @@ -237,9 +237,9 @@ if ('onhashchange' in window) { 174 175 :(before "End Single-Byte Opcodes") 176 case 0x0b: { // or r/m32 with r32 -177 const uint8_t modrm = next(); +177 const uint8_t modrm = next(); 178 const uint8_t arg1 = (modrm>>3)&0x7; -179 trace(90, "run") << "or r/m32 with " << rname(arg1) << end(); +179 trace(Callstack_depth+1, "run") << "or r/m32 with " << rname(arg1) << end(); 180 const int32_t* arg2 = effective_address(modrm); 181 BINARY_BITWISE_OP(|, Reg[arg1].u, *arg2); 182 break; @@ -263,7 +263,7 @@ if ('onhashchange' in window) { 200 //: 201 202 :(before "End Initialize Op Names") -203 put_new(Name, "33", "r32 = bitwise XOR of r32 with rm32 (xor)"); +203 put_new(Name, "33", "r32 = bitwise XOR of r32 with rm32 (xor)"); 204 205 :(scenario xor_mem_at_r32_with_r32) 206 % Reg[EAX].i = 0x2000; @@ -280,9 +280,9 @@ if ('onhashchange' in window) { 217 218 :(before "End Single-Byte Opcodes") 219 case 0x33: { // xor r/m32 with r32 -220 const uint8_t modrm = next(); +220 const uint8_t modrm = next(); 221 const uint8_t arg1 = (modrm>>3)&0x7; -222 trace(90, "run") << "xor r/m32 with " << rname(arg1) << end(); +222 trace(Callstack_depth+1, "run") << "xor r/m32 with " << rname(arg1) << end(); 223 const int32_t* arg2 = effective_address(modrm); 224 BINARY_BITWISE_OP(|, Reg[arg1].u, *arg2); 225 break; @@ -347,7 +347,7 @@ if ('onhashchange' in window) { 284 //: 285 286 :(before "End Initialize Op Names") -287 put_new(Name, "3b", "compare: set SF if r32 < rm32 (cmp)"); +287 put_new(Name, "3b", "compare: set SF if r32 < rm32 (cmp)"); 288 289 :(scenario compare_r32_with_mem_at_r32_greater) 290 % Reg[EAX].i = 0x2000; @@ -364,9 +364,9 @@ if ('onhashchange' in window) { 301 302 :(before "End Single-Byte Opcodes") 303 case 0x3b: { // set SF if r32 < r/m32 -304 const uint8_t modrm = next(); +304 const uint8_t modrm = next(); 305 const uint8_t reg1 = (modrm>>3)&0x7; -306 trace(90, "run") << "compare r/m32 with " << rname(reg1) << end(); +306 trace(Callstack_depth+1, "run") << "compare r/m32 with " << rname(reg1) << end(); 307 const int32_t arg1 = Reg[reg1].i; 308 const int32_t* arg2 = effective_address(modrm); 309 const int32_t tmp1 = arg1 - *arg2; @@ -374,7 +374,7 @@ if ('onhashchange' in window) { 311 ZF = (tmp1 == 0); 312 int64_t tmp2 = arg1 - *arg2; 313 OF = (tmp1 != tmp2); -314 trace(90, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); +314 trace(Callstack_depth+1, "run") << "SF=" << SF << "; ZF=" << ZF << "; OF=" << OF << end(); 315 break; 316 } 317 @@ -420,7 +420,7 @@ if ('onhashchange' in window) { 357 //: 358 359 :(before "End Initialize Op Names") -360 put_new(Name, "8b", "copy rm32 to r32 (mov)"); +360 put_new(Name, "8b", "copy rm32 to r32 (mov)"); 361 362 :(scenario copy_mem_at_r32_to_r32) 363 % Reg[EAX].i = 0x2000; @@ -436,12 +436,12 @@ if ('onhashchange' in window) { 373 374 :(before "End Single-Byte Opcodes") 375 case 0x8b: { // copy r32 to r/m32 -376 const uint8_t modrm = next(); +376 const uint8_t modrm = next(); 377 const uint8_t rdest = (modrm>>3)&0x7; -378 trace(90, "run") << "copy r/m32 to " << rname(rdest) << end(); +378 trace(Callstack_depth+1, "run") << "copy r/m32 to " << rname(rdest) << end(); 379 const int32_t* src = effective_address(modrm); 380 Reg[rdest].i = *src; -381 trace(90, "run") << "storing 0x" << HEXWORD << *src << end(); +381 trace(Callstack_depth+1, "run") << "storing 0x" << HEXWORD << *src << end(); 382 break; 383 } 384 @@ -457,19 +457,19 @@ if ('onhashchange' in window) { 394 05 00 00 00 02 395 == 0x2000 # data segment 396 08 00 00 00 # 8 -397 +run: inst: 0x00000001 +397 +run: 0x00000001 opcode: ff 398 +run: jump to r/m32 399 +run: effective address is 0x00002000 (EAX) 400 +run: jumping to 0x00000008 -401 +run: inst: 0x00000008 -402 -run: inst: 0x00000003 +401 +run: 0x00000008 opcode: 05 +402 -run: 0x00000003 opcode: 05 403 404 :(before "End Op ff Subops") 405 case 4: { // jump to r/m32 -406 trace(90, "run") << "jump to r/m32" << end(); +406 trace(Callstack_depth+1, "run") << "jump to r/m32" << end(); 407 const int32_t* arg2 = effective_address(modrm); 408 EIP = *arg2; -409 trace(90, "run") << "jumping to 0x" << HEXWORD << EIP << end(); +409 trace(Callstack_depth+1, "run") << "jumping to 0x" << HEXWORD << EIP << end(); 410 break; 411 } 412 @@ -484,23 +484,23 @@ if ('onhashchange' in window) { 421 # ModR/M in binary: 00 (indirect mode) 110 (push r/m32) 000 (src EAX) 422 == 0x2000 # data segment 423 af 00 00 00 # 0xaf -424 +run: push r/m32 +424 +run: push r/m32 425 +run: effective address is 0x00002000 (EAX) 426 +run: decrementing ESP to 0x00000010 427 +run: pushing value 0x000000af 428 429 :(before "End Op ff Subops") 430 case 6: { // push r/m32 to stack -431 trace(90, "run") << "push r/m32" << end(); +431 trace(Callstack_depth+1, "run") << "push r/m32" << end(); 432 const int32_t* val = effective_address(modrm); -433 push(*val); +433 push(*val); 434 break; 435 } 436 437 //:: pop 438 439 :(before "End Initialize Op Names") -440 put_new(Name, "8f", "pop top of stack to rm32 (pop)"); +440 put_new(Name, "8f", "pop top of stack to rm32 (pop)"); 441 442 :(scenario pop_mem_at_r32) 443 % Reg[EAX].i = 0x60; @@ -518,11 +518,11 @@ if ('onhashchange' in window) { 455 456 :(before "End Single-Byte Opcodes") 457 case 0x8f: { // pop stack into r/m32 -458 const uint8_t modrm = next(); +458 const uint8_t modrm = next(); 459 const uint8_t subop = (modrm>>3)&0x7; 460 switch (subop) { 461 case 0: { -462 trace(90, "run") << "pop into r/m32" << end(); +462 trace(Callstack_depth+1, "run") << "pop into r/m32" << end(); 463 int32_t* dest = effective_address(modrm); 464 *dest = pop(); 465 break; @@ -547,8 +547,8 @@ if ('onhashchange' in window) { 484 485 :(before "End Mod 0 Special-cases(addr)") 486 case 5: // exception: mod 0b00 rm 0b101 => incoming disp32 -487 addr = next32(); -488 trace(90, "run") << "effective address is 0x" << HEXWORD << addr << " (disp32)" << end(); +487 addr = next32(); +488 trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << addr << " (disp32)" << end(); 489 break; 490 491 //: @@ -572,13 +572,13 @@ if ('onhashchange' in window) { 509 switch (rm) { 510 default: 511 addr = Reg[rm].u; -512 trace(90, "run") << "effective address is initially 0x" << HEXWORD << addr << " (" << rname(rm) << ")" << end(); +512 trace(Callstack_depth+1, "run") << "effective address is initially 0x" << HEXWORD << addr << " (" << rname(rm) << ")" << end(); 513 break; 514 // End Mod 1 Special-cases(addr) 515 } 516 if (addr > 0) { -517 addr += static_cast<int8_t>(next()); -518 trace(90, "run") << "effective address is 0x" << HEXWORD << addr << " (after adding disp8)" << end(); +517 addr += static_cast<int8_t>(next()); +518 trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << addr << " (after adding disp8)" << end(); 519 } 520 break; 521 @@ -617,13 +617,13 @@ if ('onhashchange' in window) { 554 switch (rm) { 555 default: 556 addr = Reg[rm].u; -557 trace(90, "run") << "effective address is initially 0x" << HEXWORD << addr << " (" << rname(rm) << ")" << end(); +557 trace(Callstack_depth+1, "run") << "effective address is initially 0x" << HEXWORD << addr << " (" << rname(rm) << ")" << end(); 558 break; 559 // End Mod 2 Special-cases(addr) 560 } 561 if (addr > 0) { -562 addr += next32(); -563 trace(90, "run") << "effective address is 0x" << HEXWORD << addr << " (after adding disp32)" << end(); +562 addr += next32(); +563 trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << addr << " (after adding disp32)" << end(); 564 } 565 break; 566 @@ -644,7 +644,7 @@ if ('onhashchange' in window) { 581 //:: copy address (lea) 582 583 :(before "End Initialize Op Names") -584 put_new(Name, "8d", "copy address in rm32 into r32 (lea)"); +584 put_new(Name, "8d", "copy address in rm32 into r32 (lea)"); 585 586 :(scenario copy_address) 587 % Reg[EAX].u = 0x2000; @@ -657,9 +657,9 @@ if ('onhashchange' in window) { 594 595 :(before "End Single-Byte Opcodes") 596 case 0x8d: { // copy address of m32 to r32 -597 const uint8_t modrm = next(); +597 const uint8_t modrm = next(); 598 const uint8_t arg1 = (modrm>>3)&0x7; -599 trace(90, "run") << "copy address into " << rname(arg1) << end(); +599 trace(Callstack_depth+1, "run") << "copy address into " << rname(arg1) << end(); 600 Reg[arg1].u = effective_address_number(modrm); 601 break; 602 } -- cgit 1.4.1-2-gfad0