这是我的代码
segment .data
; initialized data is put in the data segment here
;
segment .text
global main
main:
enter 0,0 ; setup stack frame
pusha
call func
;
;
;
;
popa
mov eax, 0 ;
leave ;
ret
func:
push ebp
mov ebp,esp
sub esp,4 ;this is for local variable
mov eax,dword [ebp+12]
call print_int
call print_nl
mov eax,dword [ebp+8]
call print_int
call print_nl
mov esp,ebp
pop ebp
ret
如果我键入命令$./test 1 2 3
,则在堆栈中
---------------
pointer to argv-------->ebp+12
---------------
argc -------->ebp+8
---------------
return address -------->ebp+4
---------------
saved ebp -------->ebp
---------------
它应该打印出3(参数个数) 但是控制台中只有0。
怎么了?