Virtual 8086 mode

In the 80386 microprocessor and later, virtual 8086 mode (also called virtual real mode, V86-mode, or VM86) allows the execution of real mode applications that are incapable of running directly in protected mode while the processor is running a protected mode operating system. It is a hardware virtualization technique that allowed multiple 8086 processors to be emulated by the 386 chip. It emerged from the painful experiences with the 80286 protected mode, which by itself was not suitable to run concurrent real-mode applications well.[1] John Crawford developed the Virtual Mode bit at the register set, paving the way to this environment.[2]

VM86 mode uses a segmentation scheme identical to that of real mode (for compatibility reasons), which creates 20-bit linear addresses in the same manner as 20-bit physical addresses are created in real mode, but are subject to protected mode's memory paging mechanism.

Overview

The virtual 8086 mode is a mode for a protected-mode task. Consequently, the processor can switch between VM86 and non-VM86 tasks, enabling multitasking legacy (DOS) applications.

To use virtual 8086 mode, an operating system sets up a virtual 8086 mode monitor, which is a program that manages the real-mode program and emulates or filters access to system hardware and software resources. The monitor must run at privilege level 0 and in protected mode. Only the 8086 program runs in VM86 mode and at privilege level 3. When the real-mode program attempts to do things like access certain I/O ports to use hardware devices or access certain regions in its memory space, the CPU traps these events and calls the V86 monitor, which examines what the real mode program is trying to do and either acts as a proxy to interface with the hardware, emulates the intended function the real-mode program was trying to access, or terminates the real-mode program if it is trying to do something that cannot either be allowed or be adequately supported (such as reboot the machine, set a video display into a mode that is not supported by the hardware and is not emulated, or write over operating system code).

The V86 monitor can also deny permission gently by emulating the failure of a requested operation—for example, it can make a disk drive always appear not ready when in fact it has not even checked the drive but simply will not permit the real-mode program to access it. Also, the V86 monitor can do things like map memory pages, intercept calls and interrupts, and preempt the real-mode program, allowing real-mode programs to be multitasked like protected-mode programs. By intercepting the hardware and software I/O of the real-mode program and tracking the state that the V86 program expects, it can allow multiple programs to share the same hardware without interfering with each other.[a] So V86 mode provides a way for real-mode programs designed for a single-tasking environment (like DOS[b]) to run concurrently in a multitasking environment.

Usage

It is used to execute certain DOS programs in FlexOS 386 (since 1987), Concurrent DOS 386 (since 1987), Windows/386 2.10 (since 1987), DESQview 386 (since 1988), Windows 3.x (since 1990), Multiuser DOS (since 1991), Windows for Workgroups 3.1x (since 1992), OS/2 2.x (since 1992), 4690 OS (since 1993), REAL/32 (since 1995) running in 386 Enhanced Mode as well as in Windows 95, 98, 98 SE and ME through virtual DOS machines, in SCO UNIX through Merge, and in Linux through DOSEMU. (Other DOS programs which use protected mode execute using user mode under the emulator.) NTVDM in x86 Windows NT-based operating systems also use VM86 mode,[3] but with very limited direct hardware access. Some boot loaders (e.g. GRUB) use the protected mode, and execute the BIOS interrupt calls in Virtual 8086 mode.[4][5]

Memory addressing and interrupts

The most common problem by running 8086 code from protected mode is memory addressing which is totally different between protected mode and real mode. As mentioned, by working under VM86 mode the segmentation mechanism is reconfigured to work just like under real mode, but the paging mechanism is still active, and it is transparent to the real mode code; thus, memory protection is still applicable, and so is the isolation of the address space.

When interrupts (hardware, software and int instruction) occur, the processor switches off the VM86 mode and returns to work in full protected mode to handle the interrupt. Also, before servicing the interrupt, the DS, ES, FS, and GS registers are pushed on the new stack and zeroed.

Virtual-8086 mode extensions (VME)

The Pentium architecture added a number of enhancements to the virtual 8086 mode. These were however documented by Intel only starting with the subsequent P6 (microarchitecture);[6] their more recent formal name is Virtual-8086 Mode Extensions, abbreviated VME[7] (older documentation may use "Virtual 8086 mode enhancements" as the VME acronym expansion).[6] Some later Intel 486 chips also support it.[8][9] The enhancements address mainly the 8086 virtualization overhead, with a particular focus on (virtual) interrupts.[6][10] Before the extensions were publicly documented in the P6 documentation, the official documentation referred to the famed Appendix H, which was omitted from the public documentation and shared only with selected partners under NDA.

Activating VME is done by setting bit number 0 (0x1 in value) of CR4. Because the VME interrupt speed-up enhancements were found useful for non-VM86 protected tasks, they can also be enabled separately by setting only bit number 1 (0x2 in value), which is called PVI (Protected Mode Virtual Interrupts).[6][9] Detecting whether a processor supports VME (including PVI) is done using the CPUID instruction, with an initial EAX value of 0x1, by testing the value of second bit (bit number 1, 0x2 in value) in EDX register, which is set if VME is supported by the processor.[11][6] In Linux, this latter bit is reported as the vme flag in the /proc/cpuinfo file, under the "flags" section.

In virtual 8086 mode, the basic idea is that when IOPL is less than 3, PUSHF/POPF/STI/CLI/INT/IRET instructions will treat the value of VIF in the real 32-bit EFLAGS register as the value of IF in the simulated 16-bit FLAGS register (32-bit PUSHFD/POPFD continues to GP fault). VIP will cause a GP fault on the setting of simulated IF, directing the OS to process any pending interrupts. PVI is the same idea but only affects CLI/STI instructions.

First generation AMD Ryzen CPUs have been found to feature a broken VME implementation.[12] The second generation Ryzen (2000 series) has fixed this issue.[13]

64-bit and VMX support

Virtual 8086 mode is not available in x86-64 long mode, although it is still present on x86-64 capable processors running in legacy mode.

Intel VT-x brings back the ability to run virtual 8086 mode from x86-64 long mode, but it has to be done by transitioning the (physical) processor to VMX root mode and launching a logical (virtual) processor itself running in virtual 8086 mode.[14]

Westmere and later Intel processors usually[15] can start the virtual processor directly in real mode using the "unrestricted guest" feature (which itself requires Extended Page Tables); this method removes the need to resort to the nested virtual 8086 mode simply to run the legacy BIOS for booting.[16][17]

AMD-V can do virtual 8086 mode in guests, too, but it can also just run the guest in "paged real mode" using the following steps: you create a SVM (Secure Virtual Machine) mode guest with CR0.PE=0, but CR0.PG=1 (that is, with protected mode disabled but paging enabled), which is ordinarily impossible, but is allowed for SVM guests if the host intercepts page faults.[18]

See also

Notes

  1. ^ For example, if one program writes to a display, then another program gets control and writes to the same display, and then the first program gets control back, it will try to use the display as if the second program had not changed it. The V86 monitor can intercept the display writes, keep track of the display state for each program, and switch the real display between them according to which program the user has selected to interact with presently. The V86 monitor emulates independent displays for each program using only one real display.
  2. ^ DOS is mentioned because it was especially the extensive library of existing DOS programs that Intel had in mind when they designed V86 mode.

References

  1. ^ Yager, Tom (November 5, 2004). "Sending software to do hardware's job". InfoWorld. Retrieved January 27, 2014.
  2. ^ Gnomes, Lee; "Behind The Scenes: The Making of the 386", Intel Corporation, Special 32-Bit Issue Solutions, November/December 1985, page 19
  3. ^ "Windows NT 4.0 Workstation Architecture". Microsoft.
  4. ^ Mike Wang (21 June 2016). "Grub2 Booting Process". {{cite journal}}: Cite journal requires |journal= (help)
  5. ^ "Virtual 8086 Mode - OSDev Wiki". wiki.osdev.org. Retrieved 2020-12-10.
  6. ^ a b c d e T. Shanley (1998). Pentium Pro and Pentium II System Architecture. Addison-Wesley. pp. 427, 465–480. ISBN 978-0-201-30973-7.
  7. ^ Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (3A, 3B, 3C & 3D): System Programming Guide. Intel. May 2020. p. 2-17.
  8. ^ "Mailing List Archive: Re: 2.6.14: CR4 not needed to be inspected on the 486 anymore?". Gossamer-threads.com. Retrieved 2014-02-20.
  9. ^ a b "Pentium Protected Mode Virtual Interrupts (PVI)". Rcollins.org. Retrieved 2014-02-20.
  10. ^ "Virtual Mode Extensions on the Pentium Processor". Rcollins.org. Retrieved 2014-02-20.
  11. ^ Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (2A, 2B, 2C & 2D): Instruction Set Reference, A-Z. Intel. May 2020. pp. 3–199, 3–221, 3–222.
  12. ^ Michal Necasek (May 12, 2017). "VME Broken on AMD Ryzen". OS/2 Museum.
  13. ^ "Revision Guide for AMD Family 17h Models 00h-0Fh Processors" (PDF). AMD. June 2018.
  14. ^ Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3B: System Programming Guide, Part 2 (PDF). Intel. September 2009. p. 29-1. Archived from the original (PDF) on January 5, 2010. a VM entry is allowed only to guests with paging enabled that are in protected mode or in virtual-8086 mode. Guest execution in other processor operating modes need to be specially handled by the VMM; see also CS 686: Special Topic: Intel EM64T and VT Extensions (Spring 2007), lesson 24 how to do this from Linux (not that the code is pretty dated, so might not work as-is with current kernels) more up-to-date code can be found here. Also beware that this sample code is more complicated than strictly booting the logical processor in virtual 8086 mode; its ultimate goal is make some real-mode BIOS calls.
  15. ^ "Intel Virtualization Technology List". Ark.intel.com. Archived from the original on 2014-02-10. Retrieved 2014-02-20. A list of Intel processors that support VT-x but not EPT
  16. ^ "Intel added unrestricted guest mode on Westmere micro-architecture and later Intel CPUs, it uses EPT to translate guest physical address access to host physical address. With this mode, VMEnter without enable paging is allowed."
  17. ^ "If the “unrestricted guest” VM-execution control is 1, the “enable EPT” VM-execution control must also be 1"
  18. ^ "15.19 Paged Real Mode". AMD64 Architecture Programmer's Manual, Volume 2: System Programming (PDF). Rev. 3.38. Advanced Micro Devices. November 2021. pp. 515–516. To facilitate virtualization of real mode, the VMRUN instruction may legally load a guest CR0 value with PE = 0 but PG = 1. Likewise, the RSM instruction is permitted to return to paged real mode. This processor mode behaves in every way like real mode, with the exception that paging is applied. The intent is that the VMM run the guest in paged-real mode at CPL0, and with page faults intercepted. The VMM is responsible for setting up a shadow page table that maps guest physical memory to the appropriate system physical addresses. The behavior of running a guest in paged real mode without intercepting page faults to the VMM is undefined.

Read other articles:

Leroy Fer Leroy FerInformasi pribadiNama lengkap Leroy Johan FerTanggal lahir 5 Januari 1990 (umur 34)Tempat lahir Zoetermeer, BelandaTinggi 1,88 m (6 ft 2 in) [1]Posisi bermain GelandangInformasi klubKlub saat ini Swansea CityNomor 8Karier junior0000–1999 DWO1999–2007 FeyenoordKarier senior*Tahun Tim Tampil (Gol)2007–2011 Feyenoord 103 (14)2011–2013 FC Twente 47 (12)– Norwich City 30 (3)2014–2016 Queens Park Rangers 48 (8)2016 → Swansea City (pinjam...

 

1995 television film This article is about the original footage. For the 2006 feature film based on events surrounding it, see Alien Autopsy (2006 film). VHS cover of Alien Autopsy: Fact or Fiction Alien Autopsy: Fact or Fiction is a 1995 pseudo-documentary containing grainy black and white footage of a hoaxed alien autopsy.[1][2] In 1995, film purporting to show an alien autopsy conducted shortly after the Roswell incident was released by British entrepreneur Ray Santilli. ...

 

† Человек прямоходящий Научная классификация Домен:ЭукариотыЦарство:ЖивотныеПодцарство:ЭуметазоиБез ранга:Двусторонне-симметричныеБез ранга:ВторичноротыеТип:ХордовыеПодтип:ПозвоночныеИнфратип:ЧелюстноротыеНадкласс:ЧетвероногиеКлада:АмниотыКлада:Синапсиды�...

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (ديسمبر 2018) سباق باريس روبيه 1928 التاريخ 8 أبريل عدد المراحل 1 عدد الرياضيين 89 (نقطة البداية)،  و52 (نقطة النهاية)  ا�...

 

Administrasi Apostolik AtyrauAdministratio Apostolica AtirauensisАпостольская администратура Атырауcode: ru is deprecated   (Rusia)Katolik Katedral AtyrauLokasiNegara KazakhstanWilayahProvinsi AtyrauProvinsi AktobeProvinsi Kazakhstan BaratProvinsi MangghystauProvinsi gerejawiBunda Maria Teramat Suci di AstanaKantor pusatAtyrau, KazakhstanStatistikLuas736.612 km2 (284.407 sq mi)Populasi- Total- Katolik(per 2017)2.587....

 

I pendek atau Yot (Й й, miring: Й й ) adalah huruf dari Alfabet Kiril. Huruf ini menyerupai huruf И dengan breve di atasnya. Huruf Kiril I pendek Penggunaan Fonetis:[j] Sampel suaranoicon sumber · bantuan Alfabet KirilHuruf SlaviaАА́А̀А̂А̄ӒБВГҐДЂЃЕЕ́ÈЕ̂ЁЄЖЗЗ́ЅИИ́ЍИ̂ЙІЇЈКЛЉМНЊОŌПРСС́ТЋЌУУ́ У̀У̂ӮЎФХЦЧЏШЩЪЫЬЭЮЯHuruf non-SlaviaӐА̊А̃Ӓ̄ӔӘӘ́Ә̃ӚВ̌ҒГ̑Г̣Г̌ҔӺҒ̌ӶД̌Д̣Д̆ӖЕ̄...

この項目には、一部のコンピュータや閲覧ソフトで表示できない文字が含まれています(詳細)。 数字の大字(だいじ)は、漢数字の一種。通常用いる単純な字形の漢数字(小字)の代わりに同じ音の別の漢字を用いるものである。 概要 壱万円日本銀行券(「壱」が大字) 弐千円日本銀行券(「弐」が大字) 漢数字には「一」「二」「三」と続く小字と、「壱」「�...

 

Pustec / LiqenasОпштина Пустец Municipio Pustec / LiqenasLocalización de Pustec / Liqenas en Albania Coordenadas 40°47′13″N 20°54′08″E / 40.78694444, 20.90222222Capital PustecEntidad Municipio • País Albania Albania • Condado KorçëPoblación (2011)   • Total 3290 hab.Código postal 7020Matrícula KO[editar datos en Wikidata] Pustec (macedonio: Општина Пустец, Opshtina Pustets; hasta 2013 Liqe...

 

ملكة جمال الكون 1971 تاريخ العرض 24 يوليو 1971 مقدم الحفل بوب باركر، جون لوكهارت مكان قاعة ميامي بيتش، ميامي بيتش، الولايات المتحدة البث التلفيزيوني سي بي إس مشاركين 60 المراكز 12 إنقطاع عن تشيليسيلانتشيكوسلوفاكياالدنماركهونغ كونغ البريطانيةباراغواييوغوسلافيا عائدات تايلاند...

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (مايو 2022) رولاند فيكتور نوريس   معلومات شخصية تاريخ الميلاد سنة 1888   الوفاة 28 أبريل 1950 (61–62 سنة)  ميناء شيبستون  [لغات أخرى]‏  الحياة العملية المهنة ع�...

 

Australian actor, musician and presenter This biography of a living person needs additional citations for verification. Please help by adding reliable sources. Contentious material about living persons that is unsourced or poorly sourced must be removed immediately from the article and its talk page, especially if potentially libelous.Find sources: Cameron Daddo – news · newspapers · books · scholar · JSTOR (March 2013) (Learn how and when to remove th...

 

Pernikahan BerdarahSutradaraTorro MargensProduserHendrick GozaliDitulis olehTim Garuda FilmPemeranRaja EmmaDhaliaJoseph HunganWilly DozanZainal AbidinIda KusumahAndi WiyonoPiet PagauDolly MartinGatot SubrotoSutopo HSAznah HamidNoorhudaYusni JafarSabree FadzilToma Gagah Putra TMPenata musikBilly J. BudiardjoSinematograferTantra SurjadiPenyuntingRizal AsmarDistributorGaruda FilmTanggal rilis1987Durasi96 menitNegara Indonesia Pernikahan Berdarah adalah film laga dan horor Indonesia yang di...

Plaza de la Constitución Plaza de la Constitución.UbicaciónPaís  GuatemalaLocalidad Ciudad de Guatemala 6a. Calle zona 1Coordenadas 14°38′35″N 90°30′48″O / 14.643055555556, -90.513333333333CaracterísticasOtros nombres Plaza de ArmasParque Central Tipo Parque urbanoEstatus Abierto todo el añoVías adyacentes 6ª avenida, 7ª avenida, 6ª calle y 8ª calle del Centro HistóricoÁrea 0'5 km²HistoriaCreación 1776GestiónOperador Municipalidad de GuatemalaVis...

 

Genus of plants Cicuta Cicuta virosa Scientific classification Kingdom: Plantae Clade: Tracheophytes Clade: Angiosperms Clade: Eudicots Clade: Asterids Order: Apiales Family: Apiaceae Subfamily: Apioideae Tribe: Oenantheae Genus: CicutaL. Type species Cicuta virosaL. Species Cicuta bulbifera Cicuta douglasii Cicuta maculata Cicuta virosa Cicuta, commonly known as water hemlock, is a genus of four species of highly poisonous plants in the family Apiaceae. They are perennial herbaceous plants w...

 

  لمعانٍ أخرى، طالع الاتحاد (توضيح). الاتحادالشعارمعلومات عامةالنوع صحيفة يوميةتصدر كل 1 يوم بلد المنشأ  الإمارات العربية المتحدة التأسيس 1969 القطع القطع الكبير الثمن درهمانموقع الويب aletihadae.com (العربية) شخصيات هامةالمالك شركة أبوظبي للإعلامالتحريراللغة العربيةالإ�...

Poster tahun 1938 yang mempromosikan Taman Nasional Yellowstone, taman nasional pertama di dunia Interactive map of the National Parks of the United States.Amerika Serikat memiliki 63 taman nasional, yang merupakan kawasan lindung yang ditetapkan oleh Kongres yang dioperasikan oleh National Park Service, sebuah badan dari Departemen Dalam Negeri.[1] Taman nasional ditujukan untuk keindahan alamnya, fitur geologis yang unik, ekosistem yang beragam, dan peluang rekreasi. Sementara secar...

 

دوري الدرجة الأولى الروماني 1934–35 تفاصيل الموسم دوري الدرجة الأولى الروماني  النسخة 23  البلد رومانيا  التاريخ بداية:2 سبتمبر 1934  نهاية:21 يوليو 1935  المنظم اتحاد رومانيا لكرة القدم  البطل نادي ريبنسيا تيميشوارا  مباريات ملعوبة 132   عدد المشاركين 12   دوري...

 

Italian engagement of World War II Battle of the Alps redirects here. For the fighting later in World War II, see Second Battle of the Alps. Italian Invasion of FrancePart of the Battle of France during World War IIThe Val Dora battalion of the 5th Alpini Regiment in action in the Col de PelouseDate10 – 25 June 1940LocationFranco-Italian borderResult Armistice of Villa IncisaTerritorialchanges Creation of the Italian occupied zone in southern FranceBelligerents  FranceAir support: ...

Triassic/Jurassic geological formation in the UK Blue Lias FormationStratigraphic range: Rhaetian-Lower Sinemurian Planorbis-Semicostatum ~201–198 Ma PreꞒ Ꞓ O S D C P T J K Pg N ↓ Lower Lias sequence exposed at Nash Point, Glamorgan, WalesTypeGeological formationUnit ofLias GroupSub-unitsWilmcote Limestone Member, Saltford Shale Member, Rugby Limestone MemberUnderliesCharmouth Mudstone FormationOverliesLilstock FormationThicknessup to 120 metres (390 ft)LithologyPrimaryL...

 

هذه المقالة بحاجة لصندوق معلومات. فضلًا ساعد في تحسين هذه المقالة بإضافة صندوق معلومات مخصص إليها. التقویم الطبري، هو تقویم شمسي متشعب من التقويم الإيراني المتّبع في محافظة مازنداران شمال إيران، وهو أقدم من التقويم الهجري الشمسي الحالي بـ 133 سنة. أول أيام السنة حسب هذا الت�...