IA-32 CSE 5302 Spring 2011 Ngoc Tam Tran

Similar documents
History of the Intel 80x86

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Systems Architecture I

Complex Instruction Set Computer (CISC)

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

ECE 486/586. Computer Architecture. Lecture # 7

The x86 Architecture

Architecture and components of Computer System Execution of program instructions

Intel x86-64 and Y86-64 Instruction Set Architecture

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

T Reverse Engineering Malware: Static Analysis I

COSC 6385 Computer Architecture. Instruction Set Architectures

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

17. Instruction Sets: Characteristics and Functions

T Jarkko Turkulainen, F-Secure Corporation

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Unsigned Binary Integers

Unsigned Binary Integers

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

1 Overview of the AMD64 Architecture

ECE232: Hardware Organization and Design

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

MICROPROCESSOR TECHNOLOGY

Problem with Scanning an Infix Expression

Intel Architecture Software Developer s Manual

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Machine Code and Assemblers November 6

appendix b From LC-3 to x86

An Introduction to x86 ASM

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?

UMBC. 1 (Feb. 9, 2002) seg_base + base + index. Systems Design & Programming 80x86 Assembly II CMPE 310. Base-Plus-Index addressing:

UNIT II. 2 Marks. 2. List out the various register of IA- 32 Register structure. 3. Write about General purpose registers

Addressing Modes on the x86

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Machine Language, Assemblers and Linkers"

3.0 Instruction Set. 3.1 Overview

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

COPYRIGHTED MATERIAL. What Is Assembly Language? Processor Instructions

Lecture 3: Instruction Set Architecture

COMPUTER ORGANIZATION & ARCHITECTURE

Outline. x86 Architecture

IA32 Intel 32-bit Architecture

Module 3 Instruction Set Architecture (ISA)

ECE 486/586. Computer Architecture. Lecture # 8

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit

Basic Execution Environment

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

55:132/22C:160, HPCA Spring 2011

ECE260: Fundamentals of Computer Engineering

Lecture Topics. Branch Condition Options. Branch Conditions ECE 486/586. Computer Architecture. Lecture # 8. Instruction Set Principles.

Homework 2. Lecture 6: Machine Code. Instruction Formats for HW2. Two parts: How to do Homework 2!!!!

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

Lab 3. The Art of Assembly Language (II)

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

ECE260: Fundamentals of Computer Engineering

Hardware and Software Architecture. Chapter 2

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

3.1 DATA MOVEMENT INSTRUCTIONS 45

Communicating with People (2.8)

How Software Executes

CO Computer Architecture and Programming Languages CAPL. Lecture 13 & 14

CS241 Computer Organization Spring 2015 IA

Computer System Architecture

Typical Processor Execution Cycle

Chapter 3: Addressing Modes

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

EN164: Design of Computing Systems Lecture 09: Processor / ISA 2

CISC 662 Graduate Computer Architecture. Classifying ISA. Lecture 3 - ISA Michela Taufer. In a CPU. From Source to Assembly Code

The Instruction Set. Chapter 5

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

All instructions have 3 operands Operand order is fixed (destination first)

EC 333 Microprocessor and Interfacing Techniques (3+1)

EC-801 Advanced Computer Architecture

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine

Computer Organization

CS4617 Computer Architecture

Digital Forensics Lecture 3 - Reverse Engineering

Instruction Set Principles. (Appendix B)

Memory Models. Registers

Problem with Scanning an Infix Expression

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

How Software Executes

Computer Systems Laboratory Sungkyunkwan University

Instruction Sets: Characteristics and Functions Addressing Modes

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2)

CHAPTER 5 A Closer Look at Instruction Set Architectures

Assembly Language: Function Calls

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Practical Malware Analysis

Topic 10: Instruction Representation

Transcription:

IA-32 CSE 5302 Spring 2011 Ngoc Tam Tran 3/3/2011 1

Overview IA-32(Intel Architecture 32-bit) CISC Architecture Many instructions sets 3/3/2011 2

Registers 16 basic program execution registers for use in general system and application programming 8 General-purpose registers Holding: Operands for logical and arithmetic operations Operands for address calculations Memory pointers 6 segment registers Hold up to 6 segment selectors Segment selector is a special pointer that identifies a segment in memory EFLAGS (program status and control) register Report on the status of the program being executed and allows control of the processor EIP (instruction pointer) register Contains a 32-bit pointer to the next instruction to be executed 3/3/2011 3

Registers (Cont.) 8 General Purpose Registers 6 Segment Registers EIP (instruction pointer) Register EFLAGS (program status and control Register) 3/3/2011 4

Immediate Operands Maximum size 2^32 Register Operands Operand Addressing Source and destination operands can be General-purpose registers Segment registers EFLAGS register Memory Operands Source and destination operands in memory are referenced by means of a segment selector and an offset Segment selectors specify the segment containing the operand Offsets specify the effective address of the operand 3/3/2011 5

Specifying a Segment Selector Common method is to load it in a segment register and then allow the processor to select the register implicitly depending on the type of operation The processor automatically chooses a segment according to the rules below 3/3/2011 6

Specifying an Offset Can be specified directly as a static value (displacement)or through an address computation by using Displacement An 8-, 16-, or 32-bit value Base The value in a general-purpose register Index The value in a general-purpose register Scale factor A value of 2, 4, or 8 that is multiplied by the index value Example [EAX][EDI*2 + 80] The effective address is calculated by taking the contents of register EDI multiply by 2 and add it to a constant 80, then add to the contents of register EAX 3/3/2011 7

Instruction Types for Arithmetic, Logical, & Data Transfer Instructions Source/Destination Operand Type Register Register Register Memory Memory Second Source Operand Register Immediate Memory Register Immediate Immediate: 8, 16, or 32 bits Register: 1 of 14 General Purpose or Segment Registers Arithmetic and Logical instructions must have 1 operand acts as both source and destination 1 of the operands can be in the memory 3/3/2011 8

Integer Operations Support 8-bit, 16-bit, and 32-bit Can be divided into 4 major classes Data movement instructions: move, push, pop Arithmetic & logic instructions: test, integer & decimal arithmetic operations Control flow: conditional branches, unconditional jumps, calls, returns String instructions: string move & string compare 3/3/2011 9

Integer Operations (Cont.) 3/3/2011 10

General Instruction Format Instructions consist : Instruction prefixes (optional) Opcode (1 or 2 bytes) ModR/M SIB (Scale-Index-Base) byte Displacement (if required) Immediate data field (if required) 3/3/2011 11

General Instruction Format (Cont.) Instruction prefixes Modify the instruction Repeat string instructions Provide section overrides Change operand and address sizes Opcode Decide the operation to take ModR/M Addressing modes Register/Memory Mod = 00 1st operand is a register 2nd operand is in memory, address stored in a register numbered by R/M (Memory[Reg[R/M]]) 3/3/2011 12

General Instruction Format (Cont.) ModR/M (Cont.) Mod=01 Same like Mod 00 with 8-bit displacement Mod=10 1st operand is a register 2nd operand is in memory, address stored in a register numbered by R/M plus displacement (Memory[disp8+Reg[R/M]]) Same like Mod 01 with 32-bit displacement Mod=11 SIB Bytes 2nd operand is a register, numbered by R/M Scale Index Base 3/3/2011 13

Instruction Encoding Instruction encodings are subsets of the general instruction format Encoding the instruction is complex Many different instruction formats Instruction may vary from 1 byte up to 17 bytes 3/3/2011 14

Instruction Encoding (Cont.) 3/3/2011 15

References 1. IA-32 Intel Architecture Software Developer s Manual. Volume 1: Basic Architecture. Available from http://flint.cs.yale.edu/cs422/doc/24547012.pdf. 2. IA-32. Available from http://en.wikipedia.org/wiki/ia-32. 3. D. Patterson and J. Hennessy. Computer Organization Design the Hardware/Software Interface. 3 rd Edition. 2005. 4. IA-32 Intel Architecture Software Developer s Manual. Volume 2: Instruction Set Reference. Available from http://www.cs.grinnell.edu/~walker/courses/211.fa01/pentium-3- manual-instructions.pdf 5. IA-32 (x86) Architecture. Available from http://pages.cs.wisc.edu/~cs354-1/cs354/karen.notes/pentium.html 6. IA-32 Instruction Set Architecture. Available from http://cs.gmu.edu/~huangyih/365/lec04-ia32.pdf 3/3/2011 16