Intel process execution modes

Processor Execution Modes.

I am a great follower of Intel architecture , so most of my explanations or articles are based on Intel architectures. Intel 80386 is the base for modern operating systems, one of the challenge for Intel was Real Address Mode. Today’s Intel architecture has 3 operating modes

  • Protected Mode
  • Real Address Mode
  • System Management Mode

** **

** **

Protected Mode : Most of the system programmers are aware of the benefits of protected mode, but for those who are new to this term, it’s a protection introduced for memory. Prior to protected mode, applications were able to access any region of memory and any malicious code could access any region of code. Protected mode introduced with interrupt. Programs can perform multitasking in this mode.

Real Address Mode: A simple explanation would be , programs executing in Real mode would have access to all the memory locations and any malicious code could corrupt memory and provide undesired results.

System Management Mode : This is the new feature introduced SL ,  IA32 architectures and above. SMM manages power management and some of the interesting facts are

  • Microprocessor output pin is used to trigger SMM mode
  • While servicing the interrupt / external interrupt , processor saves the current state and executes the code in SMM and then switch back to normal mode.
  • SMM uses RSM ( Return from SMM Mode ) instruction to restore microprocessor state.

 

Intel 64 Architecture adds new mode called IA-32e mode , the difference is that this has more general purpose registers which are extend to 64 bit and enabled at code segment .

=============================================================================================================

One has to understand the relation between the Microprocessor / Processor , operating system and the applications , I thought putting it in the form of a diagram

http://windowsarchitecture.files.wordpress.com/2010/09/aaa.jpg?w=300&h=214

If you look at the diagram , every layer consists of 32bit or 64bit modes, which means You can code / write your applications either in 32bit or 64bit and compile and run them on 32 bit / 64 bit . You cannot execute 64bit application on 32bit operating system but vice versa is possible which is running 32bit applications on 64bit operating system.

Later you operating system also needs to communicate with microprocessor / processor which can be again 32bit or 64 bit. Please understand that processor modes should be enabled by the Operating system on code segment , which means 64bit operating system can execute 64bit applications on 64bit processor mode