Closed Razican closed 6 years ago
I'm not sure what you're asking, with the exception of the last snipped it seems reasonably clear to me. When we enable PAE we set bit 5 because bit 5 is the bit that enables PAE. The other bits are irrelevant in this situation as they're various other settings. If you want to read up on what the others are you could go to the spec or the wiki page for the register.
https://en.wikipedia.org/wiki/Control_register#CR4
It would indeed be useful to know why enabling paging requires two bits and what they're specifically are though. Looking on the wiki page, 31 is just paging itself while 16 is for enabling write-protection on read-only pages.
@Razican I think you're right, even though these details don't matter, it seems contrary to everything else to not explain them in depth. We can do better.
Maybe there should be an appendix explaining a bit about registers and how do they work etc. Maybe a bit of assembly code explanation. That would be awesome. That way, the ones who don't want to, don't need to look at it, but the ones that want to deepen into it could go to the appendix and read about it.
Perhaps a brief explanation on bit flags when it first comes up?
That makes sense, but I think that in the future, for a great book, having some appendixes about x86/x86_64 architechtures (or even others) would make a difference.
I'm not working on the first edition anymore, so I'm going to give this a close. This stuff isn't in the second edition yet, and it's not likely to make it exactly. If someone wants to send in a PR to fix up the first edition, please feel free!
So, when enabling PAE:
Why do we put the fifth bit to
1
? What do other bits mean? It would be great to have some more info. The same happens when setting the long mode bit:It says
But, well, it would at least be interesting to say what that
0xC0000080
means, or why is it there, and why is the 8th bit being set to1
.And finally, when enabling paging:
It would be great to explain what those 31st and 16th bits do, and what other bits are there.