Search code examples
processor

We know that the processors switch from 16-bit real mode to 32-bit protected mode during boot, so when does it switch to 64-bit mode


During boot the processors switch from 16-bit real mode to 32-bit protected mode.
But modern CPUs are 64 bit, right?

So, When does these processors switch to 64-bit mode?


Solution

  • Basically, the Operating System is responsible for selecting the processor operating mode, on the boot process.

    Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. Real mode is characterized by a 20-bit segmented memory address space (giving exactly 1 MiB of addressable memory) and unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware. Real mode provides no support for memory protection, multitasking, or code privilege levels. Before the release of the 80286, which introduced protected mode, real mode was the only available mode for x86 CPUs;[1] and for backward compatibility, all x86 CPUs start in real mode when reset, though it is possible to emulate real mode on other systems when starting on other modes.

    When a processor that supports x86 protected mode is powered on, it begins executing instructions in real mode, in order to maintain backward compatibility with earlier x86 processors.[4] Protected mode may only be entered after the system software sets up one descriptor table and enables the Protection Enable (PE) bit in the control register 0 (CR0).[5]

    x86-64 (also known as x64, x86_64, AMD64 and Intel 64[note 1]) is the 64-bit version of the x86 instruction set. It supports vastly larger amounts (theoretically, 264 bytes or 16 exabytes) of virtual memory and physical memory than is possible on its 32-bit predecessors, allowing programs to store larger amounts of data in memory. x86-64 also provides 64-bit general-purpose registers and numerous other enhancements. x86-64 processors can boot in a fully backward compatible legacy mode, without 64-bit support, for 16-bit and 32-bit x86 software that requires real mode, or in a compatibility mode that allows 64-bit applications to coexist with 16- and 32-bit protected mode software if the 64-bit system software supports them.[11][note 2] Because the full x86 16-bit and 32-bit instruction sets remain implemented in hardware without any intervening emulation, these older executables can run with little or no performance penalty,[13] while newer or recoded applications can take advantage of new features of the processor design to achieve performance improvements.

    Sources:
    https://en.wikipedia.org/wiki/Real_mode
    https://en.wikipedia.org/wiki/Protected_mode
    https://en.wikipedia.org/wiki/X86-64
    See also:
    Processor, OS : 32bit, 64 bit