Gavin Brewer
Gavin Brewer

Reputation: 23

Intel IA32 cheat sheet

I am looking for a document or textbook that covers the technical specifications, magic numbers etc for the IA32 architecture.

The Intel manuals are all well and good, but I am looking for something much more concise.

The particular project I am working on, (a new type of OS), requires an intimate knowledge of hardware addresses and basic systems architecture.

I have no need to make use of much of the detail covered in the Intel manuals - just the technical details required for implementing task switching and virtual memory - from scratch!

Could anyone point me in the direction of some good resources?

Thanks.

Upvotes: 2

Views: 416

Answers (1)

Mats Petersson
Mats Petersson

Reputation: 129374

The Intel and AMD manuals are probably the best resources for this. You obviously don't need to read ALL of it, but the relevant sections - for example AMD's "AMD64 Architecture Programmers Manual, Volume 2", where chapter 5 covers "page translation", which is the basis for virtual memory.

Edit: Declaring bias: I have worked for AMD and I still prefer AMD to Intel - both when it comes to the literature and the actual product.

Task switching is typically done by simply saving the context of one process and restoring the new process's context using, mainly, regular instructions, with a couple of moves to CR3 and CR4 for setting up the page-table for the new process (usually don't have to save the CR3/CR4 values, since they are "fixed" per process, so you just load the new ones from whatever place they are stored in the data for that process).

In 32-bit mode, the x86 architecture does have "built in" task switching, but it's not used by any modern OS, and is quite a bit slower due to its "save everything, restore everything" approach. Manually writing the task save/restore code is generally not that hard, and you can clearly avoid saving and restoring a lot of data. You still need to use the "Task-state segment" (Chapter 12 in AMD's literature) to allow for stack switching between Kernel and User mode.

And of course, you also need to look at some of the interrupt and exception handling, how to deal with hardware registers for PCI access, and so on. I'm afraid that's something I look up in books that I don't have links for. These are currently stacked away in a box since a recent move, so can't give you exact titles.

Upvotes: 2

Related Questions