Operating Modes in Intel Architecture

Hi all,
I was just looking at the intel software developer’s reference manual. I was thinking about the operating modes on intel architecture in 32-bit and 64-bit environment.
In 32-bit, we have three operating modes :-

  • Protected mode
  • Real-address mode
  • System Management mode.

Similarly, in 64-bit environment, we have four modes i.e.

  • Protected mode
  • Real-address mode
  • System Management mode.
  • IA-32e mode
    IA-32e mode has two sub-modes i.e. Compatibility mode and 64-bit mode.

My question is that on 64-bit architecture, is protected mode 32-bit or 64-bit. If it is 32-bit, then OS on 64-bit always run in IA-32e mode so that it can switch between compatibility mode and 64-bit mode. If yes, then this means that on 64-bit, when the system is powered, it first initializes in real-address mode, then it switches to protected mode. After enabling paging, it switches to IA-32e mode where it can easily run 32-bit applications and 64-bit applications.

My second question is that if OS is running in IA-32e mode, then in order to run 64-bit applications, the address space is linear. No segmented memory is available. How one can achieve segmented address space in 64-bit.

Thank you.


You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.

The 64-bit OS’es run in 64 bit mode. The 32-bit OS’es run in 32 bit mode.
The OS’es do not support segmented address spaces. Forget the Intel
manuals for now, and go read “Windows Internals” by Russinovich and
Solomon.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

“salman razzaq” wrote in message
news:xxxxx@ntdev…
> Hi all,
> I was just looking at the intel software developer’s reference
> manual. I was thinking about the operating modes on intel architecture in
> 32-bit and 64-bit environment.
> In 32-bit, we have three operating modes :-
> - Protected mode
> - Real-address mode
> - System Management mode.
>
> Similarly, in 64-bit environment, we have four modes i.e.
> - Protected mode
> - Real-address mode
> - System Management mode.
> - IA-32e mode
> IA-32e mode has two sub-modes i.e. Compatibility mode and 64-bit
> mode.
>
> My question is that on 64-bit architecture, is protected mode 32-bit
> or 64-bit. If it is 32-bit, then OS on 64-bit always run in IA-32e mode
> so that it can switch between compatibility mode and 64-bit mode. If yes,
> then this means that on 64-bit, when the system is powered, it first
> initializes in real-address mode, then it switches to protected mode.
> After enabling paging, it switches to IA-32e mode where it can easily run
> 32-bit applications and 64-bit applications.
>
> My second question is that if OS is running in IA-32e mode, then in
> order to run 64-bit applications, the address space is linear. No
> segmented memory is available. How one can achieve segmented address
> space in 64-bit.
>
> Thank you.
>
>
>
> ---------------------------------
> You snooze, you lose. Get messages ASAP with AutoCheck
> in the all-new Yahoo! Mail Beta.

Then how 32-bit applications run on 64-bit OS.

> Then how 32-bit applications run on 64-bit OS.

As you have stated yourself, IA-32e mode has two sub-modes i.e. Compatibility mode and 64-bit mode. The former is just designed for the purpose of running 32-bit programs on 64-bit systems
(please note that 32-bit compatibility mode is not really 32-bit mode, pretty much the same way virtual 8086 mode is not real-address mode - this is just emulation)

Concerning your statement about segmentation, 32-bit Windows does not use segmented memory model - it maps all segment registers, apart from FS, to the virtual address of 0 (CS and SS are different for the kernel and user modes because they refer to different descriptors in GDT, but they are still mapped to the virtual address of 0). Therefore, all code that runs 32-bit Windows believes it resides in a flat 4GB address space - this is why they call this memory model flat.

However, if 32-bit Windows did use segmented memory model, it would still be possible to run
Windows apps in 32-bit compatibility mode - in this mode CPU treats segmentation exactly the same way it does in “real” 32-bit mode

Actually, I believe that the main reason why there is no support for segmentation in 64-bit mode
is because segmentation does not prove to be popular among major 32-bit systems, although Windows maps FS to non-zero address. This is why 64-bit mode makes an exception for FS and GS
registers - Intel just responds to the needs of major OS designers

Anton Bassov

>Intel just responds to the needs of major OS designers

Actually, Intel comes up with some arcane processor technology that the
whole industry flatly rejects, AMD responds to the needs of the major OS
designers and then Intel pays AMD handsomly for their technology. But, your
points are still valid :slight_smile:

Bill M.

wrote in message news:xxxxx@ntdev…
>> Then how 32-bit applications run on 64-bit OS.
>
> As you have stated yourself, IA-32e mode has two sub-modes i.e.
> Compatibility mode and 64-bit mode. The former is just designed for the
> purpose of running 32-bit programs on 64-bit systems
> (please note that 32-bit compatibility mode is not really 32-bit mode,
> pretty much the same way virtual 8086 mode is not real-address mode - this
> is just emulation)
>
>
> Concerning your statement about segmentation, 32-bit Windows does not use
> segmented memory model - it maps all segment registers, apart from FS, to
> the virtual address of 0 (CS and SS are different for the kernel and user
> modes because they refer to different descriptors in GDT, but they are
> still mapped to the virtual address of 0). Therefore, all code that runs
> 32-bit Windows believes it resides in a flat 4GB address space - this is
> why they call this memory model flat.
>
> However, if 32-bit Windows did use segmented memory model, it would still
> be possible to run
> Windows apps in 32-bit compatibility mode - in this mode CPU treats
> segmentation exactly the same way it does in “real” 32-bit mode
>
> Actually, I believe that the main reason why there is no support for
> segmentation in 64-bit mode
> is because segmentation does not prove to be popular among major 32-bit
> systems, although Windows maps FS to non-zero address. This is why 64-bit
> mode makes an exception for FS and GS
> registers - Intel just responds to the needs of major OS designers
>
>
> Anton Bassov
>
>
>
>
>

>> Intel just responds to the needs of major OS designers

Actually, Intel comes up with some arcane processor technology that the whole
industry flatly rejects,

Until recently, it used to be true. However, it looks like now they are finally adjusting themselves to the needs of the market. This is why they have introduced support for x64 in their processors, in the first place. Otherwise, they would still be trying to push IA64, which, softly speaking, “did not prove to be that popular among major OS designers” (in actuality, it was just mainly ignored by the market)…

AMD responds to the needs of the major OS designers and then Intel pays AMD
handsomly for their technology.

I fully agree with you here - indeed, x64 is AMD’s, rather than Intel’s, technology…

Anton Bassov

anton bassov wrote:

Actually, I believe that the main reason why there is no support for
segmentation in 64-bit mode is because segmentation does not prove
to be popular among major 32-bit systems, although Windows maps
FS to non-zero address. This is why 64-bit mode makes an
exception for FS and GS registers -

Later AMD CPUs *re*introduced segment support in 64-bit long mode. Vmware needs that. That’s why Vmware requires laters AMD step models (or an Intel Vtune-enabled CPU) for virtualizing a 64-bit guest OS.

Note that Intel did -not- reintroduce segmentation (or at least, not
according to any reading I’ve done); VT provides a different mechanism for
guarding the VMM from the VM.


Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net
wrote in message news:xxxxx@ntdev…
> anton bassov wrote:
>
>> Actually, I believe that the main reason why there is no support for
>> segmentation in 64-bit mode is because segmentation does not prove
>> to be popular among major 32-bit systems, although Windows maps
>> FS to non-zero address. This is why 64-bit mode makes an
>> exception for FS and GS registers -
>
> Later AMD CPUs reintroduced segment support in 64-bit long mode. Vmware
> needs that. That’s why Vmware requires laters AMD step models (or an Intel
> Vtune-enabled CPU) for virtualizing a 64-bit guest OS.
>
>