Aaron Miller David Cohen Spring 2011

Slides:



Advertisements
Similar presentations
Fabián E. Bustamante, Spring 2007 Machine-Level Programming II: Control Flow Today Condition codes Control flow structures Next time Procedures.
Advertisements

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
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.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
6.828: PC hardware and x86 Frans Kaashoek
Y86 Processor State Program Registers
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
Recitation 2: Outline Assembly programming Using gdb L2 practice stuff Minglong Shao Office hours: Thursdays 5-6PM Wean Hall.
1 ICS 51 Introductory Computer Organization Fall 2009.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Introduction to Assembly II Abed Asi Extended System Programming Laboratory (ESPL) CS BGU Fall 2013/2014.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
Computer Architecture and Assembly Language
Arrays. Outline 1.(Introduction) Arrays An array is a contiguous block of list of data in memory. Each element of the list must be the same type and use.
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
1 Assembly Language: Function Calls Jennifer Rexford.
Overview of Back-end for CComp Zhaopeng Li Software Security Lab. June 8, 2009.
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.
Precept 7: Introduction to IA-32 Assembly Language Programming
CPSC 121: Models of Computation
Recitation 3: Procedures and the Stack
A job ad at a game programming company
Stack Operations Dr. Hadi AL Saadi.
CS 177 Computer Security Lecture 9
Reading Condition Codes (Cont.)
Machine-Level Programming 2 Control Flow
Instruction Set Architecture
Computer Architecture and Assembly Language
Assembly Language Programming IV: shift, struct, recursion
Assembly language.
Credits and Disclaimers
C function call conventions and the stack
Conditional Branch Example
Homework Reading Labs PAL, pp
Exploiting & Defense Day 2 Recap
Introduction to Compilers Tim Teitelbaum
Computer Architecture
Basic Microprocessor Architecture
Assembly IA-32.
Assembly Language Programming Part 2
Recitation 2 – 2/4/01 Outline Machine Model
Homework Reading Continue work on mp1
Chapter 3 Machine-Level Representation of Programs
Machine-Level Representation of Programs II
Computer Architecture adapted by Jason Fritts then by David Ferry
Y86 Processor State Program Registers
Machine-Level Programming 4 Procedures
Assembly Language: IA-32 Instructions
Machine-Level Programming 2 Control Flow
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
Fundamentals of Computer Organisation & Architecture
Machine-Level Programming 2 Control Flow
Machine-Level Representation of Programs III
Machine-Level Programming 2 Control Flow
Homework Reading Machine Projects Labs PAL, pp
The Microprocessor & Its Architecture
Computer Architecture CST 250
Chapter 3 Machine-Level Representation of Programs
X86 Assembly Review.
CSC 497/583 Advanced Topics in Computer Security
Credits and Disclaimers
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Presentation transcript:

Aaron Miller David Cohen Spring 2011 CSE 351 Section 3: The x86 ISA Aaron Miller David Cohen Spring 2011

Section Outline x86 C → x86 Exercise Debugging w/ GDB HW 1 Questions

x86 x86 is a family of ISAs based on the architecture of the Intel 8086 CPU Provides abstractions for programmers Instructions CPU register access Accumulator styled ISA addl %eax, %edx # EDX += EAX

x86 - Registers 8 addressable registers eax – gen. purpose register also used for function return values ebx – gen. purpose register also used to hold array/string base address ecx – gen. purpose register also used for counting edx – gen. purpose register also used for array data edi – gen. purpose register also used for src array/string index esi – gen. Purpose register also used for dest array/string index esp – contains stack pointer... more later ebp – contains frame pointer... more later Inaccessible registers, managed via instructions eip – instruction pointer flags – set for performing value comparison cs, ds, es, ss – Segment registers for memory addressing

x86 Basics – Register Structure Can access different bit ranges of the registers Use special names Ex: least significant byte of eax is “al” Details: http://en.wikipedia.org/wiki/X86#Structure

X86 Basics - Instructions Arithmetic add, sub, mul, idiv Logical / Bitwise and, or, xor, neg, sal/shl, sar/shr Control jmp, je, jne, jg, jl, jle, jge Use after test or cmp instruction test – bitwise AND which sets flags cmp – subtraction which sets flags ret – used to return from a function Other Stack insns: push, pop Data manipulating: mov, enter, leave

X86 Basics – Data Sizes Instructions take a data size specifier as their last character L – operate on 4 bytes Ex: addl, pushl, movl, cmpl B – operate on least significant byte Ex: movb, cmpb, testb Need to be combined with appropriately named operands! Ex: addl %edx, %eax → valid! cmpb %eax, %cl → invalid!

C → x86 Exercise int strcmp(char* a, char* b) { while( *a && *b ) { Implement body of strcmp(), a standard C function for comparing two ASCII-encoded strings in x86 Work in groups of 2 - 4 C Implementation: int strcmp(char* a, char* b) { while( *a && *b ) { if( *a != *b ) break; a++; b++; } return *a - *b;