Show HN: LoongArch Userspace Emulator

(github.com)

35 points | by fwsgonzo 7 days ago

4 comments

  • Imustaskforhelp 2 days ago
    Fwsgonzo, what a legend man!!

    I am not kidding but before seeing this post, I had commented about my experiences in the libriscv discord server (I am the person who had created the AUR arch repository for simplekvm but had to pull them down)

    For reference: https://news.ycombinator.com/item?id=46413053#46415223

    Call this luck or whatever, but I really appreciate libriscv and I will definitely try to be more active, A ~77% of native and a possible ~90% potentially in a fairly permissive license allows the doors to be opened up for really fast sandboxes.

    I recently built a (although private repo) where you can ssh into something and it would directly run wasm and it turns out that you can convert golang directly to wasm (by bootstrapping the golang from scratch using gotip and the help of one stackoverflow post :) )

    The reason I didn't try to disclose it was that there was a minor issue in simple logic which kept me bugging me off and I had decided to use AI to basically glue me ssh https://github.com/gliderlabs/ssh with wasm but I wasn't so sure about publishing it after the recent rob-pike's incident and I found it a bit of bad taste to use AI after that and what should be my disclosure policy be but I hope its an acceptable use (of prototyping) considered by the general programming community and let me know if ssh-wasm or similar interests libriscv as I had evaluated libriscv and even installed simplekvm once again after an year or so but it had some issues running a rather simple main.go file and I think that LoongArch can be another good usecase for something like this.

    I actually built it and am thinking of creating a simple place where people can upload simple applications (in wasm or any other format) and then get an ssh link, they can ssh into or even an xterm instance or just, quick efficient sandboxing unlocks a lot of opportunities not previously thought of and your project is another step towards it so kudos for building it!

    • fwsgonzo 1 day ago
      Hey, and thanks! libloong is a little bit restrained in its design. It's designed specifically to be the lowest latency sandbox. libriscv is more flexible in that it can load dynamic ELFs and run programs with LuaJIT embedded. I actually haven't been able to run Go programs in libloong yet, but I do want to reach that level!
  • anthk 2 days ago
    I'd love this for Sparc/Solaris. I know IE5 was propietary, but I would test is with educational purposes (and a perfect example on how libre code can still run under modern Unixen without too many issues unlike IE5)

    As libre examples:

    - Arena browser

    - MosaicCK

    - XGopher/Xrn

    - VRGopher

    - XNedit, even with UTF8 support

    - Most window managers

    - Most libre Motif applications (and tons of them are really nice)

    - Libred Xephem. Yep, I know, Celestia, KSTars, planetaries with even Vulkan support... but for astronomic data, Xephem has zillions of details.

    You would say that these tools has no value, until you can quickly edit some EPS file from LaTeX under XFig.

    • bitwize 2 days ago
      Qemu can run SPARC binaries and emulate a full SPARC system enough to run Solaris 2.6. Qemu can emulate Loongarch as well!
      • anthk 2 days ago
        I know, but I would love to have it transparently, similar to some IOCCC guy that wrote a userland emulator to run Unix V4-v7 and up to BSD 2.1 binaries seamlessly. Similar to FreeBSD and NetBSD's compat(8) approach.
        • bitwize 2 days ago
          So you want CPU emul and a kernel personality. Kind of a tall ask, especially since you'll need much of Solaris anyway to run those vintage binaries.
          • yjftsjthsd-h 2 hours ago
            We have:

            * illumos

            * binfmt (Assuming a Linux host)

            * qemu

            I'm not saying it's zero work, but this looks entirely solvable.

          • anthk 1 day ago
            See this: https://github.com/DoctorWkt/Apout

            X11 calls can be just forwarded to the currently running server in your machine. The rest, yes, it must be implemented.

            PD: I'm not saying IE for Unix would run under that; Solaris it's pretty much post BSD 2.1 and maybe from another Unix branch.

            But code from NetBSD could be adapted for such task.

  • otterley 2 hours ago
    Is anyone outside of China using Loongson-based hardware?
  • fooblaster 2 days ago
    I find this all very cool, but why is this useful for game engine scripting. anyone know?
    • fwsgonzo 1 day ago
      It's designed to be low-latency enough that calling into the scripting solution is not considered a high cost. With something like Lua you're likely to hold back a lot, as it has a really high entry/exit cost, and the same is true for calling out to the host. libloong has 40x lower latencies.