Linux in a Pixel Shader - A RISC-V Emulator for VRChat
views
for comments see Hacker News, r/programming or r/vrchat
Intro
Sometimes you get hit with ideas for side-projects that sound absolutely plausible in your head. The idea grips you, your mind’s eye can practically visualize it already. And then reality strikes, and you realize how utterly insane this would be, and just how much work would need to go into it.
Usually these ideas appear, I enjoy dissecting them for a few days, and then I move on. But sometimes. Sometimes I decide to double down and get Linux running on my graphics card.
This is the story of how I made the rvc RISC-V emulator within VRChat, and a deep-dive into the unusual techniques required to do it.
Here are some specs up front, if you’re satisfied with piecing the story together yourself:
the code is on GitHub
emulated RISC-V rv32ima/su+Zifencei+Zicsr instruction set
... continue reading