我在asm中看到了這樣一段代碼:
.text:787924E0 testcall proc near
.text:787924E0
.text:787924E0 var_F0 = dword ptr -0F0h
.text:787924E0 var_34 = byte ptr -34h
.text:787924E0 retValue = std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > ptr -24h
.text:787924E0 var_4 = dword ptr -4
.text:787924E0 result = dword ptr 8
.text:787924E0 agr1 = std::basic_string<char,std::char_traits<char>,std::allocator<char> > ptr 0Ch
.text:787924E0
.text:787924E0 push ebp
.text:787924E1 mov ebp, esp
.text:787924E3 sub esp, 0F4h
.text:787924E9 push ebx
.text:787924EA push esi
.text:787924EB push edi
.text:78792555 mov eax, [ebp result]
.text:78792558 push edx
...
.text:78792567 pop eax
.text:78792568 pop edx
.text:78792569 pop edi
.text:7879256A pop esi
.text:7879256B pop ebx
.text:78792576 add esp, 0F4h
.text:78792583 mov esp, ebp
.text:78792585 pop ebp
.text:78792586 retn

我想知道基礎知識題:
子 esp, 0F4h
為什么是0xF4,怎么計算的?
uj5u.com熱心網友回復:
在過去,人們使用 ebp 來指向舊堆疊位置的頂部。如今,編譯器可以手動計數并分配足夠的空間結束,然后回傳舊堆疊位置而不使用 ebp。堆疊也是從上到下而不是在頂部,所以當你減去 esp 時,你會在堆疊中分配新空間。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/495928.html
上一篇:理解ARM中的uxth指令
