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
X86 assembly language
(section)
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!
==Execution modes== {{Further|X86 architecture}} The x86 processors support five modes of operation for x86 code, '''Real Mode''', '''Protected Mode''', '''Long Mode''', '''Virtual 86 Mode''', and '''System Management Mode''', in which some instructions are available and others are not. A 16-bit subset of instructions is available on the 16-bit x86 processors, which are the 8086, 8088, 80186, 80188, and 80286. These instructions are available in real mode on all x86 processors, and in 16-bit protected mode ([[80286]] onwards), additional instructions relating to protected mode are available. On the [[80386]] and later, 32-bit instructions (including later extensions) are also available in all modes, including real mode; on these CPUs, V86 mode and 32-bit protected mode are added, with additional instructions provided in these modes to manage their features. SMM, with some of its own special instructions, is available on some Intel i386SL, i486 and later CPUs. Finally, in long mode (AMD [[Opteron]] onwards), 64-bit instructions, and more registers, are also available. The instruction set is similar in each mode but memory addressing and word size vary, requiring different programming strategies. The modes in which x86 code can be executed in are: * [[Real mode]] (16-bit) ** 20-bit segmented memory address space (meaning that only 1 [[Megabyte|MB]] of memory can be addressed— actually since 80286 a little more through [[High memory area|HMA]]), direct software access to peripheral hardware, and no concept of [[memory protection]] or [[Computer multitasking|multitasking]] at the hardware level. Computers that use [[BIOS]] start up in this mode. * [[Protected mode]] (16-bit and 32-bit) ** Expands addressable [[physical memory]] to 16 [[Megabyte|MB]] and addressable [[virtual memory]] to 1 [[Gigabyte|GB]]. Provides privilege levels and [[protected memory]], which prevents programs from corrupting one another. 16-bit protected mode (used during the end of the [[DOS]] era) used a complex, multi-segmented memory model. 32-bit protected mode uses a simple, flat memory model. * [[Long mode]] (64-bit) ** Mostly an extension of the 32-bit (protected mode) instruction set, but unlike the 16–to–32-bit transition, many instructions were dropped in the 64-bit mode. Pioneered by [[Advanced Micro Devices|AMD]]. * [[Virtual 8086 mode]] (16-bit) ** A special hybrid operating mode that allows real mode programs and operating systems to run while under the control of a protected mode supervisor operating system * [[System Management Mode]] (16-bit) ** Handles system-wide functions like power management, system hardware control, and proprietary OEM designed code. It is intended for use only by system firmware. All normal execution, including the [[operating system]], is suspended. An alternate software system (which usually resides in the computer's [[firmware]], or a hardware-assisted [[debugger]]) is then executed with high privileges. ===Switching modes=== The processor runs in real mode immediately after power on, so an [[operating system]] [[kernel (operating system)|kernel]], or other program, must explicitly switch to another mode if it wishes to run in anything but real mode. Switching modes is accomplished by modifying certain bits of the processor's [[control register]]s after some preparation, and some additional setup may be required after the switch. ===Examples=== With a computer running legacy [[BIOS]], the BIOS and the [[boot loader]] run in [[Real mode]]. The 64-bit operating system kernel checks and switches the CPU into Long mode and then starts new [[kernel-mode]] threads running 64-bit code. With a computer running [[UEFI]], the UEFI firmware (except CSM and legacy [[Option ROM]]), the UEFI [[boot loader]] and the UEFI operating system kernel all run in Long mode.
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)