‹ BackHN Continuity

Thread

The scourge of x86 emulation

295 points · 100 comments · dagmx

  1. dagmx · · focus · HN ↗
    For reference , Fex is a translation framework for x86 to ARM much like Apple’s Rosetta2 and Microsoft’s Prism.

    Valve sponsor development as it’s also the way the new Steam Frame supports x86 games. It’s also being used (as a fork) in Crossover Beta to replace the use of Rosetta2.

    1. MiroslavPokorny · · focus · HN ↗
      Why doesnt Stream require their binaries to be compiled to some bytecode and transpiled during the install ?

      THen they wouldnt require any emulator for any new compiles.

      1. rwmj · · focus · HN ↗
        I don't know, but assumed that Valve doesn't require studios to recompile their software or use any special tooling, it's basically just packaging of existing executables. This is also why they do Windows on Linux emulation.
        1. cassianoleal · · focus · HN ↗
          > This is also why they do Windows on Linux emulation.

          They don't. They use WINE, which as the name says, Is Not an Emulator. :D

          (I'll let my pedantic self out now)

          1. mitxela · · focus · HN ↗
            despite the funny backronym, Wine actually IS a WINdows Emulator. Someone apparently told them that it's only called an emulator if it's emulating a CPU architecture, but that's not true.
            1. cdmckay · · focus · HN ↗
              I thought it was an implementation of the Win32 API as a compatibility layer.

              What is it emulating exactly?

              1. jcranmer · · focus · HN ↗
                DOS interrupts, for starters.
              2. mitxela · · focus · HN ↗
                Windows.
            2. anthk · · focus · HN ↗
              Does Windows NT have a Windows 9x API emulator?
              1. pjmlp · · focus · HN ↗
                Windows NT predates Windows 95 for two years.

                And yes it did had emulators for Windows 16, and DOS

                <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Virtual_DOS_machine" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Virtual_DOS_machine

                <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Windows_on_Windows" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Windows_on_Windows

              2. fredoralive · · focus · HN ↗
                If you squint a bit (well, a lot really), Win32S on 3.1 and Windows 95’s Win32 implementation are Windows NT emulators running on top of 16 bit Windows.
              3. mitxela · · focus · HN ↗
                Windows NT doesn&#x27;t emulated Windows, it is Windows. Wine is not Windows and emulates Windows.
                1. MiroslavPokorny · · focus · HN ↗
                  It is windows today, but in the beginning the two were incompatible different products.
                2. fragmede · · focus · HN ↗
                  Wine Is Not (an) Emulator
                  1. mitxela · · focus · HN ↗
                    Yet, it emulates windows and is a windows emulator.
                    1. anthk · · focus · HN ↗
                      No, it&#x27;s a Win32 implementation for Unix.
            3. ekianjo · · focus · HN ↗
              its closer to a translator than an emulator
              1. mitxela · · focus · HN ↗
                What do you think an emulator is?
                1. MiroslavPokorny · · focus · HN ↗
                  A translater is a more accurate description of WINE. WINE literally translates API calls from the client program to the host OS.
                  1. mitxela · · focus · HN ↗
                    What do you think an emulator is?
                    1. MiroslavPokorny · · focus · HN ↗
                      For me an emulator works to simulate the hardware which is very different from translating API calls. THe result may appear to be same, but the approach is very different.
                      1. mitxela · · focus · HN ↗
                        Why is hardware the only thing that can be emulated?
                2. rincebrain · · focus · HN ↗
                  I think in common usage, people expect an &quot;emulator&quot; to be a more sandboxed translation layer than Wine, for example, provides.

                  e.g. it&#x27;s probably a security vuln if loading a Game Boy ROM reads arbitrary paths on your local filesystem determined by the ROM&#x27;s code, not so much with Wine.

                  Someone made a cute demonstration that I think usefully encapsulates this a while ago. [1]

                  [1] - <a href="https:&#x2F;&#x2F;gpfault.net&#x2F;posts&#x2F;drunk-exe.html" rel="nofollow">https:&#x2F;&#x2F;gpfault.net&#x2F;posts&#x2F;drunk-exe.html

                  1. mitxela · · focus · HN ↗
                    Mostly because the Gameboy doesn&#x27;t have any IO register to reformat your hard disk. If the emulator interpreted some instruction as reformatting your hard disk, that would be a bug because it&#x27;s not interpreting it as whatever it actually does on a real Gameboy.
                3. ekianjo · · focus · HN ↗
                  an traditional emulator emulates all the hardware of the target machine. WINE does nothing of that.
                4. zbentley · · focus · HN ↗
                  “Emulator” is a term of art in this area which refers to emulation of a hardware (and usually machine instruction) environment. Ironically, “translation” (as in instruction translation), as proposed by a sibling comment, is an even more connoted-with-hardware-emulation term.

                  WINE is … well, most directly it’s just an implementation of an API (the Windows APIs). In webdev parlance it might be called a “polyfill”. Perhaps a “compatibility shim”?

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.