Slide 25
Slide 25 text
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $32, %esp
call ___main
movl $1234, 28(%esp)
movl 12(%ebp), %eax
addl $4, %eax
movl (%eax), %eax
movl %eax, (%esp)
call _atoi
movl %eax, 28(%esp)
movl 28(%esp), %eax
movl %eax, 4(%esp)
For our purposes
argv[1] = "67"
_atoi grabs the char array at
the address stored in (%esp),
converts the ASCII string to an
int, and returns the int in %eax
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
28(%esp) $1234
24(%esp)
20(%esp)
16(%esp)
12(%esp)
8(%esp)
4(%esp)
(%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax argv[1]