Is this not how qemu works? Is rosetta not considered an emulation layer? For all its name suggests otherwise, I would certainly refer to wine as an emulator, and it also uses these techniques.
Not to be That Guy, but WINE doesn't use those techniques, and thus isn't an emulator.
It lightly translates binary formats (Windows executables) into Linux-compatible executable code, and then runs that code against libraries that implement Windows APIs in terms of Linux underneath. It's not an emulator in the same way that your libc isn't emulating lockf(3) in terms of fcntl(2) underneath. In web-dev parlance, we'd call WINE a polyfill.
Rosetta and QEMU on the other hand are emulators--emulators, in this instance, being a term of art that implies interpreting bespoke meaning from machine code instructions written in another program. Some emulators translate instructions 1:1, some have optimized stencils, some (like Rosetta) have kernel support for emulating very quickly, and some (maybe like Rosetta; sources disagree) also have hardware support as well.
WINE emulates an ABI, rather than a CPU or such, but I'd happily argue that that's an emulator. (In fairness, though it's not generally described that way, I would call web polyfills API emulation)
It "emulates a behaviour" and natural language is fluid, so sure, you could call WINE an emulator and I wouldn't be mad at you. But WINE is very different compared to what most emulators are. Usually the term is reserved for when you emulate in software what used to be hardware.
> It lightly translates binary formats (Windows executables) into Linux-compatible executable code,
Does this not involve transpilation? I guess I was grouping that in under dynamic recompilation and AOT techniques.
Regardless, I don't think that there's a benefit from defining emulation from an implementation rather than an empirical perspective. If it runs a chunk of code as if it were in a different environment, I'm kind of ok to call it an emulator. To the sibling's point, a polyfill would also fit as an emulation layer here.
Not necessarily. It could just rewrite the outer portion to be an ELF loader that then calls into a runtime that actually shims the syscalls for example. I don't think WINE does exactly this but it's not really transpiling either.
You don't even need that, really; just have wine load the PE binary into memory and hand it a bunch of DLLs that use Linux syscalls under the hood. It's less transpiler and more of a funky dynamic linker+loader plus libraries.
I believe WINE doesn't actually translate any instructions; it's a Windows PE loader and a bunch of libraries that implement Windows APIs using Linux equivalents.
Windows apps don't use syscalls directly; they call into kernel32.dll, which is convenient for Wine. (Microsoft enforces this by scrambling the syscall numbers on OS updates [1].)
Yes. Linux is the only major operating system where there is even a convention to directly access system calls. For macOS, everything goes through libSystem.
It lightly translates binary formats (Windows executables) into Linux-compatible executable code, and then runs that code against libraries that implement Windows APIs in terms of Linux underneath. It's not an emulator in the same way that your libc isn't emulating lockf(3) in terms of fcntl(2) underneath. In web-dev parlance, we'd call WINE a polyfill.
Rosetta and QEMU on the other hand are emulators--emulators, in this instance, being a term of art that implies interpreting bespoke meaning from machine code instructions written in another program. Some emulators translate instructions 1:1, some have optimized stencils, some (like Rosetta) have kernel support for emulating very quickly, and some (maybe like Rosetta; sources disagree) also have hardware support as well.