如果我在 Visual Studio 2010 项目中运行 ASM 文件,则在调用 asm 函数后它会崩溃
使用asm代码:-
.386
.model flat, c
TEXT SEGMENT
ALIGN 4
L_add PROC
push ebp
mov ebp, esp
mov edx, dword ptr[ebp + 12]
mov eax, dword ptr[ebp + 8]
add edx, eax
mov esp, ebp
pop ebp
ret 0
L_add ENDP
TEXT ENDS
END**
上面的代码在 Visual Studio 2010 中不起作用,如果我将其更改TEXT SEGMENT
为.code
段,它工作正常,两者之间有什么区别.code
, TEXT SEGMENT
但上面的代码在 Visual Studio 2005 中起作用。
disaasembly at calling place:
b = hs_L_shl(L_var1,var2);
012D1484 movsx eax,word ptr [var2]
012D1488 push eax
012D1489 mov ecx,dword ptr [L_var1]
012D148C push ecx
012D148D call @ILT+455(_hs_L_shl) (12D11CCh)
012D1492 add esp,8
012D1495 mov dword ptr [b],eax
Disaasembly at function with .code:
hs_L_shl PROC
; PROLOGUE START
push ebp
012D15B0 push ebp
mov ebp, esp
012D15B1 mov ebp,esp
sub esp, 24
012D15B3 sub esp,18h
push ebx
012D15B6 push ebx
push esi
012D15B7 push esi
Disaasembly at function with TEXT SEGMENT:
; PROLOGUE START
push ebp
012D15B0 push ebp
mov ebp, esp
012D15B1 mov ebp,esp
sub esp, 24
012D15B3 sub esp,18h
push ebx
012D15B6 push ebx
push esi
012D15B7 push esi