The x86 Instruction Set
|
|
- Peter Nichols
- 5 years ago
- Views:
Transcription
1 The x86 Instruction Set Lecture 25 Intel Manual, Vols. 2A & 2B Robb T. Koether Hampden-Sydney College Mon, Mar 23, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
2 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
3 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
4 The Runtime Stack The runtime stack is a portion of memory that is used as a stack during program execution. The address of the top of the stack is stored in the register esp, called the stack pointer. The stack grows in a downward direction. When values are pushed, esp is decremented. When values are popped, esp is incremented. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
5 The Runtime Stack esp points to the top of the stack. Stack esp Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
6 The Runtime Stack Push the value 100 and decrement esp. Stack 100 esp Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
7 The Runtime Stack Push the value 200 and decrement esp again. Stack esp Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
8 The Runtime Stack Pop a value and increment esp. Stack 100 esp Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
9 The Runtime Stack Pop another value and increment esp again. Stack esp Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
10 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
11 The Push and Pop Instructions push and pop Instructions push source pop destination where source is a register, a memory address, or an immediate value. destination is a register or a memory address. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
12 The Push and Pop Instructions The push instruction will decrement the stack pointer and then move source to the stack. The pop instruction will move the value on the stack to destination and then increment the stack pointer. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
13 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
14 Processing the Syntax Tree The syntax tree is processed in a left-to-right post-order traversal. At each node Process the left subtree. Process the right subtree. Process the node. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
15 Using the Stack As each node of the syntax tree is executed, it will leave its result on the run-time stack. The next node will pop that result off the stack (if it needs it) and then push its own result onto the stack (if there is one), and so on. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
16 Example The syntax tree for a = b + c - 5 is ASSIGN a MINUS PLUS NUM 5 DEREF DEREF b c Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
17 ASSIGN a MINUS PLUS NUM 5 DEREF DEREF b c Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
18 - Push the address of a. ASSIGN a MINUS PLUS NUM 5 DEREF DEREF b c addr(a) Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
19 ASSIGN - Push the address of a. - Push the address of b. a MINUS PLUS NUM 5 DEREF DEREF b c addr(a) addr(a), addr(b) Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
20 a ASSIGN MINUS - Push the address of a. - Push the address of b. DEREF - Pop the address of b, push the value of b. PLUS NUM 5 DEREF DEREF b c addr(a) addr(a), addr(b) addr(a), 10 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
21 - Push the address of a. a ASSIGN MINUS - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. PLUS NUM 5 DEREF DEREF b c addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
22 - Push the address of a. a ASSIGN PLUS MINUS NUM 5 - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. DEREF - Pop the address of c, push the value of c. DEREF DEREF b c addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) addr(a), 10, 20 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
23 - Push the address of a. a ASSIGN PLUS MINUS NUM 5 - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. DEREF - Pop the address of c, push the value of c. PLUS - Pop two values, add them, push the result. DEREF DEREF b c addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) addr(a), 10, 20 addr(a), 30 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
24 - Push the address of a. a ASSIGN MINUS PLUS DEREF DEREF NUM 5 - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. DEREF - Pop the address of c, push the value of c. PLUS - Pop two values, add them, push the result. NUM - Push 5. b c addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) addr(a), 10, 20 addr(a), 30 addr(a), 30, 5 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
25 - Push the address of a. a ASSIGN MINUS PLUS DEREF DEREF NUM 5 - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. DEREF - Pop the address of c, push the value of c. PLUS - Pop two values, add them, push the result. NUM - Push 5. MINUS - Pop two values, subtract them, push the result. b c addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) addr(a), 10, 20 addr(a), 30 addr(a), 30, 5 addr(a), 25 Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
26 - Push the address of a. a ASSIGN MINUS PLUS DEREF DEREF b c NUM 5 - Push the address of b. DEREF - Pop the address of b, push the value of b. - Push the address of c. DEREF - Pop the address of c, push the value of c. PLUS - Pop two values, add them, push the result. NUM - Push 5. MINUS - Pop two values, subtract them, push the result. ASSIGN - Pop the value and the address, store the value at the address, push the result. addr(a) addr(a), addr(b) addr(a), 10 addr(a), 10, addr(c) addr(a), 10, 20 addr(a), 30 addr(a), 30, 5 addr(a), Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
27 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
28 A NUM Node Example (A NUM Node) push $5 A NUM node loads the integer whose value is stored in the node. For example, to load 5. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
29 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
30 An Node Example (An Node) lea a,%eax push %eax A node pushes the address of the name that is stored in the node. For example, to push the address a. The actual address of a is not known when the program is assembled. Thus, the object code does not contain the correct address of a. The address becomes known when the program is loaded into main memory to be executed. At that time, lea will produce the actual address. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
31 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
32 A DEREF Node Example (The DEREF Node) pop %eax push (%eax) A DEREF node expects to find a memory address on top of the stack. It pushes the value stored at that address. The parentheses mean the value at the address in the register. This is the indirect addressing mode. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
33 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
34 The add Instruction The add Instruction add source,destination where source is a register, a memory address, or an immediate value. destination is a register or a memory address. The value at source is added to the value at destination and the result is stored at destination Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
35 A PLUS Node Example (A PLUS Node) pop %edx pop %eax add %edx,%eax push %eax A PLUS node expects to find two numbers on the stack. The right operand should be on top. It pops the values, adds them, and pushes the result. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
36 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
37 An ASSIGN Node Example (An ASSIGN Node) pop %eax pop %edx mov %eax,(%edx) push %eax An ASSIGN node expects to find an address and a value on the stack. The value should be on top. It pops the value and the address, stores the value at the address, and pushes the value. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
38 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
39 The imul Instruction The imul instruction performs multiplication of signed integers. There are three formats. For each format, the destination is edx:eax, which holds a 64-bit value. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
40 The imul Instruction The imul Instruction (Type 1) imul source where source is one operand. eax is the other operand. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
41 The imul Instruction The imul Instruction (Type 2) imul register,source where source is a register, a memory address, or an immediate value. register is the destination. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
42 The imul Instruction The imul Instruction (Type 3) imul register,source,immediate where register is the destination. source is a register, a memory address, or an immediate value. immediate is a number. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
43 A TIMES Node Example (A TIMES Node) pop %eax pop %ecx imul %ecx push %eax A TIMES node expects to find two values on the stack. It pops them, multiplies them, and pushes the result. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
44 Outline 1 The x86 Instruction Set Push and Pop 2 Processing the AST NUM Nodes Nodes DEREF Nodes PLUS Nodes ASSIGN Nodes TIMES Nodes 3 Assignment Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
45 Assignment Assignment Read the descriptions of the above operations in the Intel Manual, Vols. 2A and 2B. Also, look up and read about subtraction and division. Robb T. Koether (Hampden-Sydney College) The x86 Instruction Set Mon, Mar 23, / 32
The x86 Architecture
The x86 Architecture Lecture 24 Intel Manual, Vol. 1, Chapter 3 Robb T. Koether Hampden-Sydney College Fri, Mar 20, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Architecture Fri, Mar 20, 2015
More informationLecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86
Lecture 15 Intel Manual, Vol. 1, Chapter 3 Hampden-Sydney College Fri, Mar 6, 2009 Outline 1 2 Overview See the reference IA-32 Intel Software Developer s Manual Volume 1: Basic, Chapter 3. Instructions
More informationStack Applications. Lecture 27 Sections Robb T. Koether. Hampden-Sydney College. Wed, Mar 29, 2017
Stack Applications Lecture 27 Sections 18.7-18.8 Robb T. Koether Hampden-Sydney College Wed, Mar 29, 2017 Robb T. Koether Hampden-Sydney College) Stack Applications Wed, Mar 29, 2017 1 / 27 1 Function
More informationBuilding the Abstract Syntax Trees
Building the Abstract Syntax Trees Lecture 23 Section 5.3 Robb T. Koether Hampden-Sydney College Wed, Mar 18, 2015 Robb T. Koether (Hampden-Sydney College) Building the Abstract Syntax Trees Wed, Mar 18,
More informationStack Applications. Lecture 25 Sections Robb T. Koether. Hampden-Sydney College. Mon, Mar 30, 2015
Stack Applications Lecture 25 Sections 18.7-18.8 Robb T. Koether Hampden-Sydney College Mon, Mar 30, 2015 Robb T. Koether Hampden-Sydney College) Stack Applications Mon, Mar 30, 2015 1 / 34 1 The Triangle
More informationThe x87 Floating-Point Unit
The x87 Floating-Point Unit Lecture 27 Intel Manual, Vol. 1, Chapter 8 Intel Manual, Vol. 2 Robb T. Koether Hampden-Sydney College Fri, Mar 27, 2015 Robb T. Koether (Hampden-Sydney College) The x87 Floating-Point
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationList Iterator Implementation
List Iterator Implementation Lecture 28 Section 14.6 Robb T. Koether Hampden-Sydney College Fri, Apr 10, 2015 Robb T. Koether (Hampden-Sydney College) List Iterator Implementation Fri, Apr 10, 2015 1 /
More informationRecursive Descent Parsers
Recursive Descent Parsers Lecture 7 Robb T. Koether Hampden-Sydney College Wed, Jan 28, 2015 Robb T. Koether (Hampden-Sydney College) Recursive Descent Parsers Wed, Jan 28, 2015 1 / 18 1 Parsing 2 LL Parsers
More informationFunction Definition Syntax Tree
Function Definition Syntax Tree Lecture 34 Section 6.9 Robb T. Koether Hampden-Sydney College Wed, Apr 15, 2015 Robb T. Koether (Hampden-Sydney College) Function Definition Syntax Tree Wed, Apr 15, 2015
More informationStacks and their Applications
Stacks and their Applications Lecture 23 Sections 18.1-18.2 Robb T. Koether Hampden-Sydney College Fri, Mar 16, 2018 Robb T. Koether Hampden-Sydney College) Stacks and their Applications Fri, Mar 16, 2018
More informationRecursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 27, 2013
Recursive Sequences Lecture 24 Section 5.6 Robb T. Koether Hampden-Sydney College Wed, Feb 27, 2013 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 27, 2013 1 / 21 1 Recursive Sequences
More informationThe Critical-Path Algorithm
The Critical-Path Algorithm Lecture 32 Sections 8.3-8.4 Robb T. Koether Hampden-Sydney College Wed, Nov 19, 2014 Robb T. Koether (Hampden-Sydney College) The Critical-Path Algorithm Wed, Nov 19, 2014 1
More informationRecursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 26, 2014
Recursive Sequences Lecture 24 Section 5.6 Robb T. Koether Hampden-Sydney College Wed, Feb 26, 2014 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 26, 2014 1 / 26 1 Recursive Sequences
More informationAbstract Syntax Trees Synthetic and Inherited Attributes
Abstract Syntax Trees Synthetic and Inherited Attributes Lecture 22 Sections 5.1-5.2 Robb T. Koether Hampden-Sydney College Mon, Mar 16, 2015 Robb T. Koether (Hampden-Sydney College)Abstract Syntax TreesSynthetic
More informationMinimal Spanning Trees
Minimal Spanning Trees Lecture 33 Sections 7.1-7.3 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 20 Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 1 / 17 1 Networks
More informationInteger Overflow. Lecture 8 Section 2.5. Robb T. Koether. Hampden-Sydney College. Mon, Jan 27, 2014
Integer Overflow Lecture 8 Section 2.5 Robb T. Koether Hampden-Sydney College Mon, Jan 27, 2014 Robb T. Koether (Hampden-Sydney College) Integer Overflow Mon, Jan 27, 2014 1 / 32 1 Signed Addition and
More informationComputer Systems Organization V Fall 2009
Computer Systems Organization V22.0201 Fall 2009 Sample Midterm Exam ANSWERS 1. True/False. Circle the appropriate choice. (a) T (b) F At most one operand of an x86 assembly instruction can be an memory
More informationScheduling and Digraphs
Scheduling and Digraphs Lecture 35 Sections 8.1, 8.2 Robb T. Koether Hampden-Sydney College Mon, Nov 21, 2016 Robb T. Koether (Hampden-Sydney College) Scheduling and Digraphs Mon, Nov 21, 2016 1 / 25 1
More informationPointers. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Mon, Jan 20, 2014
Pointers Lecture 2 Sections 10.3-10.8 Robb T. Koether Hampden-Sydney College Mon, Jan 20, 2014 Robb T. Koether (Hampden-Sydney College) Pointers Mon, Jan 20, 2014 1 / 35 1 Endianness 2 Pointer Arithmetic
More informationThe Pairwise-Comparison Method
The Pairwise-Comparison Method Lecture 10 Section 1.5 Robb T. Koether Hampden-Sydney College Mon, Sep 11, 2017 Robb T. Koether (Hampden-Sydney College) The Pairwise-Comparison Method Mon, Sep 11, 2017
More informationRecursive Linked Lists
Recursive Linked Lists Lecture 28 Sections 14.1-14.5, 14.7 Robb T. Koether Hampden-Sydney College Fri, Mar 31, 2017 Robb T. Koether (Hampden-Sydney College) Recursive Linked Lists Fri, Mar 31, 2017 1 /
More informationOperators. Lecture 12 Section Robb T. Koether. Hampden-Sydney College. Fri, Feb 9, 2018
Operators Lecture 12 Section 14.5 Robb T. Koether Hampden-Sydney College Fri, Feb 9, 2018 Robb T. Koether (Hampden-Sydney College) Operators Fri, Feb 9, 2018 1 / 21 Outline 1 Operators as Functions 2 Operator
More informationProgramming Languages
Programming Languages Lecture 3 Section 1.3 Robb T. Koether Hampden-Sydney College Mon, Sep 2, 2013 Robb T. Koether (Hampden-Sydney College) Programming Languages Mon, Sep 2, 2013 1 / 25 1 Programming
More informationFriends and Unary Operators
Friends and Unary Operators Lecture 11 Sections 11.3, 11.6 Robb T. Koether Hampden-Sydney College Fri, Feb 13, 2015 Robb T. Koether (Hampden-Sydney College) Friends and Unary Operators Fri, Feb 13, 2015
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 16 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Mon, Oct 7, 2013 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Mon, Oct 7,
More informationSampling Distribution Examples Sections 15.4, 15.5
Sampling Distribution Examples Sections 15.4, 15.5 Lecture 27 Robb T. Koether Hampden-Sydney College Wed, Mar 2, 2016 Robb T. Koether (Hampden-Sydney College)Sampling Distribution ExamplesSections 15.4,
More informationLR Parsing - Conflicts
LR Parsing - Conflicts Lecture 15 Sections 4.5, 4.6 Robb T. Koether Hampden-Sydney College Fri, Feb 20, 2015 Robb T. Koether (Hampden-Sydney College) LR Parsing - Conflicts Fri, Feb 20, 2015 1 / 15 1 Shift/Reduce
More informationPointers. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Fri, Jan 18, 2013
Pointers Lecture 2 Sections 10.3-10.8 Robb T. Koether Hampden-Sydney College Fri, Jan 18, 2013 Robb T. Koether (Hampden-Sydney College) Pointers Fri, Jan 18, 2013 1 / 35 1 Introduction 2 Pointer Arithmetic
More informationAssembly Language Programming: Procedures. EECE416 uc. Charles Kim Howard University. Fall
Assembly Language Programming: Procedures EECE416 uc Charles Kim Howard University Fall 2013 www.mwftr.com Before we start Schedule of the next few weeks T Nov 19: Procedure and Calls (continued) R Nov
More informationBinary Tree Applications
Binary Tree Applications Lecture 30 Section 19.2 Robb T. Koether Hampden-Sydney College Wed, Apr 15, 2015 Robb T. Koether (Hampden-Sydney College) Binary Tree Applications Wed, Apr 15, 2015 1 / 56 1 Binary
More informationCNIT 127: Exploit Development. Ch 1: Before you begin. Updated
CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial
More informationThe Traveling Salesman Problem Nearest-Neighbor Algorithm
The Traveling Salesman Problem Nearest-Neighbor Algorithm Lecture 31 Sections 6.4 Robb T. Koether Hampden-Sydney College Fri, Apr 6, 2018 Robb T. Koether (Hampden-Sydney College)The Traveling Salesman
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
More informationMicroprocessors ( ) Fall 2010/2011 Lecture Notes # 15. Stack Operations. 10 top
Microprocessors (0630371) Fall 2010/2011 Lecture Notes # 15 Stack Operations Objectives of the Lecture Runtime Stack PUSH Operation POP Operation Initializing the Stack PUSH and POP Instructions Stack
More informationThe Decreasing-Time Algorithm
The Decreasing-Time Algorithm Lecture 36 Sections 8.4 Robb T. Koether Hampden-Sydney College Wed, Apr 18, 2018 Robb T. Koether (Hampden-Sydney College) The Decreasing-Time Algorithm Wed, Apr 18, 2018 1
More informationProgram Exploitation Intro
Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be
More informationRecursion. Lecture 26 Sections , Robb T. Koether. Hampden-Sydney College. Mon, Apr 6, 2015
Recursion Lecture 26 Sections 14.1-14.5, 14.7 Robb T. Koether Hampden-Sydney College Mon, Apr 6, 2015 Robb T. Koether (Hampden-Sydney College) Recursion Mon, Apr 6, 2015 1 / 18 1 Recursion 2 Advantages
More informationProgramming Languages
Programming Languages Lecture 3 Robb T. Koether Hampden-Sydney College Fri, Aug 31, 2018 Robb T. Koether (Hampden-Sydney College) Programming Languages Fri, Aug 31, 2018 1 / 23 1 Programming Languages
More informationThe Traveling Salesman Problem Brute Force Method
The Traveling Salesman Problem Brute Force Method Lecture 30 Sections 6.1, 6.3 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College)The Traveling Salesman Problem
More informationDigital Forensics Lecture 3 - Reverse Engineering
Digital Forensics Lecture 3 - Reverse Engineering Low-Level Software Akbar S. Namin Texas Tech University Spring 2017 Reverse Engineering High-Level Software Low-level aspects of software are often the
More informationIntroduction to Compiler Design
Introduction to Compiler Design Lecture 1 Chapters 1 and 2 Robb T. Koether Hampden-Sydney College Wed, Jan 14, 2015 Robb T. Koether (Hampden-Sydney College) Introduction to Compiler Design Wed, Jan 14,
More informationLecture 20 Sections Wed, Apr 1, 2009
s Return End Call s Lecture 20 Sections 7.1-7.5 Hampden-Sydney College Wed, Apr 1, 2009 Outline s Return 1 s Return End End Call s 2 Call s 3 s Return End Call s To write the assembly code for the beginning
More informationwhile Loops Lecture 13 Sections Robb T. Koether Wed, Sep 26, 2018 Hampden-Sydney College
while Loops Lecture 13 Sections 5.8-5.9 Robb T. Koether Hampden-Sydney College Wed, Sep 26, 2018 Robb T. Koether (Hampden-Sydney College) while Loops Wed, Sep 26, 2018 1 / 25 1 while Loops 2 Input Loops
More informationBinghamton University. CS-220 Spring x86 Assembler. Computer Systems: Sections
x86 Assembler Computer Systems: Sections 3.1-3.5 Disclaimer I am not an x86 assembler expert. I have never written an x86 assembler program. (I am proficient in IBM S/360 Assembler and LC3 Assembler.)
More informationPointer Arithmetic. Lecture 4 Chapter 10. Robb T. Koether. Hampden-Sydney College. Wed, Jan 25, 2017
Pointer Arithmetic Lecture 4 Chapter 10 Robb T. Koether Hampden-Sydney College Wed, Jan 25, 2017 Robb T. Koether (Hampden-Sydney College) Pointer Arithmetic Wed, Jan 25, 2017 1 / 36 1 Pointer Arithmetic
More informationIntel assembly language using gcc
QOTD Intel assembly language using gcc Assembly language programming is difficult. Make no mistake about that. It is not for wimps and weaklings. - Tanenbaum s 6th, page 519 These notes are a supplement
More informationComputer Architecture Prof. Smruti Ranjan Sarangi Department of Computer Science and Engineering Indian Institute of Technology, Delhi
Computer Architecture Prof. Smruti Ranjan Sarangi Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture - 11 X86 Assembly Language Part-II (Refer Slide Time: 00:25)
More informationSolving Recursive Sequences by Iteration
Solving Recursive Sequences by Iteration Lecture 25 Section 5.7 Robb T. Koether Hampden-Sydney College Thu, Feb 28, 2013 Robb T. Koether (Hampden-Sydney College) Solving Recursive Sequences by Iteration
More informationCompiler construction. x86 architecture. This lecture. Lecture 6: Code generation for x86. x86: assembly for a real machine.
This lecture Compiler construction Lecture 6: Code generation for x86 Magnus Myreen Spring 2018 Chalmers University of Technology Gothenburg University x86 architecture s Some x86 instructions From LLVM
More informationDensity Curves Sections
Density Curves Sections 3.1-3.2 Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Jan 27, 2016 Robb T. Koether (Hampden-Sydney College) Density CurvesSections 3.1-3.2 Wed, Jan 27, 2016 1 / 18 Outline
More informationRotations and Translations
Rotations and Translations Lecture 33 Sections 11.3-11.4 Robb T. Koether Hampden-Sydney College Wed, Nov 20, 2013 Robb T. Koether (Hampden-Sydney College) Rotations and Translations Wed, Nov 20, 2013 1
More informationadministrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions?
administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? exam on Wednesday today s material not on the exam 1 Assembly Assembly is programming
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 7. Procedures and the Stack
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 7 Procedures and the Stack April, 2014 1 Assembly Language LAB Runtime Stack and Stack
More informationComputer Systems Lecture 9
Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions
More informationAssignment 11: functions, calling conventions, and the stack
Assignment 11: functions, calling conventions, and the stack ECEN 4553 & 5013, CSCI 4555 & 5525 Prof. Jeremy G. Siek December 5, 2008 The goal of this week s assignment is to remove function definitions
More informationUW CSE 351, Winter 2013 Midterm Exam
Full Name: Student ID: UW CSE 351, Winter 2013 Midterm Exam February 15, 2013 Instructions: Make sure that your exam is not missing any of the 9 pages, then write your full name and UW student ID on the
More informationRecognition of Tokens
Recognition of Tokens Lecture 3 Section 3.4 Robb T. Koether Hampden-Sydney College Mon, Jan 19, 2015 Robb T. Koether (Hampden-Sydney College) Recognition of Tokens Mon, Jan 19, 2015 1 / 21 1 A Class of
More informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
More informationBoolean Expressions. Lecture 31 Sections 6.6, 6.7. Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015
Boolean Expressions Lecture 31 Sections 6.6, 6.7 Robb T. Koether Hampden-Sydney College Wed, Apr 8, 2015 Robb T. Koether (Hampden-Sydney College) Boolean Expressions Wed, Apr 8, 2015 1 / 22 1 Relational
More informationThe Model Stack. Lecture 8. Robb T. Koether. Hampden-Sydney College. Wed, Sep 6, 2017
The Model Stack Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Sep 6, 2017 Robb T. Koether (Hampden-Sydney College) The Model Stack Wed, Sep 6, 2017 1 / 19 Outline 1 Drawing Rectangle Man 2 The
More informationLR Parsing - The Items
LR Parsing - The Items Lecture 10 Sections 4.5, 4.7 Robb T. Koether Hampden-Sydney College Fri, Feb 13, 2015 Robb T. Koether (Hampden-Sydney College) LR Parsing - The Items Fri, Feb 13, 2015 1 / 31 1 LR
More informationProcedure Calls. Young W. Lim Mon. Young W. Lim Procedure Calls Mon 1 / 29
Procedure Calls Young W. Lim 2017-08-21 Mon Young W. Lim Procedure Calls 2017-08-21 Mon 1 / 29 Outline 1 Introduction Based on Stack Background Transferring Control Register Usage Conventions Procedure
More informationCS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it
More informationThe Class Construct Part 1
The Class Construct Part 1 Lecture 23 Sections 7.5-7.6 Robb T. Koether Hampden-Sydney College Fri, Oct 26, 2018 Robb T. Koether (Hampden-Sydney College) The Class Construct Part 1 Fri, Oct 26, 2018 1 /
More informationWebpage Navigation. Lecture 27. Robb T. Koether. Hampden-Sydney College. Mon, Apr 2, 2018
Webpage Navigation Lecture 27 Robb T. Koether Hampden-Sydney College Mon, Apr 2, 2018 Robb T. Koether (Hampden-Sydney College) Webpage Navigation Mon, Apr 2, 2018 1 / 16 1 Popup Boxes 2 The Document Object
More informationAmbient and Diffuse Light
Ambient and Diffuse Light Lecture 20 Robb T. Koether Hampden-Sydney College Mon, Oct 12, 2015 Robb T. Koether (Hampden-Sydney College) Ambient and Diffuse Light Mon, Oct 12, 2015 1 / 29 Outline 1 Lighting
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationTotal Orders. Lecture 41 Section 8.5. Robb T. Koether. Hampden-Sydney College. Mon, Apr 8, 2013
Total Orders Lecture 41 Section 8.5 Robb T. Koether Hampden-Sydney College Mon, Apr 8, 2013 Robb T. Koether (Hampden-Sydney College) Total Orders Mon, Apr 8, 2013 1 / 30 1 Total Orders 2 Topological Sorting
More informationFunction Usage. Lecture 15 Sections 6.3, 6.4. Robb T. Koether. Hampden-Sydney College. Mon, Oct 1, 2018
Function Usage Lecture 15 Sections 6.3, 6.4 Robb T. Koether Hampden-Sydney College Mon, Oct 1, 2018 Robb T. Koether (Hampden-Sydney College) Function Usage Mon, Oct 1, 2018 1 / 12 1 Function and Parameters
More informationWinter Compiler Construction T11 Activation records + Introduction to x86 assembly. Today. Tips for PA4. Today:
Winter 2006-2007 Compiler Construction T11 Activation records + Introduction to x86 assembly Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv University Today ic IC Language Lexical Analysis
More informationMagnification and Minification
Magnification and Minification Lecture 30 Robb T. Koether Hampden-Sydney College Fri, Nov 6, 2015 Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 1 / 17 Outline
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 17 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Fri, Oct 5, 2018 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Fri, Oct 5,
More informationLow-Level Essentials for Understanding Security Problems Aurélien Francillon
Low-Level Essentials for Understanding Security Problems Aurélien Francillon francill@eurecom.fr Computer Architecture The modern computer architecture is based on Von Neumann Two main parts: CPU (Central
More informationThe Graphics Pipeline
The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Fri, Aug 28, 2015 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 1 / 19 Outline 1 Vertices 2 The
More informationProcedure Calls. Young W. Lim Sat. Young W. Lim Procedure Calls Sat 1 / 27
Procedure Calls Young W. Lim 2016-11-05 Sat Young W. Lim Procedure Calls 2016-11-05 Sat 1 / 27 Outline 1 Introduction References Stack Background Transferring Control Register Usage Conventions Procedure
More informationStack -- Memory which holds register contents. Will keep the EIP of the next address after the call
Call without Parameter Value Transfer What are involved? ESP Stack Pointer Register Grows by 4 for EIP (return address) storage Stack -- Memory which holds register contents Will keep the EIP of the next
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 9 Integer Arithmetic and Bit Manipulation April, 2014 1 Assembly Language LAB Bitwise
More informationRecursion. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 17, 2018
Recursion Lecture 2 Sections 20.1-20.4 Robb T. Koether Hampden-Sydney College Wed, Jan 17, 2018 Robb T. Koether (Hampden-Sydney College) Recursion Wed, Jan 17, 2018 1 / 18 1 Recursion 2 Advantages and
More informationThe Graphics Pipeline
The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Wed, Aug 23, 2017 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 1 / 19 Outline 1 Vertices 2 The
More informationCompiler Construction D7011E
Compiler Construction D7011E Lecture 8: Introduction to code generation Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 What is a Compiler? Compilers
More informationAssembly Language Lab # 9
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Assembly Language Lab # 9 Stacks and Subroutines Eng. Doaa Abu Jabal Assembly Language Lab # 9 Stacks and Subroutines
More informationLinked Lists. Lecture 16 Sections Robb T. Koether. Hampden-Sydney College. Wed, Feb 22, 2017
Linked Lists Lecture 16 Sections 17.1-17.3 Robb T. Koether Hampden-Sydney College Wed, Feb 22, 2017 Robb T. Koether (Hampden-Sydney College) Linked Lists Wed, Feb 22, 2017 1 / 24 1 Linked Lists 2 The LinkedListNode
More informationSample Exam I PAC II ANSWERS
Sample Exam I PAC II ANSWERS Please answer questions 1 and 2 on this paper and put all other answers in the blue book. 1. True/False. Please circle the correct response. a. T In the C and assembly calling
More informationHistory of the Intel 80x86
Intel s IA-32 Architecture Cptr280 Dr Curtis Nelson History of the Intel 80x86 1971 - Intel invents the microprocessor, the 4004 1975-8080 introduced 8-bit microprocessor 1978-8086 introduced 16 bit microprocessor
More informationList Iterators. Lecture 27 Section Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015
List Iterators Lecture 27 Section 16.5 Robb T. Koether Hampden-Sydney College Wed, Apr 8, 2015 Robb T. Koether (Hampden-Sydney College) List Iterators Wed, Apr 8, 2015 1 / 28 1 Sequential Access 2 List
More informationFundamental Data Types
Fundamental Data Types Lecture 4 Sections 2.7-2.10 Robb T. Koether Hampden-Sydney College Mon, Sep 3, 2018 Robb T. Koether (Hampden-Sydney College) Fundamental Data Types Mon, Sep 3, 2018 1 / 25 1 Integers
More information4) C = 96 * B 5) 1 and 3 only 6) 2 and 4 only
Instructions: The following questions use the AT&T (GNU) syntax for x86-32 assembly code, as in the course notes. Submit your answers to these questions to the Curator as OQ05 by the posted due date and
More informationAn Introduction to x86 ASM
An Introduction to x86 ASM Malware Analysis Seminar Meeting 1 Cody Cutler, Anton Burtsev Registers General purpose EAX, EBX, ECX, EDX ESI, EDI (index registers, but used as general in 32-bit protected
More informationStreet-Routing Problems
Street-Routing Problems Lecture 26 Sections 5.1-5.2 Robb T. Koether Hampden-Sydney College Wed, Oct 25, 2017 Robb T. Koether (Hampden-Sydney College) Street-Routing Problems Wed, Oct 25, 2017 1 / 21 1
More informationChapter 3: Addressing Modes
Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires
More informationImplementing Linked Lists
Implementing Linked Lists Lecture 16 Sections 17.1-17.3 Robb T. Koether Hampden-Sydney College Wed, Feb 27, 2013 Robb T. Koether (Hampden-Sydney College) Implementing Linked Lists Wed, Feb 27, 2013 1 /
More informationXPath Lecture 34. Robb T. Koether. Hampden-Sydney College. Wed, Apr 11, 2012
XPath Lecture 34 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 2012 Robb T. Koether (Hampden-Sydney College) XPathLecture 34 Wed, Apr 11, 2012 1 / 20 1 XPath Functions 2 Predicates 3 Axes Robb T.
More informationCredits and Disclaimers
Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 2 nd Edition by Bryant and O'Hallaron
More informationCS241 Computer Organization Spring 2015 IA
CS241 Computer Organization Spring 2015 IA-32 2-10 2015 Outline! Review HW#3 and Quiz#1! More on Assembly (IA32) move instruction (mov) memory address computation arithmetic & logic instructions (add,
More informationInline Assembler. Willi-Hans Steeb and Yorick Hardy. International School for Scientific Computing
Inline Assembler Willi-Hans Steeb and Yorick Hardy International School for Scientific Computing e-mail: steebwilli@gmail.com Abstract We provide a collection of inline assembler programs. 1 Using the
More informationArray Lists. Lecture 15. Robb T. Koether. Hampden-Sydney College. Mon, Feb 22, 2016
Array Lists Lecture 15 Robb T. Koether Hampden-Sydney College Mon, Feb 22, 2016 Robb T. Koether (Hampden-Sydney College) Array Lists Mon, Feb 22, 2016 1 / 23 1 Inlining Functions 2 List Implementations
More informationPointers. Lecture 1 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 14, 2015
Pointers Lecture 1 Sections 10.1-10.2 Robb T. Koether Hampden-Sydney College Wed, Jan 14, 2015 Robb T. Koether (Hampden-Sydney College) Pointers Wed, Jan 14, 2015 1 / 23 1 Pointers 2 Pointer Initialization
More information