The von Neumann Machine

Similar documents
Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

Machine Programming II: Instruc8ons

64-Bit NASM Notes. Invoking 64-Bit NASM

Instruction Set Architecture

Machine-Level Programming II: Arithmetic & Control

Machine-Level Programming I: Basics

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

CS:APP Chapter 4 Computer Architecture Instruction Set Architecture. CS:APP2e

Assembly Language: Function Calls" Jennifer Rexford!

Intel 8086 architecture

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

Andreas Herrmann. AMD Operating System Research Center

x64 Cheat Sheet Fall 2015

CS61: Systems Programing and Machine Organization

Computer Organization and Architecture

Faculty of Engineering Student Number:

Generations of the computer. processors.

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

5. Calling conventions for different C++ compilers and operating systems

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Computer Architectures

LSN 2 Computer Processors

Lecture 27 C and Assembly

Administration. Instruction scheduling. Modern processors. Examples. Simplified architecture model. CS 412 Introduction to Compilers

Language Processing Systems

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Return-oriented programming without returns

OS Virtualization Frank Hofmann

Central Processing Unit (CPU)

CHAPTER 6 TASK MANAGEMENT

In the Beginning The first ISA appears on the IBM System 360 In the good old days

A Tiny Guide to Programming in 32-bit x86 Assembly Language


CPU Organization and Assembly Language

Pentium vs. Power PC Computer Architecture and PCI Bus Interface

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

The IA-32 processor architecture

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

High-speed image processing algorithms using MMX hardware

MICROPROCESSOR AND MICROCOMPUTER BASICS

Chapter 4 Processor Architecture

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Computer Architectures

CSC 2405: Computer Systems II

PC Assembly Language. Paul A. Carter

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

Computer Organization and Components

Performance monitoring with Intel Architecture

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Processor Architectures

CS 152 Computer Architecture and Engineering. Lecture 22: Virtual Machines

Programming from the Ground Up

Microprocessor and Microcontroller Architecture

Copyright 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

CS:APP Chapter 4 Computer Architecture Instruction Set Architecture

Systems Design & Programming Data Movement Instructions. Intel Assembly

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Chapter 1. Bootstrap. Hardware

Abysssec Research. 1) Advisory information. 2) Vulnerable version

Introduction. Compiler Design CSE 504. Overview. Programming problems are easier to solve in high-level languages

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

Programming from the Ground Up

For a 64-bit system. I - Presentation Of The Shellcode

Chapter 2 Logic Gates and Introduction to Computer Architecture

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Computer Architecture. Secure communication and encryption.

X86-64 Architecture Guide

Buffer Overflows. Security 2011

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer

Automated Repair of Binary and Assembly Programs for Cooperating Embedded Devices

Intel Assembler. Project administration. Non-standard project. Project administration: Repository

Programming Languages

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

Computer Architecture Basics

Multimedia Systems Hardware & Software THETOPPERSWAY.COM

ELE 356 Computer Engineering II. Section 1 Foundations Class 6 Architecture

TODAY, FEW PROGRAMMERS USE ASSEMBLY LANGUAGE. Higher-level languages such

Outline. Lecture 3. Basics. Logical vs. physical memory physical memory. x86 byte ordering

Overview. CPU Manufacturers. Current Intel and AMD Offerings

Computer Systems Design and Architecture by V. Heuring and H. Jordan

Virtualization Technologies

Instruction Set Architecture (ISA)

Instruction Set Design

Intel Vanderpool Technology for IA-32 Processors (VT-x) Preliminary Specification

Instruction Set Architecture

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

An introduction to the Return Oriented Programming. Why and How

x86-64 Machine-Level Programming

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

IA-64 Application Developer s Architecture Guide

Secure Virtual Machine Architecture Reference Manual

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

Computer Organization and Assembly Language

Transcription:

The von Neumann Machine 1 1945: John von Neumann Wrote a report on the stored program concept, known as the First Draft of a Report on EDVAC also Alan Turing Konrad Zuse Eckert & Mauchly The basic structure proposed in the draft became known as the von Neumann machine (or model). a memory, containing instructions and data a processing unit, for performing arithmetic and logical operations a control unit, for interpreting instructions

The von Neumann Machine Abstraction of von Neumann Architecture stores both program instructions and data 2 decodes current instruction, manages processing unit to carry out instruction program counter: points to the next instruction to be fetched instruction register: stores current instruction

Intel x86 History 3 Totally dominate laptop/desktop/server market Evolutionary design Backwards compatible up until 8086, introduced in 1978 Added more features as time goes on Complex instruction set computer (CISC) Many different instructions with many different formats But, only small subset encountered with Linux programs Hard to match performance of Reduced Instruction Set Computers (RISC) But, Intel has done just that! In terms of speed. Less so for low power.

Intel x86 History 4 Name Date Transistors MHz 8086 1978 29K 5-10 First 16-bit processor. Basis for IBM PC & DOS 1MB address space 80386 1985 275K 16-33 First 32 bit processor, referred to as IA32 Added flat addressing Capable of running Unix 32-bit Linux/gcc uses no instructions introduced in later models Pentium 4F 2004 125M 2800-3800 First 64-bit processor, referred to as x86-64 Core i7 2008 731M 2667-3333 Our shark machines

Intel x86 History 5 Architectures Processors X86-16 8086 X86-32/IA32 MMX SSE SSE2 SSE3 X86-64 / EM64t SSE4 286 386 486 Pentium Pentium MMX Pentium III Pentium 4 Pentium 4E Pentium 4F Core 2 Duo Core i7 time

Intel x86 History Intel Attempted Radical Shift from IA32 to IA64 Totally different architecture (Itanium) Executes IA32 code only as legacy Performance disappointing 6 AMD Stepped in with Evolutionary Solution x86-64 (now called AMD64 ) Intel Felt Obligated to Focus on IA64 Hard to admit mistake or that AMD's approach is better 2004: Intel Announces EM64T extension to IA32 Extended Memory 64-bit Technology Almost identical to x86-64! All but low-end x86 processors support x86-64 But, lots of code still runs in 32-bit mode

von Neumann View of x86 7 CPU PC Registers Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Stack

High-level x86 CPU 8 Programmer-Visible State PC: Program counter Address of next instruction Called EIP (IA32) or RIP (x86-64) Register file Heavily used program data Condition codes Store status information about most recent arithmetic operation Used for conditional branching CPU PC Registers Condition Codes

IA32 Integer Registers 9 CPU PC Registers 16-bit virtual registers (backwards compatibility) Condition Codes %eax %ax %ah %al general purpose %ecx %edx %ebx %esi %cx %dx %bx %si %ch %dh %bh %cl %dl %bl %edi %di %esp %sp %ebp %bp

High-level x86 Memory 10 Memory Byte addressable array Code, user data, (some) OS data Includes stack used to support procedures Memory Object Code Program Data OS Data Stack

Programming the Machine // C code... int imax(int first, int second) { 11 } if ( first >= second ) return first; return second; But the hardware only "understands" binary representations

Programming the Machine int imax(int first, int second) { 12 } if ( first >= second ) return first; return second; gcc -O0 -c -m32 -std=c99imax.c 457f464c010100010000000000000000 00010003000100000000000000000000 00bc0000000000000034000000000028 0009000689558be50845453b7c0c8b05 084503eb458b5d0c00c3000047004343 203a55287562746e2f75694c616e6f72 3420352e322e382d62756e7575742934... But who wants to program in binary?

Programming the Machine int imax(int first, int second) { 13 } if ( first >= second ) return first; return second;... imax: pushl movl %ebp %esp, %ebp Solution: translate high-level language code into intermediate-level code which is more human-friendly, then translate that "assembly" code into the machine's langauge..l2:.l3:... movl 8(%ebp), %eax cmpl 12(%ebp), %eax jl.l2 movl 8(%ebp), %eax jmp.l3 movl 12(%ebp), %eax popl %ebp ret

Explanation: moving data 14 Source Dest Src,Dest C Analog Imm Reg Mem movl $0x4,%eax tmp = 0x4; movl $-147,(%eax) *p = -147; movl Reg Reg Mem movl %eax,%edx movl %eax,(%edx) tmp2 = tmp1; *p = tmp; Mem Reg movl (%eax),%edx tmp = *p;

x86-64 Integer Registers 15 %rax %eax %r8 %r8d %rbx %ebx %r9 %r9d %rcx %ecx %r10 %r10d %rdx %edx %r11 %r11d %rsi %esi %r12 %r12d %rdi %edi %r13 %r13d %rsp %esp %r14 %r14d %rbp %ebp %r15 %r15d Extend existing registers. Add 8 new ones. Make %ebp/%rbp general purpose

x86-64 Example int imax(int first, int second) { 16 } if ( first >= second ) return first; return second;... movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jl.l2 movl -4(%rbp), %eax jmp.l3.l2: movl -8(%rbp), %eax.l3:...