2014-03-28 192 views
-1

我需要一些幫助來確定這些x86彙編語言行的功能。在第二個lea之後,%eax總是5並且%ebx是否變成4?此外,我不確定添加和比較的功能。任何幫助表示讚賞。使用x86彙編語言

 mov $0x5,%eax 
     lea -0x20(%ebp),%esi 
     lea -0x1(%eax),%ebx 
     add 0x4(%esi,%ebx,4),%eax 
     cmp %eax,(%esi,%ebx,4) 
     je  0x8048dce 

回答

2
mov $0x5,%eax    - sets eax to 5 
lea -0x20(%ebp),%esi  - loads the dword value at ebp-0x20 into esi 
lea -0x1(%eax),%ebx  - sets ebx to the value of eax-1 (i.e. 4) 
add 0x4(%esi,%ebx,4),%eax - adds the dword value at esi+ebx*4+4 to eax 
cmp %eax,(%esi,%ebx,4) - compares eax to the dword value at esi+ebx*4 
je  0x8048dce    - branches if they are equal 
+0

嗯...似乎是等效於'LEA EAX,[EBP + 5]','CMP [EBP - 4],eax','JE ...'。非常有趣。 – Powerslave