Submit Search
Upload
Calling Functions
•
0 likes
•
789 views
P
Pat Hawks
Follow
How functions are called in 32-bit x86 Assembly
Read less
Read more
Technology
Report
Share
Report
Share
1 of 41
Download now
Download to read offline
Recommended
Call Return Exploration
Call Return Exploration
Pat Hawks
SPL, not a bridge too far
SPL, not a bridge too far
Michelangelo van Dam
Perl 6 by example
Perl 6 by example
Andrew Shitov
The Perl6 Type System
The Perl6 Type System
abrummett
Forget about loops
Forget about loops
Dušan Kasan
Perl6 grammars
Perl6 grammars
Andrew Shitov
PHP Performance SfLive 2010
PHP Performance SfLive 2010
De Cock Xavier
Perl 5.28 new features
Perl 5.28 new features
brian d foy
Recommended
Call Return Exploration
Call Return Exploration
Pat Hawks
SPL, not a bridge too far
SPL, not a bridge too far
Michelangelo van Dam
Perl 6 by example
Perl 6 by example
Andrew Shitov
The Perl6 Type System
The Perl6 Type System
abrummett
Forget about loops
Forget about loops
Dušan Kasan
Perl6 grammars
Perl6 grammars
Andrew Shitov
PHP Performance SfLive 2010
PHP Performance SfLive 2010
De Cock Xavier
Perl 5.28 new features
Perl 5.28 new features
brian d foy
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
XSolve
6 things about perl 6
6 things about perl 6
brian d foy
Perl 6 in Context
Perl 6 in Context
lichtkind
Class 4 - PHP Arrays
Class 4 - PHP Arrays
Ahmed Swilam
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
Zend by Rogue Wave Software
Wx::Perl::Smart
Wx::Perl::Smart
lichtkind
Creating own language made easy
Creating own language made easy
Ingvar Stepanyan
Perl.Hacks.On.Vim
Perl.Hacks.On.Vim
Lin Yo-An
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
Workhorse Computing
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
Eleanor McHugh
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Dharmalingam Ganesan
Adventures in Optimization
Adventures in Optimization
David Golden
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
Andrew Shitov
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
osfameron
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Workhorse Computing
PHP for Python Developers
PHP for Python Developers
Carlos Vences
6 more things about Perl 6
6 more things about Perl 6
brian d foy
Top 10 php classic traps
Top 10 php classic traps
Damien Seguy
07 php
07 php
CBRIARCSC
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
annaiwatertreatment
rop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer security
FannyBellows
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
mydrynan
More Related Content
What's hot
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
XSolve
6 things about perl 6
6 things about perl 6
brian d foy
Perl 6 in Context
Perl 6 in Context
lichtkind
Class 4 - PHP Arrays
Class 4 - PHP Arrays
Ahmed Swilam
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
Zend by Rogue Wave Software
Wx::Perl::Smart
Wx::Perl::Smart
lichtkind
Creating own language made easy
Creating own language made easy
Ingvar Stepanyan
Perl.Hacks.On.Vim
Perl.Hacks.On.Vim
Lin Yo-An
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
Workhorse Computing
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
Eleanor McHugh
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Dharmalingam Ganesan
Adventures in Optimization
Adventures in Optimization
David Golden
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
Andrew Shitov
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
osfameron
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Workhorse Computing
PHP for Python Developers
PHP for Python Developers
Carlos Vences
6 more things about Perl 6
6 more things about Perl 6
brian d foy
Top 10 php classic traps
Top 10 php classic traps
Damien Seguy
07 php
07 php
CBRIARCSC
What's hot
(19)
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
6 things about perl 6
6 things about perl 6
Perl 6 in Context
Perl 6 in Context
Class 4 - PHP Arrays
Class 4 - PHP Arrays
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
Wx::Perl::Smart
Wx::Perl::Smart
Creating own language made easy
Creating own language made easy
Perl.Hacks.On.Vim
Perl.Hacks.On.Vim
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Adventures in Optimization
Adventures in Optimization
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
PHP for Python Developers
PHP for Python Developers
6 more things about Perl 6
6 more things about Perl 6
Top 10 php classic traps
Top 10 php classic traps
07 php
07 php
Similar to Calling Functions
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
annaiwatertreatment
rop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer security
FannyBellows
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
mydrynan
Neatly folding-a-tree
Neatly folding-a-tree
Workhorse Computing
AnswerAssembly Language Code .zero 1 .LC0 .string Enter.pdf
AnswerAssembly Language Code .zero 1 .LC0 .string Enter.pdf
arccreation001
LDAP Synchronization Connector (LSC)
LDAP Synchronization Connector (LSC)
Jonathan Clarke
Function Call Optimization
Function Call Optimization
ppd1961
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
Sean Cribbs
Laziness in Swift
Laziness in Swift
SwiftWro
Introduction to Assembly Language
Introduction to Assembly Language
Motaz Saad
La tex symbols
La tex symbols
Partha Mondal
Symbols
Symbols
Miguel Eduardo García Marcano
Latex Symbols.pdf
Latex Symbols.pdf
Komal526846
Introduction to Perl
Introduction to Perl
Sway Wang
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
Functional Thursday
symbols of Latex.pdf
symbols of Latex.pdf
MdNaim23
Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing Functionally
Sean Cribbs
Introduction To Lisp
Introduction To Lisp
kyleburton
Perl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
Perl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
Similar to Calling Functions
(20)
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
rop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer security
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
Neatly folding-a-tree
Neatly folding-a-tree
AnswerAssembly Language Code .zero 1 .LC0 .string Enter.pdf
AnswerAssembly Language Code .zero 1 .LC0 .string Enter.pdf
LDAP Synchronization Connector (LSC)
LDAP Synchronization Connector (LSC)
Function Call Optimization
Function Call Optimization
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
Laziness in Swift
Laziness in Swift
Introduction to Assembly Language
Introduction to Assembly Language
La tex symbols
La tex symbols
Symbols
Symbols
Latex Symbols.pdf
Latex Symbols.pdf
Introduction to Perl
Introduction to Perl
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
symbols of Latex.pdf
symbols of Latex.pdf
Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing Functionally
Introduction To Lisp
Introduction To Lisp
Perl6 a whistle stop tour
Perl6 a whistle stop tour
Perl6 a whistle stop tour
Perl6 a whistle stop tour
Recently uploaded
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
Hyundai Motor Group
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Scott Keck-Warren
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Pixlogix Infotech
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
null - The Open Security Community
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Safe Software
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
ThousandEyes
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Deakin University
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
null - The Open Security Community
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
OnBoard
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
comworks
Recently uploaded
(20)
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Slack Application Development 101 Slides
Slack Application Development 101 Slides
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
Calling Functions
1.
callingFunctions.S Passing arguments to
functions via the stack
2.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 8(%esp) argv 4(%esp) argc (%esp) return addr %esp 28ff2c %ebp old %ebp %eax $0
3.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 8(%esp) argv 4(%esp) argc (%esp) return addr %esp 28ff2c %ebp old %ebp %eax $0
4.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%esp) argv 8(%esp) argc 4(%esp) return addr (%esp) old %ebp %esp 28ff28 %ebp old %ebp %eax $0
5.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%esp) argv 8(%esp) argc 4(%esp) return addr (%esp) old %ebp %esp 28ff28 %ebp old %ebp %eax $0
6.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp %esp 28ff28 %ebp 28ff28 %eax $0
7.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp %esp 28ff28 %ebp 28ff28 %eax $0
8.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp %esp 28ff20 %ebp 28ff28 %eax $0
9.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp %esp 28ff20 %ebp 28ff28 %eax $0
10.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) %esp 28ff00 %ebp 28ff28 %eax $0
11.
LC0: .ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp call ___main movl $1234, 28(%esp) movl 12(%ebp), %eax addl $4, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) %esp 28ff00 %ebp 28ff28 %eax $0
12.
.ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: 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 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) %esp 28ff00 %ebp 28ff28 %eax $0
13.
.ascii "The argument
was %d120" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: 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 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) %esp 28ff00 %ebp 28ff28 %eax $0
14.
.text .globl _main .def _main;
.scl 2; .type 32; .endef _main: 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) 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) %esp 28ff00 %ebp 28ff28 %eax $0
15.
.text .globl _main .def _main;
.scl 2; .type 32; .endef _main: 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) 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) %esp 28ff00 %ebp 28ff28 %eax argv
16.
.text .globl _main .def _main;
.scl 2; .type 32; .endef _main: 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) 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) %esp 28ff00 %ebp 28ff28 %eax argv Address of pointer to prog name
17.
.globl _main .def _main;
.scl 2; .type 32; .endef _main: 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 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) %esp 28ff00 %ebp 28ff28 %eax argv Address of pointer to prog name
18.
.globl _main .def _main;
.scl 2; .type 32; .endef _main: 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 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) %esp 28ff00 %ebp 28ff28 %eax argv+4 Address of pointer to first arg
19.
.def _main; .scl
2; .type 32; .endef _main: 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) 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) %esp 28ff00 %ebp 28ff28 %eax argv+4 Address of pointer to first arg
20.
.def _main; .scl
2; .type 32; .endef _main: 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) 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) %esp 28ff00 %ebp 28ff28 %eax argv[1] pointer to first arg
21.
_main: 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 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) %esp 28ff00 %ebp 28ff28 %eax argv[1]
22.
_main: 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 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]
23.
_main: 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 For our purposes argv[1] = "67" 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]
24.
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" 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]
25.
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]
26.
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 $67
27.
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) movl $LC0, (%esp) 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 $67
28.
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) movl $LC0, (%esp) 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax $67
29.
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) movl $LC0, (%esp) call _printf 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax $67
30.
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) movl $LC0, (%esp) call _printf movl $0, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) (%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax $67
31.
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) movl $LC0, (%esp) call _printf movl $0, %eax 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax $67
32.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) argv[1] %esp 28ff00 %ebp 28ff28 %eax $67
33.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 %esp 28ff00 %ebp 28ff28 %eax $67
34.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 $LC0 is the location in memory of our format string. "The argument was %d120" %esp 28ff00 %ebp 28ff28 %eax $67
35.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 %esp 28ff00 %ebp 28ff28 %eax $67 $LC0 is the location in memory of our format string. "The argument was %d120"
36.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 %esp 28ff00 %ebp 28ff28 %eax $67
37.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 %esp 28ff00 %ebp 28ff28 %eax $0
38.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 28(%esp) $67 24(%esp) 20(%esp) 16(%esp) 12(%esp) 8(%esp) 4(%esp) $67 (%esp) $LC0 %esp 28ff00 %ebp 28ff28 %eax $0
39.
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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret 8(%esp) argv 4(%esp) argc (%esp) return addr %esp 28ff2c %ebp old %ebp %eax $0
40.
8(%esp) argv 4(%esp) argc (%esp)
return addr %esp 28ff2c %ebp old %ebp %eax $0 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) movl $LC0, (%esp) call _printf movl $0, %eax leave ret
41.
callingFunctions.S Passing arguments to
functions via the stack This presentation by Pat Hawks is licensed under a Creative Commons Attribution 4.0 International License
Download now