Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 code that it is a real mode program or not?

Looking for an answer, All I could come up with is that a 'real mode' program uses BIOS subroutines along with OS subroutines whereas a 'protected mode' program uses only OS subroutines. instruction code differs since opcodes for registers are different and offset addresses are of different length. Is there any other feature that differentiates a real and protected mode program?

like image 556
KawaiKx Avatar asked Oct 27 '13 14:10

KawaiKx


People also ask

What is real mode and protected mode in 8086?

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.

What is protected mode in computer?

Files from the Internet and from other potentially unsafe locations can contain viruses, worms, or other kinds of malware that can harm your computer. To help protect your computer, files from these potentially unsafe locations are opened as read only or in Protected View.

What do you mean by real mode?

Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory.

Can you switch between real and protected mode?

The only data structure you need to switch from Real Mode to Protected Mode is GDT correctly set and loaded. Everything else (preparing IDT, loading TSS, reloading new GDT, etc.) is not strictly necessary to switch into Protected Mode. And you can accomplish these tasks when you are already in Protected Mode.


2 Answers

a 'real mode' program uses BIOS subroutines along with OS subroutines whereas a 'protected mode' program uses only OS subroutines.

instruction code differs since opcodes for registers are different and offset addresses are of different length.

like image 126
KawaiKx Avatar answered Oct 01 '22 20:10

KawaiKx


The main difference is the mode the cpu is in. In protected mode the OS can use features like paging and virtual memory. Also real mode code is never in 32 bits whereas protected mode code can be 16 bits or 32 bits. Every x86 cpu starts in real mode and the OS must switch to protected mode.

like image 41
patrick246 Avatar answered Oct 01 '22 18:10

patrick246