Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.

Slides:



Advertisements
Similar presentations
There are two types of addressing schemes:
Advertisements

Computer Organization and Assembly Languages Yung-Yu Chuang
Computer Organization and Architecture
IA-32 Processor Architecture
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
CS2422 Assembly Language & System Programming November 28, 2006.
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Microprocessors Introduction to ia32 Architecture Jan 31st, 2002.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 111 Today’s class Instruction set architecture.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2:
An Introduction to IA-32 Processor Architecture Eddie Lopez CSCI 6303 Oct 6, 2008.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 2: IA-32 Processor Architecture (c) Pearson Education, All rights reserved. You.
VAX-11/780 – A Virtual Address Extension to the DEC PDP-11 Family ( Author : W.D.Strecker ) By Padmaja chowti.
The Pentium Processor.
The Pentium Processor Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
The Pentium Processor Chapter 3 S. Dandamudi.
Machine Instruction Characteristics
Intel Pentium II Processor Brent Perry Pat Reagan Brian Davis Umesh Vemuri.
Low Level Programming Lecturer: Duncan Smeed Overview of IA-32 Part 1.
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
The x86 Architecture Lecture 15 Fri, Mar 4, 2005.
IA32 (Pentium) Processor Architecture. Processor modes: 1.Protected (mode we will study) – 32-bit mode – 32-bit (4GB) address space 2.Virtual 8086 modes.
Assembly תרגול 5 תכנות באסמבלי. Assembly vs. Higher level languages There are NO variables’ type definitions.  All kinds of data are stored in the same.
1 ICS 51 Introductory Computer Organization Fall 2009.
Overview of Processor Techniques A brief look at CDA 3101 and CDA 5155.
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
26-Nov-15 (1) CSC Computer Organization Lecture 6: Pentium IA-32.
Oct. 25, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Alternative Instruction Sets * Jeremy R. Johnson Wed. Oct. 25, 2000.
Other Processors. Having learnt MIPS, we can learn other major processors. Not going to be able to cover everything; will pick on the interesting aspects.
EEL5708/Bölöni Lec 8.1 9/19/03 September, 2003 Lotzi Bölöni Fall 2003 EEL 5708 High Performance Computer Architecture Lecture 5 Intel 80x86.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
NASM ASSEMBLER & COMPILE WITH GCC 어셈러브 refered to ‘PC Assembly Language’ by Paul A. Carter
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
The Microprocessor & Its Architecture A Course in Microprocessor Electrical Engineering Department Universitas 17 Agustus 1945 Jakarta.
Assembly Language Addressing Modes. Introduction CISC processors usually supports more addressing modes than RISC processors. –RISC processors use the.
Computer Science 516 Intel x86 Overview. Intel x86 Family Eight-bit 8080, 8085 – 1970s 16-bit 8086 – was internally 16 bits, externally 8 bits.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Chapter Overview General Concepts IA-32 Processor Architecture
Assembly language.
IA32 Processors Evolutionary Design
x86 Processor Architecture
Other Processors.
Basic Microprocessor Architecture
University of Gujrat Department of Computer Science
Assembly Language for x86 Processors
MMX Multi Media eXtensions
CS170 Computer Organization and Architecture I
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
CS 301 Fall 2002 Computer Organization
MIPS Procedure Calls CSE 378 – Section 3.
Week 2: Buffer Overflow Part 1.
Computer Architecture CST 250
Other Processors Having learnt MIPS, we can learn other major processors. Not going to be able to cover everything; will pick on the interesting aspects.
Computer Architecture and System Programming Laboratory
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Introduction to Intel IA-32 and IA-64 Instruction Set Architectures

The code we used in the class The assembly code is The inline assembly code is:

9/27/ :23:26 PMweek06-3.ppt3 History

9/27/ :23:26 PMweek06-3.ppt4 Recent Intel Processors The Intel® Pentium® 4 Processor Family ( ) The Intel® Xeon® Processor ( ) The Intel® Pentium® M Processor (2003-Current) The Intel® Pentium® Processor Extreme Edition ( ) The Intel® Core™ Duo and Intel® Core™ Solo Processors (2006-Current) The Intel® Xeon® Processor 5100 Series and Intel® Core™2 Processor Family (2006-Current)

9/27/ :23:27 PMweek06-3.ppt5 History

9/27/ :23:27 PMweek06-3.ppt6 Most Recent Intel Processors

9/27/ :23:28 PMweek06-3.ppt7 Intel Core 2 Duo Processors

9/27/ :23:28 PMweek06-3.ppt8 Intel Core 2 Quad Processors

9/27/ :23:29 PMweek06-3.ppt9 Bit and Byte Ordering

9/27/ :23:29 PMweek06-3.ppt10 Intel Assembly Each instruction is represented by – Where label presents the line – A mnemonic is a reserved name for a class of instruction opcodes which have the same function. – The operands argument1, argument2, and argument3 are optional. There may be from zero to three operands, depending on the instruction

9/27/ :23:30 PMweek06-3.ppt11 Memory Modes

9/27/ :23:30 PMweek06-3.ppt12 Addressing The processors use byte addressing Intel processors support segmented addressing – Each address is specified by a segment register and byte address within the segment

9/27/ :23:30 PMweek06-3.ppt13

9/27/ :23:31 PMweek06-3.ppt14 Intel Registers

9/27/ :23:31 PMweek06-3.ppt15 Basic Program Execution Registers General purpose registers – There are eight registers (note that they are not quite general purpose as some instructions assume certain registers) Segment registers – They define up to six segment selectors EIP register – Effective instruction pointer EFLAGS – Program status and control register

9/27/ :23:32 PMweek06-3.ppt16 General Purpose and Segment Registers

17 General Purpose Registers EAX — Accumulator for operands and results data EBX — Pointer to data in the DS segment ECX — Counter for string and loop operations EDX — I/O pointer ESI — Pointer to data in the segment pointed to by the DS register; source pointer for string operations EDI — Pointer to data (or destination) in the segment pointed to by the ES register; destination pointer for string operations ESP — Stack pointer (in the SS segment) EBP — Pointer to data on the stack (in the SS segment)

18 Alternative General Purpose Register Names

19 Registers in IA-64

20 Segment Registers

21 Operand Addressing Immediate addressing – Maximum value allowed varies among instructions and it can be 8-bit, 16-bit, or 32-bit Register addressing – Register addressing depends on the mode (IA-32 or IA-64)

22 Register Addressing

23 Memory Operand Memory operand is specified by a segment and offset

24 Offset 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.

25 Effective Address

26 Effective Address Common combinations – Displacement – Base – Base + displacement – (Index * scale) + displacement – Base + index + displacement – Base + (Index * scale) + displacement

27 Addressing Mode Encoding

28 Fundamental Data Types

29 Example

30 Pointer Data Types Near pointer Far pointer

Bit SIMD Data Types

32 BCD Integers Intel also supports BCD integers, where each digit (0-9) is represented by 4 bits

33 Floating Point Numbers

34 General Purpose Instructions Data transfer instructions

35 Data Transfer Instructions

36 Data Transfer Instructions

37 Binary Arithmetic Instructions

38 Decimal Arithmetic Instructions

39 Logical Instructions

40 Shift and Rotate Instructions

41 Bit and Byte Instructions

42 Bit and Byte Instructions

43 Control Transfer Instructions

44

45 String Instructions

46 I/O Instructions These instructions move data between the processor’s I/O ports and a register or memory

47 Enter and Leave Instructions These instructions provide machine-language support for procedure calls in block structured languages

48 Segment Register Instructions The segment register instructions allow far pointers (segment addresses) to be loaded into the segment registers

49 Procedure Call Types The processor supports procedure calls in the following two different ways: – CALL and RET instructions. – ENTER and LEAVE instructions, in conjunction with the CALL and RET instructions

50 Stack

51 Calling Procedures Using CALL and RET Near call (within the current code segment) Near return

52 Far Call and Far Return Far call Far return

53 Stack During Call and Return

54 Parameter Passing Passing parameters through the general-purpose registers – Can pass up to six parameters by copying the parameters to the general-purpose registers Passing parameters on the stack – Stack can be used to pass a large number of parameters and also return a large number of values Passing parameters in an argument list – Place the parameters in an argument list – A pointer to the argument list can then be passed to the called procedure

55 Saving Procedure State Information The processor does not save general purpose registers – A calling procedure should explicitly save the values in any of the general-purpose registers that it will need when it resumes execution after a return – One can use PUSHA and POPA to save and restore all the general purpose registers (except ESP)

56 Calls to Other Privilege Levels

57 Stack For Calling and Called Procedure

58 Procedure Calls For Block-structured Languages ENTER and LEAVE instructions automatically create and release, respectively, stack frames for called procedures – The ENTER instruction creates a stack frame compatible with the scope rules typically used in block-structured languages – The LEAVE instruction, which does not have any operands, reverses the action of the previous ENTER instruction

59 ENTER Instruction

60 IA-32 and IA-64 Instruction Format

61 Examples of Instruction Formats

62 ADD Instructions

63 ADD Instructions

64 Add Instruction Description

65 SCAS/SCASB/SCASW/SCASD—Scan String

10/7/2007 9:37:48 PMweek07-1.ppt66 SIMD in IA-32 and IA-64 To improve performance, Intel adopted SIMD (single instruction multiple data) instructions – MMX technology (Pentium II processor family) – SSE

10/7/2007 9:37:59 PMweek07-1.ppt67 MMX MMX introduced – Eight new 64-bit data registers, called MMX registers – Three new packed data types: 64-bit packed byte integers (signed and unsigned) 64-bit packed word integers (signed and unsigned) 64-bit packed double word integers (signed and unsigned) – Instructions that support the new data types

10/7/2007 9:38:00 PMweek07-1.ppt68 MMX Packed integer types allow operations to be applied on multiple integers

10/7/2007 9:38:04 PMweek07-1.ppt69 SSE SSE introduced eight 128-bit data registers (called XMM registers) – In 64-bit modes, they are available as bit registers – The 128-bit packed single-precision floating-point data type, which allows four single-precision operations to be performed simultaneously They can be used in parallel with MMX registers

10/7/2007 9:38:04 PMweek07-1.ppt70 SSE Execution Environment

10/7/2007 9:38:05 PMweek07-1.ppt71 XMM Registers In certain modes, additional eight 64 bit registers are also available (XMM8 - XMM15)

10/7/2007 9:38:05 PMweek07-1.ppt72 SSE Data Type SSE extensions introduced one new data type – 128-Bit Packed Single-Precision Floating-Point Data Type – SSE 2 introduced five data types

10/7/2007 9:38:07 PMweek07-1.ppt73 P acked and Scalar Double-Precision Floating-Point Operations

10/7/2007 9:38:10 PMweek07-1.ppt74 SSE Instructions SSE Data Transfer Instructions

10/7/2007 9:38:11 PMweek07-1.ppt75 SSE Packed Arithmetic Instructions

10/7/2007 9:38:12 PMweek07-1.ppt76 SSE Packed Arithmetic Instructions

10/7/2007 9:38:12 PMweek07-1.ppt77 SSE Comparison, Logical, and Shuffle Instructions

10/7/2007 9:38:14 PMweek07-1.ppt78 SSE2 Instructions

10/7/2007 9:38:14 PMweek07-1.ppt79 SSE2 128-Bit SIMD Integer Instructions

10/7/2007 9:38:16 PMweek07-1.ppt80 Horizontal Addition/Subtraction

10/7/2007 9:38:17 PMweek07-1.ppt81 Horizontal Data Movements

10/7/2007 9:38:17 PMweek07-1.ppt82 Conversion Between Different Types

10/7/2007 9:38:18 PMweek07-1.ppt83 Using MMX/SSE Instructions in C/C++ Programs Data types for MMX and SSE instructions – These types are defined in C/C++ /usr/lib/gcc/i386-redhat-linux/3.4.3/include/mmintrin.h /usr/lib/gcc/i386-redhat-linux/3.4.3/include/pmmintrin.h /usr/lib/gcc/i386-redhat-linux/3.4.3/include/emmintrin.h

10/7/2007 9:38:29 PMweek07-1.ppt84 Built-in Functions Built-in functions are C-style functional interfaces to MMX/SSE instructions See

10/7/ :01:41 PMweek07-1.ppt85 Intel MMX/SSE Intrinsics Intrinsics are C/C++ functions and procedures for MMX/SSE instructions – With instrinsics, one can program using these instructions indirectly using the provided intrinsics – In general, there is a one-to-one correspondence between MMX/SSE instructions and intrinsics

10/7/ :01:43 PMweek07-1.ppt86 GCC Inline Assembly GCC inline assembly allows us to insert inline functions written in assembly – GCC provides the utility to specify input and output operands as C variables – Basic inline – Extended inline assembly

10/7/ :03:01 PMweek07-1.ppt87 GCC Inline Assembly Some examples

10/7/ :03:04 PMweek07-1.ppt88 GCC Inline Assembly

10/7/ :03:06 PMweek07-1.ppt89 GCC Inline Assembly