Questions tagged [protected-mode]

x86 protected mode allows system software to support virtual memory, paging and preemptive multi-tasking.

x86 protected mode allows system software to support virtual memory, paging and preemptive multi-tasking.

  • Protected mode was first added to the x86 architecture in 1982, with the release of Intel's 80286 processor, and later extended with the release of the 80386 processor in 1985.
  • To maintain backward compatibility, x86 processors begins executing instructions in real mode.

To enter protected mode:

  • The Global Descriptor Table (GDT) must first be created with a minimum of three entries: a null descriptor, a code segment descriptor and data segment descriptor.
  • In an IBM-compatible machine, the A20 line (21st address line) also must be enabled to allow the use of all the address lines so that the CPU can access beyond 1 megabyte of memory.
  • Then the PE bit must be set in the CR0 register and a far jump must be made to clear the prefetch input queue:
; set PE bit
mov eax, cr0
or eax, 1
mov cr0, eax

; far jump (cs = selector of code segment)
jmp cs:@pm

@pm:
; Now we are in PM.
214 questions
34
votes
5 answers

How is it possible to access memory of other processes?

I thought that one process cannot read the memory of other processes. But I'm shocked to see an application named "WinHex" which has "RAM Editor" and it is able to access the entire memory. Of all the processes. How is that possible? And it is even…
Alice
  • 471
  • 1
  • 5
  • 6
28
votes
2 answers

bootloader - switching processor to protected mode

I'm having difficulties understanding how a simple boot loader works. The boot loader I'm talking about is the one from MITs course "Operating Systems Engineering". First, let me show you a piece of assembly code the BIOS executes: [f000:fec3] …
solyd
  • 782
  • 2
  • 8
  • 18
19
votes
3 answers

Does GRUB switch to protected mode?

I would like to ask if it is GRUB that switch the CPU to protected mode during boot up or is it the Linux kernel that does it. And also I would like to ask - is the kernel itself (vmlinuz) an ELF or is it plain binary format? Thanks.
mnc
  • 199
  • 1
  • 3
16
votes
3 answers

Protected Mode Keyboard Access on x86 Assembly

I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know. My kernel is running in protected mode right now, so I…
Blank
  • 7,088
  • 12
  • 49
  • 69
12
votes
2 answers

Assembler jump in Protected Mode with GDT

I am currently playing around with x86 Assember in order to sharpen my low-level programming skills. Currently, I am facing a little problem with the addressing scheme in 32-Bit Protected Mode. The situation is the following: I have a Program loaded…
Sebastian B.
  • 287
  • 4
  • 19
12
votes
3 answers

What is the true difference between a real mode program and a protected mode program?

I know the difference between a real mode and protected mode from the OS and hardware perspective. But I am trying to figure out What does a program 'knows' about real mode or protected mode? how can you say while looking at an source code/object…
KawaiKx
  • 9,558
  • 19
  • 72
  • 111
11
votes
9 answers

Real mode BIOS routine and Protected Mode

I am doing some OS experiment. Until now, all my code utilized the real mode BIOS interrupt to manipulate hard disk and floppy. But once my code enabled the Protect Mode of the CPU, all the real mode BIOS interrupt service routine won't be…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
10
votes
4 answers

How to Access AppData in IE Protected Mode (from a Managed BHO)

I am writing an IE Extension (BHO) in C#. When run in protected mode (IE's new UAC-compliant mode which forces all extensions to run at low-integrity), it fails because it cannot access user.config in the appdata folder. Is there some way to mark…
BlueRaja - Danny Pflughoeft
  • 84,206
  • 33
  • 197
  • 283
10
votes
1 answer

Temp directory using virtualized path on some computers

In my Silverlight application I'm using regular SaveFileDialog for prompt user to save some file. The problem is that on some Windows 7 computers, if user use IE in protected mode, and try to save to for example on desktop, path for saving ends up…
Marko
  • 1,874
  • 1
  • 21
  • 36
8
votes
1 answer

Switch from protected mode to real mode in a DOS EXE program

I learned to switch to protected mode with a simple DOS based bootloader. This loader loads kernel.bin into a buffer and copies the buffer to 100000h (kernel is 8KiB). Control is then transferred to the kernel. When I return from the kernel and…
micheal007
  • 137
  • 9
8
votes
3 answers

Can someone explain this directly assembled x86 JMP opcode?

At school we have been using a bootstrap program to run stand-alone programs without an operating system. I have been studying this program and when protected mode is enabled there is a far jump executed by directly assembling the opcode and…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
8
votes
2 answers

How to detect IE Protected Mode using c#

I am building an IE Extension, and I need to keep my Access Database file in the Appdata folder. It's working fine. But in many systems where IE IE Protected Mode is ON, it crashes, I guess this is because IE Protected Mode doesn't allow Extensions…
sumit_batcoder
  • 3,369
  • 1
  • 25
  • 36
8
votes
2 answers

How to switch from real mode to protected mode after bootloader?

I just finished up a very bare-bones bootloader for my OS and now I'm trying to switch to protected mode and jump to the kernel. The kernel exists on the second sector (right after the bootloader) and on. Can anyone help me out with my code? I…
David
  • 693
  • 1
  • 7
  • 20
8
votes
2 answers

BIOS Interrupts in protected mode

I'm working on an operating system project, using isolinux (syslinux 4.5) as bootloader, loading my kernel with multiboot header organised at 0x200000. As I know the kernel is already in 32-bit protected mode. My question: Is there any easier way to…
amaneureka
  • 1,150
  • 11
  • 26
8
votes
1 answer

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…
user34881
  • 111
  • 2
1
2 3
14 15