From 9e45873ff4a5af5fc2bb2fcab90accef171900f1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 18 Oct 2017 00:57:46 -0700 Subject: 4079 subx: 'pop' --- html/subx/013immediate_addressing.cc.html | 54 ++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'html/subx/013immediate_addressing.cc.html') diff --git a/html/subx/013immediate_addressing.cc.html b/html/subx/013immediate_addressing.cc.html index bde49732..adaff3e0 100644 --- a/html/subx/013immediate_addressing.cc.html +++ b/html/subx/013immediate_addressing.cc.html @@ -414,22 +414,44 @@ if ('onhashchange' in window) { 350 } 351 352 //: -353 :(scenario copy_imm32_to_mem_at_r32) -354 % Reg[3].i = 0x60; -355 # op ModRM SIB displacement immediate -356 c7 03 0a 0b 0c 0d # copy 0x0d0c0b0a to *EBX (reg 3) -357 +run: copy imm32 0x0d0c0b0a to effective address -358 +run: effective address is mem at address 0x60 (reg 3) -359 -360 :(before "End Single-Byte Opcodes") -361 case 0xc7: { // copy imm32 to r32 -362 uint8_t modrm = next(); -363 int32_t arg2 = imm32(); -364 trace(2, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to effective address" << end(); -365 int32_t* arg1 = effective_address(modrm); -366 *arg1 = arg2; -367 break; -368 } +353 +354 :(scenario copy_imm32_to_mem_at_r32) +355 % Reg[3].i = 0x60; +356 # op ModRM SIB displacement immediate +357 c7 03 0a 0b 0c 0d # copy 0x0d0c0b0a to *EBX (reg 3) +358 +run: copy imm32 0x0d0c0b0a to effective address +359 +run: effective address is mem at address 0x60 (reg 3) +360 +361 :(before "End Single-Byte Opcodes") +362 case 0xc7: { // copy imm32 to r32 +363 uint8_t modrm = next(); +364 int32_t arg2 = imm32(); +365 trace(2, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to effective address" << end(); +366 int32_t* arg1 = effective_address(modrm); +367 *arg1 = arg2; +368 break; +369 } +370 +371 //:: push +372 +373 :(scenario push_imm32) +374 % Reg[ESP].u = 0x14; +375 # op ModRM SIB displacement immediate +376 68 af 00 00 00 # push *EAX (reg 0) to stack +377 +run: push imm32 0x000000af +378 +run: ESP is now 0x00000010 +379 +run: contents at ESP: 0x000000af +380 +381 :(before "End Single-Byte Opcodes") +382 case 0x68: { +383 int32_t val = imm32(); +384 trace(2, "run") << "push imm32 0x" << HEXWORD << val << end(); +385 Reg[ESP].u -= 4; +386 *reinterpret_cast<uint32_t*>(&Mem.at(Reg[ESP].u)) = val; +387 trace(2, "run") << "ESP is now 0x" << HEXWORD << Reg[ESP].u << end(); +388 trace(2, "run") << "contents at ESP: 0x" << HEXWORD << *reinterpret_cast<uint32_t*>(&Mem.at(Reg[ESP].u)) << end(); +389 break; +390 } -- cgit 1.4.1-2-gfad0