Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Unreal mode
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Variant of real mode in x86 computing}} {{Use dmy dates|date=May 2019|cs1-dates=y}} {{Use list-defined references|date=December 2021}} {{x86 Processor Modes}} In [[x86]] [[computing]], '''unreal mode''', also '''big real mode''', '''flat real mode''', or '''voodoo mode'''<ref name="Darmawan_1"/> is a variant of [[real mode]], in which one or more segment descriptors has been loaded with non-standard values, like 32-bit limits allowing access to the entire memory. Contrary to its name, it is not a separate addressing mode that the x86 processors can operate in. It is used in the [[80286]] and later x86 processors. ==Mechanism== For efficiency reasons, the [[80286]] and all later x86 processors use the base address, size and other attributes stored in their internal [[segment descriptor]] cache whenever computing effective memory addresses, even in real mode. Therefore, a modification of the internal segment descriptor allows altering some properties of segments in real mode, like the size of addressable memory. This technique became widely used and is supported by all Intel processors.<ref name="Gutmann_2004"/> A program in unreal mode can call 16-bit code programmed for real mode (BIOS, DOS kernel and drivers) without any [[thunking]]. This makes an unreal mode driver simpler than a [[DOS Protected Mode Interface|DPMI]] driver. However unreal mode is incompatible with protected mode operating systems such as Windows 3.x/9x/NT and OS/2. Big real mode has a 1 MiB code segment and a 4 GiB data segment.<ref name="CNBlogs"/><ref name="Unreal_Mode"/> == Uses == [[HIMEM.SYS]] uses this feature (both 286 and 386 variants) to address [[extended memory]],<ref name="Necasek_2011"/> unless DOS is switched to run in a [[virtual 8086 mode]] that is incompatible with unreal mode. One of the very few games—if not the only one—that used unreal mode was ''[[Ultima VII]]''.<ref name="Riiser_2004"/><ref name="History"/> Unreal mode is used by [[BIOS]] code as this is the initial mode of modern Intel processors.<ref name="Intel_Boot"/> Furthermore, the [[System Management Mode]] (SMM) in [[Intel 80386|Intel 386SL]] and later processors places the processor in huge real mode.<ref name="Domas_2015"/> Some [[boot loader]]s (such as [[LILO (boot loader)|LILO]]) use the unreal mode to access up to 4 GiB of memory. ==Enabling unreal mode== The 80286 microprocessor can be put into unreal mode only with help of the undocumented instruction [[LOADALL]] to modify the hidden segment base registers to point to the source or target memory location above 1 MiB.<ref name="Necasek_2011"/> To put an 80386 or higher microprocessor into unreal mode, a program must first enter [[protected mode]], find or create a flat descriptor in the [[global descriptor table|GDT]] or [[local descriptor table|LDT]], load some of the data segment registers with the respective protected mode "selector", and then switch back to real mode. After returning to real mode, the processor will continue using the cached descriptors as established in protected mode, thus allowing access to 4 GiB of [[extended memory]] from real mode.<ref name="Unreal_Mode"/> Starting with the 80386, real mode programs can use the 32 bit registers with the Address Size Override Prefix.<ref name="X86-64"/> This allows programs to use an address like DS:[EBX]. In normal real mode, a fault occurs if EBX exceeds 0xFFFF. In unreal mode, the access is allowed. ==Variants of unreal mode== As described above, unreal mode usually involves using one or more data selectors to address data in memory more efficiently. This has been common practice and often referred to as "flat real mode"<ref name="FRM"/> or "big real mode".<ref name="RBIL_80"/> The term "unreal mode" was introduced in 1991 by Rakesh K. Agarwal.<ref name="Necasek_2018">{{cite web |last1=Necasek |first1=Michal |title=A Brief History of Unreal Mode |url=https://www.os2museum.com/wp/a-brief-history-of-unreal-mode/ |website=OS/2 Museum |date=June 15, 2018}}</ref> === 32-bit code === The "huge real mode" (named in Ralf Brown's interrupt list) or "unREAL" mode (named by Tomasz Grysztar) adds the ability to run 32-bit code with a 4 GiB code segment. This is achieved by loading the code selector (CS) from a descriptor having the 32-bit attribute ("D" bit) set to 1. This mode allows for avoiding Operand Size Override prefixes normally required when using 32-bit addressing in 16-bit code segment, but is more difficult to set up due to interaction with interrupts.<ref name="RBIL_780000"/><ref name="Unreal_Mode"/> The use of a 32-bit CS was described in Agarwal's 1991 article introducing the term "unreal mode".<ref name="Necasek_2018"/> This mode is used in Grysztar's open-source [[FASM]] and Helix RM386, a commercial DOS Extender bundled by Logitech mouse drivers. Grysztar wrote a description of techniques used for entering this mode and handling interrupts in 2010. He also reports that most of the CPUs he tested supports this previously-unknown mode, with the exception of a CPU of unknown model ("I think it was manufactured by [[Cyrix]]") and in a later user report, the [[Bochs]] and [[DOSBox]] emulators.<ref name="Grysztar_2010"/> ==See also== * [[LOADALL]] * [[Global EMM Import Specification]] (GEMMIS) * [[x86 assembly language]] * [[A20 line]] ==References== {{Reflist|refs= <ref name="Necasek_2011">{{cite web |url=http://www.os2museum.com/wp/himem-sys-unreal-mode-and-loadall/ |title=HIMEM.SYS, unreal mode, and LOADALL |author-first=Michal |author-last=Necasek |work=OS/2 Museum |date=2011-03-18 |access-date=2017-01-03 |url-status=live |archive-url=https://web.archive.org/web/20170103214301/http://www.os2museum.com/wp/himem-sys-unreal-mode-and-loadall/ |archive-date=2017-01-03}}</ref> <ref name="Intel_Boot">{{cite web |author-first1=Jenny |author-last1=Pelner |author-first2=James |author-last2=Pelner |url=https://www.intel.com/content/www/us/en/intelligent-systems/intel-boot-loader-development-kit/minimal-intel-architecture-boot-loader-paper.html |title=Minimal Intel Architecture Boot Loader |access-date=2017-10-14 }}</ref> <ref name="Unreal_Mode">{{cite web |title=Unreal Mode |url=http://wiki.osdev.org/Unreal_Mode |access-date=2015-02-18 |url-status=live |archive-url=https://web.archive.org/web/20170103222752/http://wiki.osdev.org/Unreal_Mode |archive-date=2017-01-03}}</ref> <ref name="X86-64">{{cite web |title=X86-64 Instruction Coding |url=http://wiki.osdev.org/X86-64_Instruction_Encoding#Operand-size_and_address-size_override_prefix |access-date=2015-02-18 |url-status=live |archive-url=https://web.archive.org/web/20170103223543/http://wiki.osdev.org/X86-64_Instruction_Encoding |archive-date=2017-01-03}}</ref> <ref name="Domas_2015">{{cite web |author-first=Christopher |author-last=Domas |date=2015 |publisher=Battelle Memorial Institute |url=https://www.blackhat.com/docs/us-15/materials/us-15-Domas-The-Memory-Sinkhole-Unleashing-An-x86-Design-Flaw-Allowing-Universal-Privilege-Escalation.pdf |access-date=2017-01-04 |title=The Memory Sinkhole: An architectural privilege escalation vulnerability |url-status=live |archive-url=https://web.archive.org/web/20170105002958/https://www.blackhat.com/docs/us-15/materials/us-15-Domas-The-Memory-Sinkhole-Unleashing-An-x86-Design-Flaw-Allowing-Universal-Privilege-Escalation.pdf |archive-date=2017-01-05 |quote=The processor loads an architecturally defined system state "Unreal" mode}}</ref> <ref name="Gutmann_2004">{{cite book |author-last=Gutmann |author-first=Peter |author-link=Peter Gutmann (computer scientist) |url=https://archive.org/details/springer_10.1007-b97264 |access-date=2017-01-04 |title=Cryptographic Security Architecture: Design and Verification |date=2004 |orig-year=2003 |isbn=978-0-387-95387-8 |publisher=[[Springer Science & Business Media]] |page=[https://archive.org/details/springer_10.1007-b97264/page/n73 58] |quote=[…] Unreal mode became so widely used […] that Intel was forced to support it in all later processors, although its presence was never documented […]}}</ref> <ref name="FRM">{{cite web |title=Flat Real Mode |url=https://dflund.se/~john_e/gems/gem0022.html |url-status=dead |archive-url=https://web.archive.org/web/20150818131329/https://dflund.se/~john_e/gems/gem0022.html |date=1998-03-16 |archive-date=2015-08-18}}</ref> <ref name="RBIL_80">{{cite web |author-first=Ralf D. |author-last=Brown |author-link=Ralf D. Brown |title=Interrupt List |url=https://www.cs.cmu.edu/~ralf/files.html |access-date=2017-10-14 |at=INT 80 (AMI BIOS)}}</ref> <ref name="RBIL_780000">{{cite web |author-first=Ralf D. |author-last=Brown |author-link=Ralf D. Brown |title=Interrupt List |url=https://www.cs.cmu.edu/~ralf/files.html |access-date=2017-10-14 |at=INT 78 (HugeRealMode Driver)}}</ref> <ref name="Grysztar_2010">{{cite web |author-first=Tomasz |author-last=Grysztar |title=unREAL Mode |url=https://board.flatassembler.net/topic.php?t=11940 |date=2010-09-17 |access-date=2017-10-14}}</ref> <ref name="Riiser_2004">{{cite newsgroup |author-first=Haakon |author-last=Riiser |title=HIMEM.SYS and unreal/flat real mode, EMM386 and UMBs |url=https://groups.google.com/d/msg/comp.os.msdos.programmer/bkX3EW5drZg/LjowxgosZlAJ |newsgroup=comp.os.msdos.programmer |access-date=2017-10-14 |url-status=live |archive-url=https://archive.today/20190421214912/https://groups.google.com/forum/%23!msg/comp.os.msdos.programmer/bkX3EW5drZg/LjowxgosZlAJ |archive-date=2019-04-21}}</ref> <ref name="Darmawan_1">{{cite web |author-first=Darmawan |author-last=Salihun |title=System Address Map Initialization in x86/x64 Architecture Part 1: PCI-Based Systems |url=https://sites.google.com/site/pinczakko/bios-articles/System%20Address%20Map%20Initialization%20in%20x86_x64%20-%20Part%201.pdf |date=2013-09-16 |access-date=2019-08-19}}</ref> <ref name="History">{{Cite web|url=http://www.os2museum.com/wp/a-brief-history-of-unreal-mode/|title = A Brief History of Unreal Mode | OS/2 Museum}}</ref> <ref name="CNBlogs">{{cite web| url=https://images2015.cnblogs.com/blog/363515/201512/363515-20151204133744658-1001794631.jpg | title=Modes graph | archive-url=https://web.archive.org/web/20230118185832/https://images2015.cnblogs.com/blog/363515/201512/363515-20151204133744658-1001794631.jpg | archive-date=2023-01-18 | format=JPG}}</ref> }} ==Further reading== * {{cite book |title=IBM Operating System/2 Technical Reference - Programming Family |publisher=[[IBM]] |date=September 1987 |orig-year=1986 |volume=1 |edition=1st |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/pc/os2/84X1434_OS2_Technical_Reference_Volume_1_Sep87.pdf |url-status=live |archive-url=https://web.archive.org/web/20170103220718/http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/pc/os2/84X1434_OS2_Technical_Reference_Volume_1_Sep87.pdf |archive-date=2017-01-03}} * {{cite magazine |title=Four Gigabytes in Real Mode - A slick trick to access large memory spaces on the 80386 from DOS |series=386 Now |author-first=Thomas |author-last=Roden |date=November–December 1989 |magazine=Programmer's Journal - The Resource Journal for IBM PC Programmers |volume=7 |issue=6 |issn=0747-5861 |publisher=Oakley Publishing Company |publication-place=Eugene, Oregon, USA |location=Irvine, California, USA |pages=89–94 |url=https://www.unzcloud.net/PDF/PERIODICAL/ProgrammersJournal-1989nov/91-97// |access-date=2020-02-21 |url-status=live |archive-url=https://web.archive.org/web/20200221183757/https://www.unzcloud.net/PDF/PERIODICAL/ProgrammersJournal-1989nov/91-97// |archive-date=2020-02-21}} * {{cite magazine |title=DOS + 386 = 4 Gigabytes! |author-last=Williams |author-first=Al |magazine=[[Dr. Dobb's Journal]] |publisher=[[People's Computer Company]] |date=July 1990 |volume=15 |pages=62–71 |url=https://archive.org/details/dr_dobbs_journal_vol_15/dr_dobbs_journal_vol_15}} [https://archive.org/stream/dr_dobbs_journal_vol_15/dr_dobbs_journal_vol_15_djvu.txt][https://archive.org/download/dr_dobbs_journal_vol_15/dr_dobbs_journal_vol_15.pdf] Errata: [https://www.drdobbs.com/letters/184408436] * {{cite book |author-last=Williams |author-first=Al |title=DOS 5: A Developer's Guide - Advanced Programming Guide to DOS |chapter=Chapter 18: Accessing 4 Gigabytes in Real Mode |location=Redwood City, California, USA |publisher=[[M&T Publishing, Inc.]] / [[Prentice Hall International (UK) Limited]] |date=1991 |edition=1 |isbn=0-13-217993-8<!-- international ISBN with disk --> |pages=691–712 |url-access=registration |url=https://archive.org/details/dos5developersgu00will}} (NB. Implements "Big real mode" SEG4G.) * {{cite web |title=How to kick out a memory manager |author-first=Michel |author-last=Lespinasse |publisher=Walken / Impact Studios |location=Amiens, France |url=http://dgi_il.tripod.com/gemmis.txt |access-date=2015-10-21 |url-status=live |archive-url=https://web.archive.org/web/20170104093930/http://dgi_il.tripod.com/gemmis.txt |archive-date=2017-01-04}} * [http://download.intel.com/support/processors/pentium4/sb/25366821.pdf Intel IA-32 Software Developer's Manual - Volume 3A] * The Unabridged Pentium 4: IA32 Processor Genealogy, Addison Wesley {{ISBN|0-321-24656-X}}. "Big real mode" * {{cite web |url=http://www.delorie.com/djgpp/doc/rbinter/it/91/37.html |title=Call HugeRealMode Server "Enable Two-Stage Interrupt Model" function}} * {{cite web |title=A Brief History of Unreal Mode |author-first=Michal |author-last=Necasek |date=2018-06-15 |work=OS/2 Museum |url=http://www.os2museum.com/wp/a-brief-history-of-unreal-mode/ |access-date=2018-09-15 |url-status=live |archive-url=https://archive.today/20180915003042/http://www.os2museum.com/wp/a-brief-history-of-unreal-mode/ |archive-date=2018-09-15 }} * {{cite web |url=http://www.rcollins.org/Productivity/DescriptorCache.html |title=Descriptor Cache Registers}} * {{cite book |title=DOS Internals |author-first=Geoff |author-last=Chappell |editor-first1=Andrew |editor-last1=Schulman |editor-first2=Amorette |editor-last2=Pedersen |date=January 1994 |edition=1st printing, 1st |series=The Andrew Schulman Programming Series |publisher=[[Addison Wesley Publishing Company]] |isbn=978-0-201-60835-9 }} (xxvi+738+iv pages, 3.5"-floppy [https://web.archive.org/web/20190421200111/https://gopher.tildeverse.org/gopher.viste.fr/9/programming/PC/DOS/DOS%2520Internals/DOS_Internals.zip][https://web.archive.org/web/20200222111608/https://www.pcjs.org/pubs/pc/programming/DOS_Internals/]) Errata: [https://web.archive.org/web/20200222111742/http://www.geoffchappell.com/notes/dos/internals/][https://web.archive.org/web/20200222111853/https://gopher.tildeverse.org/gopher.viste.fr/1/programming/PC/DOS/DOS%2520Internals/crtdrvr][https://web.archive.org/web/20200222111945/https://gopher.tildeverse.org/gopher.viste.fr/1/programming/PC/DOS/DOS%2520Internals/xmswatch] * [https://patents.google.com/patent/US5642491 Method for expanding addressable memory range in real-mode processing to facilitate loading of large programs into high memory] [[Category:X86 operating modes]] [[Category:DOS memory management]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite magazine
(
edit
)
Template:Cite web
(
edit
)
Template:ISBN
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Use list-defined references
(
edit
)
Template:X86 Processor Modes
(
edit
)