Real mode & Protected mode

Real mode VS Protected Mode

1. A single selector value can only reference 64K of memory (the upper limit of the 16-bit offset). What if a program has more than 64K of code? A single value in CS can not be used for the entire execution of the program. The program must be split up into sections (called segments) less than 64K in size. When execution moves from one segment to another, the value of CS must be changed. Similar problems occur with large amounts of data and the DS register. This can be very awkward!
2. Each byte in memory does not have a unique segmented address. The physical address 04808 can be referenced by 047C:0048, 047D:0038, 047E:0028 or 047B:0058. This can complicate the comparison of segmented addresses

32-bit Protected Mode VS 16-bit Protected Mode
1. Offsets are expanded to be 32-bits. This allows an offset to range up to 4 billion. Thus, segments can have sizes up to 4 gigabytes.
2. Segments can be divided into smaller 4K-sized units called pages. The virtual memory system works with pages now instead of segments. This means that only parts of segment may be in memory at any one time. In 286 16-bit mode, either the entire segment is in memory or none of it is. This is not practical with the larger segments that 32-bit mode allows.


In real mode, a selector value is a paragraph number of physical memory.
In protected mode, a selector value is an index into a descriptor table.  
In both modes, programs are divided into segments.

In real mode, these segments are at fixed positions in physical memory and the selector value denotes the paragraph number of the beginning of the segment.
In protected mode, the segments are not at fixed positions in physical memory. In fact, they do not have to be in memory at all!

Reference

1. https://www.cnblogs.com/fatsheep9146/p/5116426.html

2. https://pdos.csail.mit.edu/6.828/2014/readings/pcasm-book.pdf

猜你喜欢

转载自www.cnblogs.com/dirge/p/10080855.html