Programming Technologies, MIPT, April 7th, 2012 Introduction to Binary Translation Technology Roman Sokolov SMWare

Slides:



Advertisements
Similar presentations
JUST-IN-TIME COMPILATION
Advertisements

An Overview Of Virtual Machine Architectures Ross Rosemark.
Virtualization Technology
Software & Services Group PinPlay: A Framework for Deterministic Replay and Reproducible Analysis of Parallel Programs Harish Patil, Cristiano Pereira,
Secure In-VM Monitoring Using Hardware Virtualization Monirul Sharif, Wenke Lee, Weidong Cui, and Andrea Lanzi Presented by Tyler Bletsch.
Comprehensive Kernel Instrumentation via Dynamic Binary Translation Peter Feiner, Angela Demke Brown, Ashvin Goel University of Toronto Presenter: Chuong.
Dec 5, 2007University of Virginia1 Efficient Dynamic Tainting using Multiple Cores Yan Huang University of Virginia Dec
E Virtual Machines Lecture 3 Memory Virtualization
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
G Robert Grimm New York University Disco.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
OS Spring’03 Introduction Operating Systems Spring 2003.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Virtual Machine Monitors CSE451 Andrew Whitaker. Hardware Virtualization Running multiple operating systems on a single physical machine Examples:  VMWare,
Xen and the Art of Virtualization. Introduction  Challenges to build virtual machines Performance isolation  Scheduling priority  Memory demand  Network.
虛擬化技術 Virtualization and Virtual Machines
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Fast Dynamic Binary Translation for the Kernel Piyus Kedia and Sorav Bansal IIT Delhi.
Tanenbaum 8.3 See references
Previous Next 06/18/2000Shanghai Jiaotong Univ. Computer Science & Engineering Dept. C+J Software Architecture Shanghai Jiaotong University Author: Lu,
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
Virtual Machines: Versatile Platforms for Systems and Processes
Operating System Support for Virtual Machines Samuel T. King, George W. Dunlap,Peter M.Chen Presented By, Rajesh 1 References [1] Virtual Machines: Supporting.
Virtualization: Not Just For Servers Hollis Blanchard PowerPC kernel hacker.
Introduction 1-1 Introduction to Virtual Machines From “Virtual Machines” Smith and Nair Chapter 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CS533 Concepts of Operating Systems Jonathan Walpole.
System Virtualization 1 Learning Objective: –To understand the implementation choices and details of System Virtualization COMP
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Processes Introduction to Operating Systems: Module 3.
Harmony: A Run-Time for Managing Accelerators Sponsor: LogicBlox Inc. Gregory Diamos and Sudhakar Yalamanchili.
Introduction to virtualization
Operating Systems Security
Transmeta’s New Processor Another way to design CPU By Wu Cheng
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Processes and Virtual Memory
Full and Para Virtualization
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Introduction Why are virtual machines interesting?
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Cloud Computing – UNIT - II. VIRTUALIZATION Virtualization Hiding the reality The mantra of smart computing is to intelligently hide the reality Binary->
Running Commodity Operating Systems on Scalable Multiprocessors Edouard Bugnion, Scott Devine and Mendel Rosenblum Presentation by Mark Smith.
Embedded Real-Time Systems
CS 695 Topics in Virtualization and Cloud Computing, Autumn 2012 CS 695 Topics in Virtualization and Cloud Computing More Introduction + Processor Virtualization.
Introduction to Operating Systems Concepts
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
Virtualization.
Virtual Machine Monitors
Xen and the Art of Virtualization
Dynamic Compilation Vijay Janapa Reddi
CS161 – Design and Architecture of Computer
Virtual Machines: Versatile Platforms for Systems and Processes
OS Virtualization.
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
CS 105 “Tour of the Black Holes of Computing!”
A Survey on Virtualization Technologies
Lecture Topics: 11/1 General Operating System Concepts Processes
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CS 105 “Tour of the Black Holes of Computing!”
Introduction to Virtual Machines
Lecture 3: Main Memory.
CS 105 “Tour of the Black Holes of Computing!”
Introduction to Virtual Machines
CSE 542: Operating Systems
Chapter 1: Introduction CSS503 Systems Programming
Dynamic Binary Translators and Instrumenters
CS295: Modern Systems Virtualization
Presentation transcript:

Programming Technologies, MIPT, April 7th, 2012 Introduction to Binary Translation Technology Roman Sokolov SMWare

Elbrus Binary Translation Technology for IA-32 Compatibility Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012 Binary translation is a process of conversion of source (guest) architecture executable binary codes into executable codes of target (native) architecture. Motivations: binary compatibility w/o source codes recompilation (new archs enabling – more efficient, less complicated, etc.) dynamic optimization JIT security instrumentation and analysis of binaries virtualization simulation …

Guest Applications Guest BIOS, OS & Libraries GuestApplications App level BT NativeApplications Native BIOS, OS & Libraries OS & Libraries HW Full System BT HW Application-level DBTS Full system DBTS Elbrus Binary Translation Technology for IA-32 Compatibility BT systems classes StaticDynamic Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Elbrus Binary Translation Technology for IA-32 Compatibility x86 native x86 native x86 x86 guest New native applications applications x86 x86 Transmeta’s Approach x86 native x86applications Intel’s Approach Example: How to use MS Windows on x86-incompatible computer Elbrus’s Approach (mode choice at boot time) Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Adaptive dynamic binary translation (1/2) Optimizing region translation Guest binaries Interpretation (and profiling of traces) Non-optimizing trace translation Translations cache: execution and profiling of regions Adaptive retranslation Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive dynamic binary translation (2/2): profile of execution Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) BTS layout Guest Memory Space Space BT System (native) Memory Space  System Code  System Data  Compiler Heap  Code Caches  AddrMap Table BT System (native) Memory Space  System Code  System Data  Compiler Heap  Code Caches  AddrMap Table Code Base Invisible for guest programs Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Guest control transfer (AddrMap+Cache, GRAS, Native linking) Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012 Translations cache Transl. AddrMap (S/W) AddrMap Cache (H/W) Transl. Translate g. brn n. brn found not found Transl. GRAS (H/W) Transl. g. rtn (pop) push on g. call g.rtn (pop) g. call

Adaptive binary translation (1/2) Security Self-modifying code Interrupts and precise exceptions Difference in legacy and host ops semantics Binary Translation Problems Memory mapped I/O devices Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012 Robust performance required!

Adaptive binary translation (1/2) Hardware support FunctionalityPerformance Compatible TLB, MMU, guest memory space support Compatible global registers, FP stack Guest code modification protection (SMC/DMA) Instruction equivalents BTS ROMGuest-to-native address translation cache, Guest return address stack Recovery support Asynchronous interrupts support Memory mapped I/O pages protection H/W thread/core for dynamic opt. MLT, DAM, … Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Optimized code Compensation code code computes & restores context for Current RP Non-optimized code code Set Recovery Point instruction Exception Handler Handler Guest Exception Handler Program execution Speculative instruction bringing exception returns diagnostic value Real exception on the same guest instr. Check instr. causes exception exception Back to Current RP Recovery model Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Binary Translated Code Guest code Translation Physical SpaceBitmap Native VM Space Guest VM Space Physical memory space is represented via a bitmap Bitmap entry represents 4K in physical space Translator tags guest code memory locations in the bitmap Physical memory protection (1/2): translation Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Binary Translated Code Guest code TLB Physical SpaceBitmap Chipset HDD DMA Native VM Space Guest VM Space Exception Writes to the tagged memory locations result in exceptions TLB protects tagged memory locations from CPU memory writes Chipset protects tagged memory locations from DMA memory writes Bitmap entries are cached internally in hardware Exact memory address reported for each violation attempted Physical memory protection (2/2): execution Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Dynamic optimization vs. Latency Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Background optimization Approach Optimizing translation is separated in a different thread (optimization thread), that can run simultaneously with the main execution thread. Hot regions are detected by the execution thread and are then scheduled to be optimized in background by the optimization thread. Dual(many)-core Optimization is moved onto underutilized processor core Benefits Improves application’s execution latency Removes overhead from the application’s execution Enables the application of more aggressive optimizations. Single-core Optimization is interleaved with execution Benefits Improves application’s execution latency Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Single-core background optimization (1/3) Time-sliced optimization Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Dual-core background optimization (1/2) Offloaded optimization Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Future works Guest architecture multiprocessor system emulation Guest Applications Guest BIOS, OS & Libraries Full System BT HW Guest Applications Guest BIOS, OS & Libraries Full System BT Core0: Exec Core1: Opt Full System BT Core0: Exec Core1: Opt Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Dynamic Binary Translation: summary Key paradigm for resolving compatibility/performance tension is speculation, recovery, and adaptive retranslation The devil is in the details: a successful solution must deal with unpleasant architectural details Precise exceptions Interrupts and DMA Memory-mapped I/O Self-modifying code All techniques developed for real performance problems Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Adaptive binary translation (1/2) Dynamic Binary Translation: summary Proc Enables transparent transition to new architectures Allows to transparently improve underlying hardware Optimization of legacy codes with no sources available Provides run-time optimization opportunities (as compared to static native compilers) Hardware bugs masking Cons Translation overhead degrades runtime performance BTS consumes RAM to store internal structures and translated codes High-performance BT requires hardware support Full-system BTS are hard to debug Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012

Q&A Further reading: Virtual Machines: Versatile Platforms for Systems and Processes by: Jim Smith, Ravi Nair; Morgan Kaufmann Publishers Introduction to Binary Translation Technology, Programming Technologies, MIPT, April 7th, 2012