我尝试自己做,但无法正确处理。以下是我的考试题,我想适当地做一下并了解其运作方式。如果您能帮助我,我将不胜感激。
确定以下程序片段的每个指令的目的地(寄存器或内存地址)和存储的值:
mov eax, 0x8000
mov ebx, 0x40000
lea esp, [ebx]
shl eax, 16
sar ebx, 23
lea ecx, [ebx+0xff]
push ecx
sar eax, 31
push eax
mov eax, [esp+4]
sub eax, [esp]
Run Code Online (Sandbox Code Playgroud)
注释您的代码:
mov eax, 0x8000 ; Move the 32-bit value 0x8000 into register eax
mov ebx, 0x40000 ; Move the 32-bit value 0x40000 into register ebx
lea esp, [ebx] ; Load the value of register ebx into register esp
shl eax, 16 ; Take the value of register eax, shift left 16 bits, and store back into eax
sar ebx, 23 ; Take the value of register ebx, shift right 23 bits (copying sign bit), and store back into ebx
lea ecx, [ebx+0xff] ; Load the value of (register ebx) + 0xFF into register ecx
push ecx ; Push the value of register ecx onto the stack (the memory near the address of the value of register esp)
sar eax, 31 ; Take the value of register ebx, shift right 31 bits (copying sign bit), and store back into ebx
push eax ; Push the value of register eax onto the stack
mov eax, [esp+4] ; Move the vaule of register the memory at address (esp + 4) and store into eax
sub eax, [esp] ; Subtract the value of the memory at address esp from eax and store into eax
Run Code Online (Sandbox Code Playgroud)