SlideShare a Scribd company logo
Calling functions by Pushing and Jumping
callReturnExploration.s
LC0:
.ascii "%dn0"
.text
.globl _function
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebpProgram starts here
LC0:
.ascii "%dn0"
.text
.globl _function
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
8(%esp) argv
4(%esp) argc
(%esp) return addr
%esp 28ff2c %ebp old %ebp %eax $0
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
8(%esp) argv
4(%esp) argc
(%esp) return addr
%esp 28ff2c %ebp old %ebp %eax $0
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff28 %ebp old %ebp %eax $0
12(%esp) argv
8(%esp) argc
4(%esp) return addr
(%esp) old %ebp
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff28 %ebp old %ebp %eax $0
12(%esp) argv
8(%esp) argc
4(%esp) return addr
(%esp) old %ebp
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff28 %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff28 %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff20 %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
4(%esp)
(%esp)
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff20 %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
4(%esp)
(%esp)
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff1c %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff1c %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
_function::
...
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
%esp 28ff1c %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
%esp 28ff1c %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
%esp 28ff1c %ebp 28ff28 %eax $0
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
%esp 28ff1c %ebp 28ff28 %eax $99
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp)
4(%esp)
(%esp) $retAddr
%esp 28ff1c %ebp 28ff28 %eax $99
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
4(%esp)
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
_function::
movl $99, %eax
# ret
popl %ecx
jmp *%ecx
.globl _main
_main::
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
4(%esp)
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp)
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp)
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp)
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp)
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
movl $0, %eax
leave
ret
%esp 28ff1c %ebp 28ff28 %eax $99
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp) $99
4(%esp) $LC0
(%esp)
address of
next instruction
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
movl $0, %eax
leave
ret
%esp 28ff1c %ebp 28ff28 %eax $99
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp) $99
4(%esp) $LC0
(%esp)
address of
next instruction
We push the address of the next
instruction to the stack.
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
movl $0, %eax
leave
ret
%esp 28ff1c %ebp 28ff28 %eax $99
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp) $99
4(%esp) $LC0
(%esp)
address of
next instruction
We push the address of the next
instruction to the stack.
We jump to _printf and do our
business
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
movl $0, %eax
leave
ret
%esp 28ff1c %ebp 28ff28 %eax $99
12(%ebp) argv
8(%ebp) argc
4(%ebp) return addr
(%ebp) old %ebp
8(%esp) $99
4(%esp) $LC0
(%esp)
address of
next instruction
We push the address of the next
instruction to the stack.
We jump to _printf and do our
business
When finished, _printf jumps to our
next instruction
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $99
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $0
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
4(%esp) $99
(%esp) $LC0
%esp 28ff20 %ebp 28ff28 %eax $0
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
pushl %ebp
movl %esp, %ebp
subl $8, %esp
# call _function
pushl $retAddr
jmp _function
retAddr:
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
Calling functions by Pushing and Jumping
This presentation by Pat Hawks is licensed under a
Creative Commons Attribution 4.0 International License
callReturnExploration.s

More Related Content

What's hot

The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The 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::SmartWx::Perl::Smart
Wx::Perl::Smart
lichtkind
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.VimLin Yo-An
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Dharmalingam Ganesan
 
Class 4 - PHP Arrays
Class 4 - PHP ArraysClass 4 - PHP Arrays
Class 4 - PHP Arrays
Ahmed Swilam
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
Eleanor McHugh
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
Damien Seguy
 
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
Workhorse Computing
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional 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 & Perl6Neatly 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 DevelopersPHP for Python Developers
PHP for Python Developers
Carlos Vences
 
07 php
07 php07 php
07 php
CBRIARCSC
 
Function Call Optimization
Function Call OptimizationFunction Call Optimization
Function Call Optimization
ppd1961
 
6 more things about Perl 6
6 more things about Perl 66 more things about Perl 6
6 more things about Perl 6
brian d foy
 
Adventures in Optimization
Adventures in OptimizationAdventures in Optimization
Adventures in Optimization
David Golden
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Syntax
SyntaxSyntax
Neatly folding-a-tree
Neatly folding-a-treeNeatly folding-a-tree
Neatly folding-a-tree
Workhorse Computing
 

What's hot (19)

The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smart
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
 
Class 4 - PHP Arrays
Class 4 - PHP ArraysClass 4 - PHP Arrays
Class 4 - PHP Arrays
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
 
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional 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 & Perl6Neatly 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 DevelopersPHP for Python Developers
PHP for Python Developers
 
07 php
07 php07 php
07 php
 
Function Call Optimization
Function Call OptimizationFunction Call Optimization
Function Call Optimization
 
6 more things about Perl 6
6 more things about Perl 66 more things about Perl 6
6 more things about Perl 6
 
Adventures in Optimization
Adventures in OptimizationAdventures in Optimization
Adventures in Optimization
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Syntax
SyntaxSyntax
Syntax
 
Neatly folding-a-tree
Neatly folding-a-treeNeatly folding-a-tree
Neatly folding-a-tree
 

Similar to Call Return Exploration

rop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer securityrop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer security
FannyBellows
 
SPL, not a bridge too far
SPL, not a bridge too farSPL, not a bridge too far
SPL, not a bridge too far
Michelangelo van Dam
 
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N  .LC1 .st.pdfAnswer1).LC0 .string Enter the value of N  .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
annaiwatertreatment
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
Quinn Wilton
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
Motaz Saad
 
Being functional in PHP
Being functional in PHPBeing functional in PHP
Being functional in PHP
David de Boer
 
Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing FunctionallyRound PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing Functionally
Sean Cribbs
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
David de Boer
 
Reverse Engineering: C++ for operator
Reverse Engineering: C++ for operatorReverse Engineering: C++ for operator
Reverse Engineering: C++ for operator
Apriorit Inc.
 
Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorerithion
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
Sean Cribbs
 
Functional php
Functional phpFunctional php
Functional php
Jean Carlo Machado
 
Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)
osfameron
 
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docxcs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
mydrynan
 
PHPSpec BDD for PHP
PHPSpec BDD for PHPPHPSpec BDD for PHP
PHPSpec BDD for PHP
Marcello Duarte
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
Functional Thursday
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Kang-min Liu
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
David de Boer
 

Similar to Call Return Exploration (20)

rop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer securityrop heap attacks cfi int overflows computer security
rop heap attacks cfi int overflows computer security
 
SPL, not a bridge too far
SPL, not a bridge too farSPL, not a bridge too far
SPL, not a bridge too far
 
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N  .LC1 .st.pdfAnswer1).LC0 .string Enter the value of N  .LC1 .st.pdf
Answer1).LC0 .string Enter the value of N .LC1 .st.pdf
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Being functional in PHP
Being functional in PHPBeing functional in PHP
Being functional in PHP
 
Php2
Php2Php2
Php2
 
Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing FunctionallyRound PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing Functionally
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
 
Reverse Engineering: C++ for operator
Reverse Engineering: C++ for operatorReverse Engineering: C++ for operator
Reverse Engineering: C++ for operator
 
Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operator
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
 
Functional php
Functional phpFunctional php
Functional php
 
Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)
 
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docxcs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
 
PHPSpec BDD for PHP
PHPSpec BDD for PHPPHPSpec BDD for PHP
PHPSpec BDD for PHP
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
人力
人力人力
人力
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
 

Recently uploaded

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

Call Return Exploration

  • 1. Calling functions by Pushing and Jumping callReturnExploration.s
  • 2. LC0: .ascii "%dn0" .text .globl _function _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebpProgram starts here
  • 3. LC0: .ascii "%dn0" .text .globl _function _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp 8(%esp) argv 4(%esp) argc (%esp) return addr %esp 28ff2c %ebp old %ebp %eax $0
  • 4. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) 8(%esp) argv 4(%esp) argc (%esp) return addr %esp 28ff2c %ebp old %ebp %eax $0
  • 5. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff28 %ebp old %ebp %eax $0 12(%esp) argv 8(%esp) argc 4(%esp) return addr (%esp) old %ebp
  • 6. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff28 %ebp old %ebp %eax $0 12(%esp) argv 8(%esp) argc 4(%esp) return addr (%esp) old %ebp
  • 7. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff28 %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp
  • 8. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff28 %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp
  • 9. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff20 %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 4(%esp) (%esp)
  • 10. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff20 %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 4(%esp) (%esp)
  • 11. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff1c %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr
  • 12. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff1c %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr
  • 13. _function:: ... .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) %esp 28ff1c %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr
  • 14. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr %esp 28ff1c %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr
  • 15. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr %esp 28ff1c %ebp 28ff28 %eax $0 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr
  • 16. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr %esp 28ff1c %ebp 28ff28 %eax $99
  • 17. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) 4(%esp) (%esp) $retAddr %esp 28ff1c %ebp 28ff28 %eax $99
  • 18. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 4(%esp) (%esp) %esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
  • 19. _function:: movl $99, %eax # ret popl %ecx jmp *%ecx .globl _main _main:: pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 4(%esp) (%esp) %esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
  • 20. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) (%esp) %esp 28ff20 %ebp 28ff28 %eax $99%ecx $retAddr
  • 21. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) (%esp) %esp 28ff20 %ebp 28ff28 %eax $99
  • 22. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) (%esp) %esp 28ff20 %ebp 28ff28 %eax $99
  • 23. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) %esp 28ff20 %ebp 28ff28 %eax $99
  • 24. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) %esp 28ff20 %ebp 28ff28 %eax $99
  • 25. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $99
  • 26. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $99
  • 27. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) movl $LC0, (%esp) call _printf movl $0, %eax leave ret %esp 28ff1c %ebp 28ff28 %eax $99 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) $99 4(%esp) $LC0 (%esp) address of next instruction
  • 28. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) movl $LC0, (%esp) call _printf movl $0, %eax leave ret %esp 28ff1c %ebp 28ff28 %eax $99 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) $99 4(%esp) $LC0 (%esp) address of next instruction We push the address of the next instruction to the stack.
  • 29. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) movl $LC0, (%esp) call _printf movl $0, %eax leave ret %esp 28ff1c %ebp 28ff28 %eax $99 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) $99 4(%esp) $LC0 (%esp) address of next instruction We push the address of the next instruction to the stack. We jump to _printf and do our business
  • 30. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: movl %eax, 4(%esp) movl $LC0, (%esp) call _printf movl $0, %eax leave ret %esp 28ff1c %ebp 28ff28 %eax $99 12(%ebp) argv 8(%ebp) argc 4(%ebp) return addr (%ebp) old %ebp 8(%esp) $99 4(%esp) $LC0 (%esp) address of next instruction We push the address of the next instruction to the stack. We jump to _printf and do our business When finished, _printf jumps to our next instruction
  • 31. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $99
  • 32. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $99
  • 33. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $0
  • 34. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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 4(%esp) $99 (%esp) $LC0 %esp 28ff20 %ebp 28ff28 %eax $0
  • 35. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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
  • 36. pushl %ebp movl %esp, %ebp subl $8, %esp # call _function pushl $retAddr jmp _function retAddr: 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
  • 37. Calling functions by Pushing and Jumping This presentation by Pat Hawks is licensed under a Creative Commons Attribution 4.0 International License callReturnExploration.s