High Memory
Arg2
Arg1
ret
<-----------------ebp
ebp
local1
local2
<-------------esp
Low memory
example code
; 어셈블리와 동등한 프로그램
SECTION .data
msg1: db "The variable contains %d",10,0
SECTION .text
;출력에 대한 접근 허용
extern printf
;main 외부적 사용 가능하게 만듬
global main
main:
push ebp
mov ebp , esp
sub esp, 10
mov DWORD [ebp - 4] , 0xff ; variable 1
mov DWORD [ebp - 8] , 0x10 ; variable 2
push DWORD [ebp - 4]
push DWORD msg1
call printf
push DWORD [ebp -8]
push DWORD msg1
call printf
mov esp , ebp
pop ebp
ret
댓글 없음:
댓글 쓰기