[英]How does leal instruction work?
我得到了這些leal
指令,我必須填寫他們的意思。 我一直在努力研究leal
教學的行為,但我一直難以在網上找到相關資料。 我發現的是
leal (src1, src2), dst //dst = src2 + src1
這個信息沒有提供足夠的信息,因為leal
指令比這復雜得多。
這看起來怎么樣?
假設%eax
保持值x, %ecx
保持值y。 填在表格中。
%edx = x + 6___________leal 6(%eax),%edx
%edx = x + y___________leal (%eax,%ecx),%edx
%edx = x * 5y___________leal (%eax,%ecx,4),%edx
%edx = 9x + 7___________leal 7(%eax,%eax,8),%edx
%edx = 4y + 10___________leal 0xA(,%ecx,4),%edx
%edx = x + 3y + 9___________leal 9(%eax,%ecx,2),%edx
我要做的是將上面的att語法轉換為intel語法作為第一步,因為分析更加直觀。
lea edx, [eax + 6]
lea edx, [eax + ecx]
lea edx, [eax + ecx * 4]
lea edx, [eax + eax * 8 + 7]
lea edx, [ecx * 4 + 10]
lea edx, [eax + ecx * 2 + 9]
即使您對匯編語法一無所知,您也可以看看上面的內容可以弄清楚它們的含義。 您可以在心理上將此映射為您喜歡的編程語言中的賦值語句:您分配的內容位於左側,分配的值位於右側。 現在只需用寄存器替換x
和y
值即可:
edx = x + 6
edx = x + y
edx = x + y*4
edx = x + x*8 + 7 => x*9 + 7
edx = y*4 + 10
edx = x + y*2 + 9
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.