Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is protected mode needed in addition to compatibility mode in Intel x86 64 bit CPUs?

I'm reading intel software developer manual (section 3.1). Here is said that

The IA-32 architecture supports three basic operating modes: protected mode, real-address mode, and system management mode.

and

Intel 64 architecture adds IA-32e mode. IA-32e mode has two sub-modes.

This two sub-modes is Compatibility mode and 64-bit mode. Thus Intel 64 architecture contains 4 operating modes (protected mode, real-address mode, system management mode, IA-32e mode). But I don't understand for what protected mode is needed in Intel 64? Compatibility sub-mode of IA-32e permit to run legacy 16- and 32-bits application without re-compilation to 64-bit OS and 64-bit sub-mode permits OS to run application which access to 64-bit linear address space. Where protected mode is used when I'm using 64-bit OS? Application running ensured by IA-32e mode.

like image 240
user34881 Avatar asked Dec 30 '13 22:12

user34881


People also ask

What is protected mode in x86?

In protected mode operation, the x86 can address 4 GB of address space. This may map directly onto the physical RAM (in which case, if there is less than 4 GB of RAM, some address space is unused), or paging may be used to arbitrarily translate between virtual addresses and physical addresses.

What is protected mode in Intel 8086 microprocessor explain Intel 8086?

Protected mode is a mode of program operation in a computer with an Intel-based microprocessor in which the program is restricted to addressing a specific contiguous area of 640 kilobytes. Intel's original PC microprocessor, the 8088, provided a one megabyte (1 Mbyte) random access memory (RAM).

Which bit is responsible for switching from real to protected mode?

Set CR0 bit 0, the PE or protection-enable bit.

What is real mode and protected mode?

Real mode memory exists at locations 00000H-FFFFFH the first 1M byte of the memory system—and is present on all versions of the microprocessor. Protected mode memory exists at any location in the entire memory system, but is available only to the 80286—Pentium II, not to the earlier 8086 or 8088 microprocessors.


1 Answers

I believe the organization is like this. At any given time, the entire CPU must be in precisely one of the following modes (excluding the maintenance mode):

IA-32 Real Mode: This is how the processor powers on.

IA-32 Protected Mode: 32-bit execution environment. The usual protection mechanisms are in play; the CPU can selectively move into virtual-8086 mode.

IA-32e Mode: This is only available on 64-bit CPUs. The CPU can selectively move between compatibility and long mode.

That is, if you want to execute any 64-bit code, you need to go into IA-32e mode. You can now decide on a per-segment basis whether to execute 32-bit code in compatibility mode or 64-bit code in long mode.

like image 181
Kerrek SB Avatar answered Sep 28 '22 02:09

Kerrek SB