Finding candidates to replace their microcode

By: Anonymous (nospam.delete@this.nospam.com), August 20, 2004 2:23 pm
Room: Moderated Discussions
Dresdenboy (M.Waldhauer@gmx.de) on 8/19/04 wrote:
>
>I remember Alpha, VIA and NexGen MPUs to have such features besides many others.
>I don't remember correctly the intentions for the Alpha, but VIA included this feature
>clearly to be used by programmers to optimize code.
>

Alpha does not have microcode of any kind since the instructions are already so close to the hardware. It does have a unique feature called PALcode (Processor Abstraction Layer), which is essentially a special processor mode below the operating system itself. In addition to regular Alpha instructions, PALcode has instructions like hwldq/hwstq (to directly access all cache arrays without any paging or address translation) and can directly modify any hardware register including those hidden from the operating system. PALcode uses a dedicated set of GPRs for the operands of custom instructions and temporary use.

At boot time, PALcode is directly written into the L1 instruction cache from a serial ROM (sort of like Transmeta CMS is) and does most built-in self test and initialization functions usually done by microcode or state machines. It's also used for exception handling, so exceptions like TLB misses are handled in PALcode instead of in the OS itself. Most interestingly, the opcode map reserves spaces for custom instructions that automatically get executed in PALcode. Alpha defines things like wruniq (write thread unique ID) that's encoded just like a regular Alpha instruction, but PALcode uses it to update internal structures. PALcode is replaceable by the OS, for instance Linux replaces most of the default Alpha PALcode. You can read all about it from the Linux source code in arch/alpha.

VIA has special instructions for things like encryption and random number generation. I wasn't aware they had user programmable microcode, although if true I wouldn't find getting my hands on such a chip for some reverse engineering :-).

NexGen had a special mode where you could directly execute your own RISC86 instructions. Not much information is available anymore, but search for RISC86 for details. There is a very detailed patent on this as well as a chapter for a book on the AMD K6 microarchitecture (AMD bought NexGen and used the technology as a basis for the K6 and K7 Athlon).

>
>Sure, it doesn't make sense as an general option, because the microcode might get
>outdated with the CPU generation. However, for an algorithm, which is running 24/7
>on a lot of systems and which could be accelerated by 5-10% thanks to some custom
>microcode, this would surely make sense.
>

It's unlikely you could do that much better. Microcode on CPUs like the K7/K8 and Pentium 4 generally does not let you build customized instructions that are faster than the hardwired micro-ops, since that's not the purpose of microcode. There *are* very limited facilities for doing semi-custom operations, but they are not very fast compared to hardwired logic.

>
>BTW, the code contains ~30% register copying MOV instructions. I'd like to see
>x86 MPUs address this wasting of execution units in the future.

Opteron already does this, by eliminating moves as part of the register renaming process. I think it was discussed in the Chip Architect article on the K8 core. This is also trivial to do in binary translation systems (Transmeta does it extensively). As far as I know, the only chip that doesn't is Intel.

< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Opteron Exposed: Reverse Engineering AMD K8 Microcode UpdatesAnonymous2004/07/22 01:39 AM
  Opteron Exposed: Reverse Engineering AMD K8 MicrocDresdenboy2004/07/22 05:13 AM
    Opteron Exposed: Reverse Engineering AMD K8 MicrocAK2004/07/22 08:49 AM
      Opteron Exposed: Reverse Engineering AMD K8 MicrocDresdenboy2004/07/22 10:26 AM
        the former posting has no new text, continue hereDresdenboy2004/07/22 10:32 AM
  An additionDresdenboy2004/07/22 08:04 AM
    An additionAnonymous2004/07/22 02:32 PM
      An additionDresdenboy2004/07/22 02:55 PM
  Opteron Exposed: Reverse Engineering AMD K8 Microctom vier2004/07/22 08:38 AM
    Opteron Exposed: Reverse Engineering AMD K8 MicrocWouter Tinus2004/07/22 08:56 AM
    Opteron Exposed: Reverse Engineering AMD K8 MicrocIgor2004/07/23 10:00 PM
      Opteron Exposed: Reverse Engineering AMD K8 MicrocKronos2004/07/24 02:04 PM
  Opteron Exposed: Reverse Engineering AMD K8 Microcode UpdatesMax2004/07/22 01:01 PM
    Opteron Exposed: Reverse Engineering AMD K8 Microcode UpdatesAnonymous2004/07/22 05:26 PM
  Does that means..._Arthur2004/07/22 10:01 PM
    Does that means...Dresdenboy2004/07/23 03:27 AM
    Does that means...Jan2004/07/23 07:51 AM
      Does that means...Anonymous2004/07/23 03:10 PM
        Does that means...Igor2004/07/23 10:42 PM
          Does that means...Anonymous2004/07/24 09:53 PM
            Does that means...Igor2004/07/25 12:08 AM
            Does that means...Anonymous2004/07/25 12:17 AM
              Does that means...anonymous2004/07/25 04:31 PM
                Does that means...Igor2004/07/26 08:42 PM
  Permanent virusess.chauhan2004/07/27 12:25 AM
    Permanent virusesAnonymous2004/07/27 10:42 AM
  Finding candidates to replace their microcodeDresdenboy2004/08/19 02:06 AM
    Finding candidates to replace their microcodePaul DeMone2004/08/19 06:22 AM
      Finding candidates to replace their microcodeDavid Kanter2004/08/19 06:53 AM
        Finding candidates to replace their microcodefoobar2004/08/19 09:55 AM
          Finding candidates to replace their microcodeDavid Kanter2004/08/19 10:58 AM
          Finding candidates to replace their microcodeAnonymous2004/08/20 01:56 PM
            Finding candidates to replace their microcodehobold2004/08/23 03:14 PM
      Finding candidates to replace their microcodeDresdenboy2004/08/19 10:59 AM
        Finding candidates to replace their microcodeanonymous2004/08/19 03:35 PM
        Finding candidates to replace their microcodeAnonymous2004/08/20 02:23 PM
          Finding candidates to replace their microcodeGroo2004/08/20 09:25 PM
          Finding candidates to replace their microcodeDresdenboy2004/08/21 05:01 AM
            Finding candidates to replace their microcodeAnonymous2004/08/21 04:45 PM
              Finding candidates to replace their microcodeanonymous2004/08/21 09:45 PM
      Finding candidates to replace their microcodeMatt Craighead2004/08/19 01:18 PM
      Finding candidates to replace their microcodeRick C. Hodgin2004/08/21 04:58 AM
        Finding candidates to replace their microcodeanonymous2004/08/21 09:41 PM
          Finding candidates to replace their microcodeRick C. Hodgin2004/08/22 08:31 AM
            Finding candidates to replace their microcodeanonymous2004/08/23 08:56 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell green?