Virtual 8086 Mode  The 80386 supports execution of one or more 8086, 8088, 80186, or 80188 programs in an 80386 protected-mode environment.  An 8086.

Slides:



Advertisements
Similar presentations
Memory Management Unit
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Memory Management and Protection Part 3:Virtual memory, mode switching,
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
FEATURES OF 80386: Two versions of are commonly available: 1) 80386DX
Unit 4 Chapter-1 Multitasking. The Task State Segment.
16.317: Microprocessor System Design I
Intel MP.
Microprocessors system architectures – IA32 real and virtual-8086 mode Jakub Yaghob.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
Memory Management (II)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
OS Spring’03 Introduction Operating Systems Spring 2003.
Introduction to Interrupts
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 15: Protected mode intro.
8086 emulation Using Virtual-8086 mode to execute real-mode procedures in a protected-mode environment.
UNIT 2 Memory Management Unit and Segment Description and Paging
Intel IA32 OS Support -Refresh
Intel
Interrupts  Interrupt is a process where an external device can get the attention of the microprocessor.  The process starts from the I/O device  The.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
80386DX.
Intel MP (32-bit microprocessor) Designed to overcome the limits of its predecessor while maintaining the software compatibility with the.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Microprocessor system architectures – IA32 segmentation Jakub Yaghob.
The Pentium Processor.
Multitasking Mr. Mahendra B. Salunke Asst. Prof. Dept. of Computer Engg., STES SITS, Narhe, Pune-41 STES Sinhgad Institute of Tech. & Science Dept. of.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
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.
System Address Registers/Memory Management Registers Four memory management registers are used to specify the locations of data structures which control.
80386DX.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 i386 Memory Management Professor Ching-Chi Hsu 1998 年 4 月.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
EFLAG Register of The The only new flag bit is the AC alignment check, used to indicate that the microprocessor has accessed a word at an odd.
Microprocessor system architectures – IA32 tasks Jakub Yaghob.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Segment Descriptor Segments are areas of memory defined by a programmer and can be a code, data or stack segment. In segments need not be all the.
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.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
1 Microprocessors CSE Protected Mode Memory Addressing Remember using real mode addressing we were previously able to address 1M Byte of memory.
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
Information Security - 2. Other Registers EFLAGS – 32 Bit Register CFPFAFZFSFTFIFDFOFIO PL IO PL NTRFVM Bits 1,3,5,15,22-31 are RESERVED. 18: AC, 19:VIF,
Microprocessor system architectures – IA32 security
Information Security - 2. Task Switching Every process has an associated Task State Segment, whose starting point is stored in the Task register. A task.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
Microprocessor Architecture
Virtualization D. J. Foreman 2009.
32- bit Microprocessor-Intel 80386
Protection in Virtual Mode
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Descriptor Table & Register
MICROPROCESSOR BASED SYSTEM DESIGN
Microprocessor and Assembly Language
Anton Burtsev February, 2017
Protection of System Resources
Protection UQ: Explain the protection mechanism of X86 Intel family microprocessor(10 Marks)
x86 segmentation, page tables, and interrupts
System Segment Descriptor
Computer-System Architecture
Module 2: Computer-System Structures
CS 301 Fall 2002 Computer Organization
Module 2: Computer-System Structures
First Generation 32–Bit microprocessor
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

Virtual 8086 Mode  The supports execution of one or more 8086, 8088, 80186, or programs in an protected-mode environment.  An 8086 program runs in this environment as part of a V86 (virtual 8086) task.  V86 tasks take advantage of the hardware support of multitasking offered by the protected mode.  Not only can there be multiple V86 tasks, each one executing an 8086 program, but V86 tasks can be multiprogrammed with other tasks.

Virtual 8086 Mode The purpose of a V86 task is to form a "virtual machine" with which to execute an 8086 program. A complete virtual machine consists not only of hardware but also of systems software. The hardware provides a virtual set of registers (via the TSS), a virtual memory space and directly executes all instructions that deal with these registers and with this address space. The software controls the external interfaces of the virtual machine (I/O, interrupts, and exceptions) in a manner consistent with the larger environment in which it executes. Software that helps implement virtual 8086 machines is called a V86 monitor.

Executing 8086 Code  The processor executes in V86 mode when the VM (virtual machine) bit in the EFLAGS register is set. The processor tests this flag under two general conditions: 1. When loading segment registers to know whether to use style address formation. 2. When decoding instructions to determine which instructions are sensitive to IOPL.  Except for these two modifications to its normal operations, the in V86 mode operated much as in protected mode.

Registers and Instructions  The register set available in V86 mode includes all the registers defined for the 8086 plus the new registers introduced by the 80386: FS, GS, debug registers, control registers, and test registers.  New instructions that explicitly operate on the segment registers FS and GS are available, and the new segment- override prefixes can be used to cause instructions to utilize FS and GS for address calculations. Instructions can utilize 32-bit operands through the use of the operand size prefix.

Registers and Instructions  8086 programs running as V86 tasks are able to take advantage of the new applications-oriented instructions added to the architecture by the introduction of the 80186/80188, and 80386:  New instructions introduced by 80186/80188 and  PUSH immediate data  Push all and Pop all (PUSHA and POPA)  Multiply immediate data  Shift and rotate by immediate count  String I/O  ENTER and LEAVE  BOUND

Registers and Instructions  New instructions introduced by  LSS, LFS, LGS instructions  Long-displacement conditional jumps  Single-bit instructions  Bit scan  Double-shift instructions  Byte set on condition  Move with sign/zero extension  Generalized multiply

Linear Address Formation  In V86 mode, the processor does not interpret 8086 selectors by referring to descriptors; instead, it forms linear addresses as an 8086 would. It shifts the selector left by four bits to form a 20-bit base address. The effective address is extended with four high-order zeros and added to the base address to create a linear address

Structure of V86 Task  A V86 task consists partly of the 8086 program to be executed and partly of "native mode" code that serves as the virtual-machine monitor.  The task must be represented by an TSS (not an TSS).  The processor enters V86 mode to execute the 8086 program and returns to protected mode to execute the monitor or other tasks.

Structure of V86 Task  To run successfully in V86 mode, an existing 8086 program needs the following:  A V86 monitor.  Operating-system services.  The V86 monitor is protected-mode code that executes at privilege-level zero. The monitor consists primarily of initialization and exception-handling procedures.  As for any other program, executable-segment descriptors for the monitor must exist in the GDT or in the task's LDT.  The linear addresses above 10FFEFH are available for the V86 monitor, the operating system, and other systems software.  The monitor may also need data-segment descriptors so that it can examine the interrupt vector table or other parts of the 8086 program in the first megabyte of the address space.

Using Paging for V86 Tasks Paging is not necessary for a single V86 task, but paging is useful or necessary for any of the following reasons:  To create multiple V86 tasks. Each task must map the lower megabyte of linear addresses to different physical locations.  To create a virtual address space larger than the physical address space.  To share 8086 OS code or ROM code that is common to several 8086 programs that are executing simultaneously.  To redirect or trap references to memory-mapped I/O devices.

Protection within a V86 Task  Because it does not refer to descriptors while executing 8086 programs, the processor also does not utilize the protection mechanisms offered by descriptors. To protect the systems software that runs in a V86 task from the 8086 program, software designers may follow either of these approaches:  Reserve the first megabyte (plus 64 kilobytes) of each task's linear address space for the 8086 program. An 8086 task cannot generate addresses outside this range.  Use the U/S bit of page-table entries to protect the virtual- machine monitor and other systems software in each virtual 8086 task's space. When the processor is in V86 mode, CPL is 3. Therefore, an 8086 program has only user privileges. If the pages of the virtual-machine monitor have supervisor privilege, they cannot be accessed by the 8086 program.

Entering & Leaving V86 Mode The processor can enter V86 by either of two means: 1. A task switch to an task loads the image of EFLAGS from the new TSS. The TSS of the new task must be an TSS, not an TSS, because the TSS does not store the high- order word of EFLAGS, which contains the VM flag. A value of one in the VM bit of the new EFLAGS indicates that the new task is executing 8086 instructions; therefore, while loading the segment registers from the TSS, the processor forms base addresses as the 8086 would. 2. An IRET from a procedure of an task loads the image of EFLAGS from the stack. A value of one in VM in this case indicates that the procedure to which control is being returned is an 8086 procedure. The CPL at the time the IRET is executed must be zero, else the processor does not change VM.

Entering & Leaving V86 Mode The processor leaves V86 mode when an interrupt or exception occurs. There are two cases: 1. The interrupt or exception causes a task switch. A task switch from a V86 task to any other task loads EFLAGS from the TSS of the new task. If the new TSS is an TSS and the VM bit in the EFLAGS image is zero or if the new TSS is an TSS, then the processor clears the VM bit of EFLAGS, loads the segment registers from the new TSS using style address formation, and begins executing the instructions of the new task according to protected-mode semantics. 2. The interrupt or exception vectors to a privilege-level zero procedure. The processor stores the current setting of EFLAGS on the stack, then clears the VM bit. The interrupt or exception handler, therefore, executes as "native" protected-mode code. If an interrupt or exception vectors to a conforming segment or to a privilege level other than three, the processor causes a general-protection exception; the error code is the selector of the executable segment to which transfer was attempted.

Entering & Leaving V86 Mode

Transaction through Task Switches  A task switch to or from a V86 task may be due to any of three causes: 1. An interrupt that vectors to a task gate. 2. An action of the scheduler of the operating system. 3. An IRET when the NT flag is set. In any of these cases, the processor changes the VM bit in EFLAGS according to the image of EFLAGS in the new TSS. If the new TSS is an TSS, the high-order word of EFLAGS is not in the TSS; the processor clears VM in this case. The processor updates VM prior to loading the segment registers from the images in the new TSS. The new setting of VM determines whether the processor interprets the new segment-register images as 8086 selectors or 80386/80286 selectors.