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 -80386 (1985), 80486 (1989), -Pentium-line.

Slides:



Advertisements
Similar presentations
1 Real-World Instruction Set Architectures Focus on IA-32 Course website:
Advertisements

Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Computer Organization and Assembly Languages Yung-Yu Chuang
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Lecture 6 Machine Code: How the CPU is programmed.
Chapter 1 Background System Software Chih-Shun Hsu
IA-32 Processor Architecture
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
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.
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.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
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.
6.828: PC hardware and x86 Frans Kaashoek
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
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 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.
Today’s topics Procedures Procedures Passing values to/from procedures Passing values to/from procedures Saving registers Saving registers Documenting.
1 ICS 51 Introductory Computer Organization Fall 2009.
Sahar Mosleh California State University San MarcosPage 1 Stack operations, Applications and defining procedures.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
26-Nov-15 (1) CSC Computer Organization Lecture 6: Pentium IA-32.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Introduction to Assembly II Abed Asi Extended System Programming Laboratory (ESPL) CS BGU Fall 2013/2014.
Compiler Construction Code Generation Activation Records
X86 Assembly Language We will be using the nasm assembler (other assemblers: MASM, as, gas)
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
1 Assembly Language: Function Calls Jennifer Rexford.
CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Computer Organization 1
Carnegie Mellon Midterm Review : Introduction to Computer Systems October 15, 2012 Instructor:
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
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.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Chapter Overview General Concepts IA-32 Processor Architecture
A job ad at a game programming company
Stack Operations Dr. Hadi AL Saadi.
Assembly language.
IA32 Processors Evolutionary Design
Aaron Miller David Cohen Spring 2011
Computer skills CPU Jakub Yaghob.
Chapter 4 Data Movement Instructions
Basic Microprocessor Architecture
Assembly IA-32.
# include < stdio.h > v oid main(void) { long NUM1[5]; long SUM; long N; NUM1[0] = 17; NUM1[1] = 3; NUM1[2] =  51; NUM1[3] = 242; NUM1[4] = 113; SUM =
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
CS 301 Fall 2002 Computer Organization
MIPS Procedure Calls CSE 378 – Section 3.
The Microprocessor & Its Architecture
Week 2: Buffer Overflow Part 1.
Computer Architecture CST 250
X86 Assembly Review.
Low-Level Thread Dispatching on the x86
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.
CSC 497/583 Advanced Topics in Computer Security
Computer Architecture and System Programming Laboratory
Presentation transcript:

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 ( ) l Each processor has the same architecture, but different organization -same instruction set -different performance levels l 32-bit memory addresses and variable length instructions l Very large instruction set (not really RISC)

In1211/04-PDS 3 TU-Delft

In1211/04-PDS 4 TU-Delft Other Example: PowerPC Floating-point unit Integer unit Instruction unit instructions Cache main memory

In1211/04-PDS 5 TU-Delft Floorplan PowerPC

In1211/04-PDS 6 TU-Delft FPU Data Cache Instr. Cache Registers MMU Load/Store Unit

In1211/04-PDS 7 TU-Delft IA register structure FP0 FP7 floating - point registers R0 R7 general- purpose registers

In1211/04-PDS 8 TU-Delft Special registers Code Segment CS Stack Segment SS DS ES FS GS Data Segments

In1211/04-PDS 9 TU-Delft Status Register OFIF Status Register CFTFSFZF 6789 CFCarry ZFZero SFSign IOPLI/O privilege level OFOverflow IFInterrupt enable IOPL

In1211/04-PDS 10 TU-Delft Addressable data units byte 3byte 0 310Bit Byte Doubleword 0

In1211/04-PDS 11 TU-Delft Memory l Memory is byte addressable l Doublewords can start at any byte location l Data Operands are 8 or 32 bits wide l Mode is little-endian scheme (cf big-endian PowerPC)

In1211/04-PDS 12 TU-Delft Register Naming R0EAX R1ECX R2EDX R3EBX R4 ESP R5 EBP R6 ESI R7 EDI EIP EFLAGS Data registers Pointer registers Index registers Instruction Pointer Status Register

In1211/04-PDS 13 TU-Delft Instructions l Variable length instructions 1-12 bytes l Five type of instructions -Copy instructions (MOV) -Arithmetic and logic instructions -Flow control -Processor control instructions -I/O instructions Format: INSTR Rdst,Rsrc

In1211/04-PDS 14 TU-Delft Instruction Format OpcodeAddressingDisplacementImmediate 1 or 2 bytes 1 or 4 bytes

In1211/04-PDS 15 TU-Delft Addressing modes l Many addressing modes: -Immediatevalue -DirectM(value) -Register[reg] -Register IndirectM([reg]) -Base with displacementM([reg]) +Disp -Index with displacementM([reg]  S +Disp) -Base with indexM([reg]+[reg]  S) -Base with index and M([reg]+[reg]  S+Disp) displacement S=1,2,4 or 8Disp= 8 or 32-bit signed number

In1211/04-PDS 16 TU-Delft Immediate and Direct l Immediate MOV EAX, 25 [EAX]  #25 MOV EAX, 3FA00H [EAX]  # 3FA00H l Direct MOV EAX, loc [EAX]  M(loc) or MOV EAX, [loc] [EAX]  M(loc)

In1211/04-PDS 17 TU-Delft Register indirect l Register MOV EBX,OFFSET loc [EBX]  #loc or LEA EBX,loc [EBX]  #loc l Register indirect MOV EAX,[EBX] [EAX]  M(EBX)

In1211/04-PDS 18 TU-Delft Base with Index and Displacement MOV EAX,[EBP+ESI*4+200] EAX  M([EBP] + [ESI]*4 + #200) Operand EBP ESI

In1211/04-PDS 19 TU-Delft Arithmetic instructions l May have one or two operands ADD dst,scr meaning [dst]  [dst] + [src]

In1211/04-PDS 20 TU-Delft Summation example LEAEBX, NUM1[EBX]  #NUM1 MOVECX, N[EXC]  M(N) MOVEAX, 0[EAX]  #0 MOVEDI, 0[EDI]  #0 L:ADDEAX, [EBX+EDI*4]Add next number to EAX INCEDI[EDI]  [EDI] +1 DECECX[ECX]  [ECX] -1 JGLBranch if [ECX]>0 MOVSUM, EAXM(SUM)  [EAX]

In1211/04-PDS 21 TU-Delft Flow control l Two basic branch instructions: l JMP[loc]Branch unconditionally l JG, JZ, JS, etc Branch if condition is satisfied

In1211/04-PDS 22 TU-Delft Compare l Used to compare values and leave register contents unchanged CMPdst, src[dst] - [src]

In1211/04-PDS 23 TU-Delft Sorting example int[] listarray = new list[n]; int temp; for(j=n-1, j>0, j--){ for(k=j-1, k>=0, k--){ if(list[j] > list[k]) { temp = list[k]; list[k] = list[j]; list[j] = temp; }

In1211/04-PDS 24 TU-Delft Assembler code LEAEAX, list[EAX]  #list MOVEDI, N[EDI]  n DECEDI [EDI]  n-1 init(j) outer:MOVECX, EDI[ECX]  j DECECX [ECX]  j-1 init (k) MOVDL, [EAX+EDI]load list(j) into DL inner:CMP[EAX+ECX], DLcompare list(k) to list(j) JLEnextif list(j) >= list(k) XCNG[EAX+ECX], DLswap MOV[EAX+ECX], DL new list(j) in DL next:DECECXdecrement k JGEinnerrepeat or terminate DECEDIdecrement j JGEouterrepeat or terminate

In1211/04-PDS 25 TU-Delft Question l Why is this assembler program an incorrect translation of the Java program?

In1211/04-PDS 26 TU-Delft Subroutines CALL sub [EIP]  #sub l Return address is saved in on stack (ESP register) Return is RET [EIP]  [EDI]

In1211/04-PDS 27 TU-Delft Stack instructions l ESP register is used as stack pointer PUSH src [ESP]  [ESP] - #4 M([ESP])  [src] POP dst [dst]  M([ESP]) [ESP]  [ESP] + #4 PUSHAD (POPAD): push (pop) all 8 registers on (from) stack

In1211/04-PDS 28 TU-Delft Stack frames.... PUSH NParameter n on stack 2000CALLSub1Call subroutine at EDI EPI10052 Sub1 starts at address 2400 Stack Pointer Stack

In1211/04-PDS 29 TU-Delft Subroutine Sub1 Sub1:PUSHEDASave EDA PUSHEDBSave EDB MOVEDA, [EDI + 12]n to EDA DECEDA.... PUSHEDALoad n-1 on stack L:CALLSub2Call subroutine POPNPut result in M(N) POPEDBRestore EDA POPEDARestore EDB RETreturn

In1211/04-PDS 30 TU-Delft Stack frame in Sub1 EDB EDA Return Address n ? EDI EIP Stack frame at arrow previous slide 10036

In1211/04-PDS 31 TU-Delft Question l What is the value op EIP?

In1211/04-PDS 32 TU-Delft Subroutine Sub1 2400PUSHEDASave EDA PUSHEDBSave EDB MOVEDA, [EDI + 12]n to EDA DECEDA.... PUSHEDALoad n-1 on stack L:CALLSub2Call subroutine POPNPut result in M(N) POPEDBRestore EDA POPEDARestore EDB RETreturn

In1211/04-PDS 33 TU-Delft Stack frame in Sub1 Stack frame at arrow previous slide [EDB] [EDA] Return Address n ? EIP n-1 EDA EIP

In1211/04-PDS 34 TU-Delft Subroutine Sub1 2400PUSHEDASave EDA PUSHEDBSave EDB MOVEDA, [EDI + 12]n to EDA DECEDA.... PUSHEDALoad n-1 on stack L:CALLSub2Call subroutine POPNPut result in M(N) POPEDBRestore EDA POPEDARestore EDB RETreturn

In1211/04-PDS 35 TU-Delft Stack frame in Sub1 Stack frame at arrow previous slide n-1 [EDB] [EDA] Return Address n ? EIP n-1 EDA EIP

In1211/04-PDS 36 TU-Delft Subroutine Sub2 Sub2:MOVEDA, [EDI+4] DECEDA MOV[EDI+4], EDA RET

In1211/04-PDS 37 TU-Delft Stack frame in Sub2 Stack frame at arrow previous slide Return Address n-1 [EDB] [EDA] Return Address n ? EIP n-2 EDA EIP

In1211/04-PDS 38 TU-Delft Subroutine Sub2 Sub2:POPEDA DECEDA PUSHEDA RETreturn Sub2:MOVEDA, [EDI+4] DECEDA MOV[EDI+4], EDA RET

In1211/04-PDS 39 TU-Delft Stack frame in Sub2 Stack frame at arrow previous slide Return Address n-2 [EDB] [EDA] Return Address n ? EIP n-2 EDA EIP