Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I found lots of Web sites and books explaining how memory management worked on the 8086 and later x86 CPUs in Real Mode. I understand, I think, how two 16 bit values, segment address and offset are combined to get a linear 20 bit physical address (shift segment four bits to the left, add offset; segments are 64K and start every 16 bytes).

But I couldn't find any good Web sites or books that explained how memory management works in Protected Mode, specifically the differences between 80286 and 80386.

Can anyone point me to a good Web site or book (or explain it right here)?

(For extra credit, i.e. an upvote, how does it work in Long Mode?)

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

http://www.ddj.com/184409207 Dr Dobbs ran a few articles back in 93 & 94 on this and there is not too many differences between the way the 286 and 386 handles the memory. The basics is you can't do the manipulation on the segment:offset registers because the base memory location and length is now part of the selector which you refer to like a handle.

You set up the selector N with a base address X with a length of M. When that selector is activated (remember the CS: assembly syntax?) that range of memory is used (paged in, etc). Selector N (the 16bit handle) refers to that data structure.

Flat memory model protected mode set the code, data and stack to the same memory addresses (and length of 4gb). That link covers the basics pretty well.

share|improve this answer
    
The linked article is really good. –  Andrew J. Brehm Feb 8 '11 at 10:43
add comment

For real mode, there is no memory managememt, its just multiply the segment register by 16 and adding the offset then puts this the 21bit result(yes 21bit because 0xFFFF*0x10+0xFFFF=0xFFFF0*0xFFFF=0x1FFFEF or 1_1111_1111_1111_1110_1111b, a 21bit value) on the address buss.

For long mode, segmentation exists, but the descriptors have base 0 and limit 0xFFFFFFFFFFFFFFFF(16EB) thus its flat mode, paging is around and its like PAE paging but the Page Directory Pointer Table is extended from 4 entries to 512 entries and a Page Level 4 Table with 512 entries that each point to a different Page Directory Pointer Table.

And here are some sites that explain it in more detail: http://en.wikipedia.org/wiki/Real_mode for real mode and http://en.wikipedia.org/wiki/Long_mode for ling mode

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.