2011-11-04 85 views
1

任何人都可以解释我在反汇编函数中找到的以下代码的含义吗?Asm从反汇编程序中摘录

mov  eax, [ebx+20h] 
mov  ecx, [eax] 
mov  [eax], ecx 
mov  ecx, [eax+4] 
mov  [eax+4], ecx 

对我来说似乎是通过EAX和EAX + 4是要与代码段的执行......这没有按”之前被存储在相同的存储位置相同的值覆盖指向的内存真的有道理0_o。我错过了什么?

+2

多年来我没有使用X86 ASM,但似乎是这样,这段代码根本没有什么意义..你在哪里找到它? – Radu

回答

0
mov eax,[ebx+20h] ; move the memory constant at address [ebx] with the offset of 32 bits 

mov ecx,[eax] ; move the memory constant at address eax with no offset 


mov [eax],ecx ; mov the address at ecx to value of eax 

mov ecx,[eax+4] ; mov teh value of eax with offset 4 to ecx 

mov [eax+4],ecx ; move the adress at ecx to the value of eax with offset 4 

[EAX]像* EAX用C

+0

只看'mov eax,[ebx + 20h]',然后是'mov ecx,[eax]'。我认为这是'mov destination,source'。 – 2011-11-04 14:12:18

+0

当然是 – Andro

+0

嗯。我想知道我误读了什么:P – 2011-11-04 18:28:38

0

是啊,你说得对,在eaxeax + 4(或ebx + 20xebx + 24h)值被读出并没有变化写入。这可能是迫使CPU将它们加载并将其中的一些词带入其第一级缓存的一种方式。

+0

也可能是由于缺乏优化。 – Andro