X86 Extension for RISC-V?

are there any plans for an extension which helps to speed up the emulation of programs compiled for the Intel 32-bit (x86) and Intel/AMD 64-bit (x86-64) architecture running on RISC-V hardware?

I could see the following use cases for such an extension:

a) Running proprietary legacy application on top of RISC-V (for example using an emulator such as Wine)
b) Running Windows in a Virtual Machine on top of RISC-V (for example using Qemu)

The extension should provide hardware support for translating the most used Intel 32/64-bit instructions to RISC-V instructions. The idea would be to make the common case fast and emulate the rest in software. To the point where software compiled for Intel 32/64-bit can run up to 80-90% of the speed on RISC-V hardware compared to running the same software on an Intel processor.

For 80% you’d be implementing a full x86 core. The rare instructions on x86 are already just calls to microcode.

I think first it is against all the goals / philosophy of RISC-V (e.g. a open, free (like in freedom) ISA without unnecessary bloat and limitations inherited form the past).

The other point is that your goal of having a processor running with 80-90% of an Intel processor would mean that you need a RISC-V implementation which a native performance close to an Intel processor. Assuming you speak about up-to-date Intel hardware, existing RISC-V microarchitectures are far away from e.g. Intel Kaby Lake processors regarding performance. Intel CPUs are hard to beat in this area. Even if you compare with slower Intel options like Atom series microarchitecture it will be hard.

It also makes not much sense technically, binary translation is more flexible and nearly as powerful than hardware emulation.

Last but not least I don’t think there is really a market for this. Any attempts of emulation x86 on non-x86 hardware, if it was transmeta, if it was Itanium, various software approaches was never commercially successful. Even x86 clones expect AMD have never been really successful outside niche markets. Even AMD struggles often (currently they won some ground with Rizen/Threadripper).

So I think it is a waste of time and effort.

2 Likes

The RISC-V Foundation has a “J Extension Working Group” that is investigating possible additional instructions to make JIT compilation faster.

https://groups.google.com/a/groups.riscv.org/forum/#!topic/sw-dev/esYoby-4_GU

I expect someone will get QEMU up and running on RISC-V in the near future, with or without the J extension.

3 Likes

I feel very strongly that emulation of x86 is crucially important for riscv. If we want riscv to be the norm, we need to look at how companies have successfully switched users from one architecture to another in the past, and that almost always involves emulation. Take for example, when Sony switched from using MIPS32 to ARM with their gaming consoles- not being able to play older titles on new hardware would have been a dealbreaker for many potential customers and executives realized this, which is why they spent a ton of energy on MIPS32 emulation for their new consoles. Sure, the older games didnt run as good as they did on the old hardware, but it gave users healthy breathing room during the transition.

The potential of riscv can not be fully reached without acknowledging the importance of hardware emulation for some of the important x86 instructions.
Previous poster said that commercial emulation has not been very successful in the past should do better research before posting.

If this is the future of processor architecture, I can imagine Windows running natively on it, with emulation for x86. Infact, perhaps one day you’ll even see a riscv computer with an x86 addon card…

RISC-V is an open and extensible ISA with no license fees. You are free to design and implement and market CPUs with an x86 compatibility extension if you believe it will be important and successful. In the best possible case you might get Pentium II performance which I, personally, don’t think there would be a demand for, even if Intel didn’t sue you.

I’m running DosBox on RISC-V Debian with no issues. You don’t NEED a hardware extension for ISA emulation. It can all be done in software, though yes, it’s faster in hardware.

1 Like

Technically x86 simply refers to a family of processors and the instruction set they all use. It doesn’t actually say anything specific about data sizes. The term x86 started out as a 16-bit instruction set for 16-bit processors (the 8086 and 8088 processors), then was extended to a 32-bit instruction set for 32-bit processors (80386 and 80486), and now has been extended to a 64-bit instruction set for 64-bit processors. It used to be written as 80x86 to reflect the changing value in the middle of the chip model numbers, but somewhere along the line the 80 in the front was dropped, leaving just x86.