www.delorie.com/djgpp/doc/ug/basics/protected.html   search  
Guide: What does protected mode mean?

Programmers who are used to DOS programming will need to read this section. Most DOS programmers are used to "real mode" programming, whereas DJGPP programs run in "protected mode". Unix programmers will understand protected mode programming, since they've always been in protected mode.

Real mode is when the CPU is running in 8086 compatible mode. Protected mode is when the CPU is running in, well, the not quite as compatible mode. The purpose of protected mode is not to protect your program. The purpose is to protect everyone else (including the operating system) from your program.

What does this mean to the programmer? Well, basically it means that you can't just expect that everything in the computer is there for you to mess with. You can't just take over an interrupt. You can't just change the video settings. You can't just change the CPU's operating mode.

Here are some definitions you'll need to know.

physical address space
The physical memory in your system.
linear address space
When the CPU's paging registers shuffly the physical memory around so that memory appears where it's needed.
virtual address space
The combination of segments and linear address space that your program sees when it's running.
segment
A portion of your program's linear address space.
descriptor
The information about each defined segment is stored in a table; each entry contains the location, size, permissions, and attributes of the segment. These entries are descriptors. When you put a selector into a segment register, the CPU really reads the whole descriptor into hidden registers for its own private use.
selector
A 16-bit number that selects one of the descriptors in the descriptor table.
segment register
Like before, this is a 16-bit register that is used to refer to a segment. However, the value that this register contains is no longer a segment value, it contains a selector.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 1997   by DJ Delorie     Updated Apr 1997  

You can help support this site by visiting the advertisers that sponsor it! (only once each, though)