Hi,
Brynet-Inc wrote:1) Do these new 64-bit AMD & Intel CPU's use Microcode to add new CPU instructions?
Not that I'm aware of. Microcode is used to fix bugs in some CPUs (for e.g. disabling stuff that didn't work), but not for adding new instructions.
Brynet-Inc wrote:2) How long have they been doing this?
I think Intel started doing it with P6, but it may have been earlier. I'm yet to find any official documentation that indicates any AMD CPU supports microcode updates.
Transmeta were using something similar much earlier. Their CPUs had something like a RISC core and dynamic translation, where the code that does the dynamic translation (called the "code morphing software" or CMS) can be updated (and AFAIK was stored in the L1 cache). I've seen attempts at reverse engineering Transmeta's CMS updates, but they weren't complete enough to be useful.
Brynet-Inc wrote:3) Can anyone implement their own extensions to these CPU's?
In general, no.
To increase the amount microcode updates can do CPU manufacturers would need to reduce the amount that is hardwired, and therefore reduce performance. Intel would carefully select which parts are hardwired and which parts are effected by microcode. The idea would be to maximise performance while also attempting to maximising their ability to fix CPU bugs later.
For example, allowing the behaviour of the "ADD" instruction to be changed via. microcode updates would cause performance problems and wouldn't be worthwhile (as the ADD instruction is rarely buggy anyway), while allowing the default setting of the enable/disable flag for the "fast string instructions" optimisation to be set by microcode updates won't seriously effect performance (and might be useful, as this feature may be buggy due to complex cache consistancy problems involving string operations that cross boundaries between areas with different caching types) .
Also, (for Intel CPUs) without extremely detailed information that would only be available within Intel itself it'd be almost impossible to create your own microcode update. The first problem is that the microcode updates themselves have some form of encryption. The next problem is figuring out what the microcode update contains.
I would assume for Intel CPUs there's a set of flags that enable/disable certain features of the chip, plus an array of bits that controls which instructions are undefined, plus some actual microcode (which is only used for larger more complex instructions - smaller instructions are hardwired AFAIK). It would be extremely unlikely that you'd be able to significantly change the CPU itself (for e.g. uploading some microcode to make it run SPARC code would be impossible, and adding your own instructions would be extremely unlikely). It may be possible to modify exisiting larger instructions (like CPUID, LOOP, ENTER/LEAVE, etc) that use microcode, but you'd need to think of a reason to bother first.
Even with the necessary information any microcode update will only work for CPUs with the correct stepping. For e.g. an update for one Pentium III chip won't work on all Pentium III chips.
Basically it'd take a huge amount of time to create something that would be almost useless.
Brynet-Inc wrote:4) Is there any techniques for writing such Microcode or is it all proprietary and manufacture dependent?
AFAIK the method of updating the microcode is manufacturer specific, while the updates themselves are "CPU stepping" specific and proprietory.
Brynet-Inc wrote:Does each company release Microcode upgrades? And is it possible to update the aforementioned code through ones hobby OS?
Mostly, each company that uses microcode updates releases them to BIOS/motherboard manufacturers. BIOS/motherboard manufacturers include them in their "BIOS updates", and end users download the BIOS updates and re-flash their BIOS.
The BIOS itself has several different microcode updates stored in flash memory (and chooses the most suitable microcode update to upload into each CPU during boot). Intel did release specifications for BIOS functions that were meant to be used to change the microcode updates stored in the BIOS' flash memory. I'm not sure anyone actually uses them in practice though, as normal end users can't get the microcode updates (except as part of BIOS updates).
I see no reason why a hobby OS couldn't use these BIOS functions to change the microcode updates in the BIOS' flash memory (and therefore effect which microcode update is uploaded into the CPU the next time it does a hard reset). I personally can't see the point - it's easier for end users to reflash the BIOS.
Cheers,
Brendan