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 am reading the new book, Windows Internals 5 about memory management (chapter 9 in Physical Address Extension PAE section). It is mentioned "A 32-bit system represents physical addresses internally with 24 bits" on page 770. I am totally confused, and I think x86 physical memory should be also addressed by 32-bit, and it is why the system is called 32-bit system.

Any ideas what is wrong?

share|improve this question

migrated from stackoverflow.com Sep 20 '09 at 7:32

This question came from our site for professional and enthusiast programmers.

3 Answers 3

I'm reading Physical Address Extension (PAE) chapter in Windows Internals Fourth edition (pages 435-437) and I can't seem to find the reference to 24 bits. There is a reference to 25 bits used for base page address, which means that the addressable space becomes 2 ^ (12 + 25) = 128GB. But we'll come back to it. First lets see how linear address is converted into physical address (and this is perfectly described in the book): the linear address gets split into three pieces:

  • 12 lower bits are offset within the page addressing any byte in 4Kb page;
  • the next 10 bits are index of the record in the page table (PTE), which contains the base address (physical address of the first byte) of the page;
  • the highest 10 bits are index of the record in the page directory table (PDE), which contains the base address for the PTE.

Each item in PTE and PDE contain 32-bit record, 20 bits of which contain the physical address of the page or the next level table, respectively. The other 12 bits are flags describing the page or the table (readable/writable/executable and so on). This is how 80386, x486 and Pentium worked.

Now, Pentium Pro and newer CPUs, when running in PAE mode, use 64-bit wide records in PDE and PTE tables. In these records up to 40 bits can be used to encode the base address of the page in memory. This means that PAE mode can theoretically address 2 ^ 40 pages (1T pages) of 2 ^ 12 (4Kb each). Total theoretical address space is 2 ^ (40 + 12) = 2 ^ 52 = 4Peta bytes. However, operating systems do not use all these 40 bits. For example, Windows only uses 24 of them, which leads to total addressable address space of 2 ^ (24 + 12) = 2 ^ 36 = 64G bytes.

Apparently, different versions (flavors) of Windows use different number of bits in this table, which seems a bit odd. According to the 4th edition of the book in question, 25 bits are used in this case, which brings the addressable space to 128Gb, and it is also confirmed by this page. This is source of the discrepancy between the 4th and 5th edition, mentioned above.

For more detailed explanation of how the translation happens, take a look at page 4-17 and 4-18 (chapter 4.4.2) of Intel 64 and IA32 Architectures Software Developer's Manual

Oh, yeah, and the system is called 32-bit not because it addresses 2^32 bytes. It's because it runs in the mode where internal registers are 32-bit wide (which is not always true anymore, but is close enough to reality). If the addressable space determined the name of the OS, then DOS would have been 20-bit OS, and old Macs would've been 24-bit OS

share|improve this answer
    
Yes, I have the same thinking. But I do not think Mark makes mistake. :-) –  George2 Sep 20 '09 at 5:29
    
Thanks Rom, I am interested in your points -- "There is a reference to 25 bits used for base page address, which means that the addressable space becomes 2 ^ (12 + 25) = 128GB.", I think 25 means physical memory address is represented by 25-bits, but 12 means what? –  George2 Sep 20 '09 at 15:13

What this is referring to is the mapping of a 32-bit virtual address space to a 24-bit physical address space. General a 20-bit virtual page number gets translated to a 12-bit physical page number and the remaining bits are the offset into the page

share|improve this answer
2  
Yeah, but physical address space hasn't been 24-bit wide since the time of 80286, i.e. mid-eighties, almost 25 years ago. –  Rom Sep 20 '09 at 5:35
    
Hi ennuikiller, I am confused, do you mean physical memory is addressed by 24-bit, if yes, we could address max of 2 ^ 24 = 16M unique locations (bytes in this case). –  George2 Sep 20 '09 at 5:39
    
Hi Rom, if physical memory is addressed by 24-bit, from your calculation a max of 2 ^ 24 = 16M unique locations (bytes in this case) could be addressed, how could we address 4G? –  George2 Sep 20 '09 at 5:40
1  
@George2, no see the quote below from "Inside Windows 2000". Basically each physical page can address up to 16M –  ennuikiller Sep 20 '09 at 5:46
1  
@George2: That's the point: physical memory is 32-bit wide on 32-bit processors (actually, Pentium and newer 32-bit chips can address 36 bits, IIRC). My comment was to point out that physical bus size cannot be 24-bit wide –  Rom Sep 20 '09 at 5:49

Here are more details about what booting /PAE means from Chapter 7 of the book "Inside Windows 2000," by David Solomon and Mark Russinovich.

All of the Intel x86 family processors since the Pentium Pro include a memory-mapping mode called Physical Address Extension (PAE). With the proper chipset, the PAE mode allows access to up to 64 GB of physical memory. When the x86 executes in PAE mode, the memory management unit (MMU) divides virtual addresses into four fields.

The MMU still implements page directories and page tables, but a third level, the page directory pointer table, exists above them. PAE mode can address more memory than the standard translation mode not because of the extra level of translation but because PDEs and PTEs are 64-bits wide rather than 32-bits. The system represents physical addresses internally with 24 bits, which gives the x86 the ability to support a maximum of 2^(24+12) bytes, or 64 GB, of memory

Edit: As George says So 24 bits of page numbers represents 24+12=36 bits of byte addresses. This is an address extension over the the 32 bit normal space.

share|improve this answer
1  
Yes, Preet, This is almost the exact words in Windows Internals 5, I am confused about "The system represents physical addresses internally with 24 bits" as you quoted, my confusion is if physical memory is addressed by 24-bit, then a max of 2 ^ 24 = 16M unique locations (bytes in this case) could be addressed, how could we address 4G? –  George2 Sep 20 '09 at 5:44
1  
@George2, this part of the system is concerned with entire pages of memory. So 24 bits of page numbers represents 24+12=36 bits of byte addresses. –  RBerteig Sep 20 '09 at 6:26
1  
Whoops I deleted my own extra bit :-) –  Preet Sangha Sep 20 '09 at 7:30
    
"24 bits of page numbers" -- what do you mean page number? PFN (Page Frame Number)? If yes, could you let me know where it is claimed PFN is 24-bit please? It should be very helpful information. –  George2 Sep 20 '09 at 15:08
    
@Preet, from the formula you provided -- "24+12=36 bits", I think 24 means page number (Page Frame Number) and 12 means offset inside a page? If yes, could you let me know where it is claimed PFN is 24-bit please? It should be very helpful information. –  George2 Sep 20 '09 at 15:09

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.