The microcode update is a patch only to the existing CPU microcode which is burned into ROM permanently. The CPU has a permanent ROM and a patch RAM which can contain new code. There is also a table of "match" values that is in RAM. This table has an entry for every patchable part of the ROM. When the CPU executes a patchable instruction, it checks this table. If there is an entry, then it uses the code in RAM. If it has the default value, then it jumps to ROM. So, to patch the CPU it is necessary to upload the new code to RAM and then modify entries in the match table appropriately. The procedure for doing this is roughly as follows:
Clear EAX, read the current processor signature using CPUID, and load the matching microcode update into kernel memory.
Clear EAX and EBX, and read the current microcode revision using the RDMSR instruction from the revision match specific register.
Write the memory address of the microcode update using the WRMSR instruction to the update match specific register.
Read the new microcode revision, and return success if it matches that of the update. Otherwise, return failure.
In Linux-based operating systems, this process is done on boot by a specific kernel module called "microcode". You can read the source code for this module to see the exact process.
Note that the patch files have a documented header, but the patch data itself, the actual code, is encrypted by a secret key which is hard-coded into the processor. Unless you know this key, you would have no way of writing your own patches.
http://www.webopedia.com/DidYouKnow/Hardware_Software/BootProcess.asp – Dean Spicer – 2015-07-01T22:10:39.357
You already figured it out on your own. Modern CPUs still work without microcode updates. Just like a fresh install of Windows 7 works without updates. Then you can load updates that fix bugs, security vulnerabilities, or enhance functionality. With microcode, the updates get applied each time you boot. – misha256 – 2015-07-01T22:11:20.083
2"I read that microcode is loaded in the processor on each reboot." -- Your source/premise in not correct. – sawdust – 2015-07-01T22:11:22.637
3@sawdust CPU microcode does get loaded at every cold boot, either by the system BIOS or OS early in its boot process. – misha256 – 2015-07-01T22:16:59.890
3@misha256 -- "CPU microcode does get loaded at every cold boot," -- That implies a chicken-or-egg conundrum. Are you confusing the (possible) *update* of microcode with (an alleged) loading of microcode? There's a world of difference between the two. – sawdust – 2015-07-01T23:20:31.867
3@sawdust Good point. I need to be more clear. Modern CPUs come with hard-wired microcode. Microcode Updates are then applied by the BIOS or OS as required. The CPU contains a small amount of volatile "patch" RAM for this purpose. – misha256 – 2015-07-01T23:27:05.950
@misha256 do -- Hard-wired as in "made up of logic and etched on the circuitry" or as in "present on permanent memory, ready to be executed." – Kraken – 2015-07-02T00:37:22.350
4@Kraken You're being a bit too pedantic. ROM programming is a form of hard-wiring. And microcode is just another conceptual abstraction layer (of many). You can put microcode into RAM, ROM, or "etch it directly on the circuitry" if you want. It's still microcode though, regardless of how you physically implement it in the CPU. – misha256 – 2015-07-02T02:54:48.320
I still don't understand why this is a bad question. I never even knew what microcode was in relation to a conventional CPU. – oldmud0 – 2015-07-02T02:55:16.973