ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

Slides:



Advertisements
Similar presentations
Machine-Level Programming III: Procedures Feb. 8, 2000 Topics IA32 stack Stack-based languages Stack frames Register saving conventions Creating pointers.
Advertisements

For(int i = 1; i
Calling sequence ESP.
%rax %eax %rbx %ebx %rdx %edx %rcx %ecx %rsi %esi %rdi %edi %rbp %ebp %rsp %esp %r8 %r8d %r9 %r9d %r11 %r11d %r10 %r10d %r12 %r12d %r13 %r13d.
University of Washington Last Time For loops  for loop → while loop → do-while loop → goto version  for loop → while loop → goto “jump to middle” version.
Context Switch Animation Another one by Anastasia.
Machine-Level Programming III: Procedures Apr. 17, 2006 Topics IA32 stack discipline Register saving conventions Creating pointers to local variables CS213.
Context switch in Linux
Function Compiler Baojian Hua Function, or Procedure, or method, or … High-level abstraction of code logically-grouped Good for many.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
1 Function Calls Professor Jennifer Rexford COS 217 Reading: Chapter 4 of “Programming From the Ground Up” (available online from the course Web site)
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
– 1 – , F’02 ICS05 Instructor: Peter A. Dinda TA: Bin Lin Recitation 4.
Machine-Level Programming III: Procedures Jan 30, 2003
September 22, 2014 Pengju (Jimmy) Jin Section E
Stack Activation Records Topics IA32 stack discipline Register saving conventions Creating pointers to local variables February 6, 2003 CSCE 212H Computer.
0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator.
Calling Conventions Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University See P&H 2.8 and 2.12.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 IA-32
1 Carnegie Mellon Stacks : Introduction to Computer Systems Recitation 5: September 24, 2012 Joon-Sup Han Section F.
Recursion Concepts Implementation Data Structures and Algorithms in Java, Third EditionCh05 – 1.
Fabián E. Bustamante, Spring 2007 Machine-Level Programming III - Procedures Today IA32 stack discipline Register saving conventions Creating pointers.
The x86 Architecture Lecture 15 Fri, Mar 4, 2005.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Mengzhi Wang Office Hours: Thursday.
Exception Compiler Baojian Hua
Exception Compiler Baojian Hua
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
In1211/04-PDS 1 TU-Delft IA-32. In1211/04-PDS 2 TU-Delft IA family l IA (Intel Architecture) is a family of processors (1985), (1989), -Pentium-line.
Chapter 4 Process Abstraction Chien-Chung Shen CIS, UD
מבנה מחשב תרגול 4 מבנה התוכנית. 2 Introduction When we wrote: ‘int n = 10’; the compiler allocated the variable’s memory address and labeled it ‘n’. In.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 21: Calling.
Calling Conventions Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.8 and 2.12.
Machine-level Programming III: Procedures Topics –IA32 stack discipline –Register saving conventions –Creating pointers to local variables.
Stack Usage with MS Visual Studio Without Stack Protection.
Compiler Construction Code Generation Activation Records
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
1 Assembly Language: Function Calls Jennifer Rexford.
Overview of Back-end for CComp Zhaopeng Li Software Security Lab. June 8, 2009.
Microprocessor, Programming & Interfacing Tutorial 2- Module 3.
IA32 Stack –Region of memory managed with stack discipline –Grows toward lower addresses –Register %esp indicates lowest stack address address of top element.
Exploiting & Defense Day 1 Recap
Recitation 3: Procedures and the Stack
Instructions for test_function
Assembly function call convention
Reading Condition Codes (Cont.)
C function call conventions and the stack
Operating Systems Engineering
Computer Architecture and Assembly Language
Anton Burtsev February, 2017
Exploiting & Defense Day 2 Recap
Aaron Miller David Cohen Spring 2011
Homework In-line Assembly Code Machine Language
Assembly IA-32.
Yung-Hsiang Lu Purdue University
Assembly Language Programming V: In-line Assembly Code
Machine-Level Programming 4 Procedures
Stack Memory 2 (also called Call Stack)
Procedures – Overview Lecture 19 Mon, Mar 28, 2005.
Machine-Level Programming III: Procedures Sept 18, 2001
MIPS Procedure Calls CSE 378 – Section 3.
Tutorial No. 11 Module 10.
X86 Assembly Review.
Machine-Level Representation of Programs (x86-64)
Low-Level Thread Dispatching on the x86
“Way easier than when we were students”
Computer Architecture and System Programming Laboratory
Presentation transcript:

ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1 ESP EIP 100: 200: 250: 300: 350: int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main ESP EIP 100: 200: 250: 300: 350: int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main ESP EIP 100: 200: 250: 300: 350: int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESP EIP 100: 200: 250: 300: 350: int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g ESP 100: 200: 250: 300: 350: EBP EIP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g Old EBP ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g Old EBP ESP EIP 100: 200: 250: 300: 350: EBP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. }

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g Old EBP ESI EDI EBX Local Variables ESP 100: 200: 250: 300: 350: EIP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EBP

1 return address to main Old EBP ESI EDI EBX Local Variables 2 return address to g Old EBP ESI EDI EBX Local Variables ESP 100: 200: 250: 300: 350: EIP Function Frames int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EBP