4 ms·
That is why emulating, when targeting 100% accuracy, is a craftsmanship in our industry. Not only do you need to know each and every quirk the original hardware
by qbane 2y ago
That is why emulating, when targeting 100% accuracy, is a craftsmanship in our industry. Not only do you need to know each and every quirk the original hardware/software has, but you also need to replicate it, however peculiar it is. Consider the potential performance impact if itself is not challenging enough.
- jsheard 2y agoEmulators have to be pragmatic about accuracy, when emulating more modern systems it's generally not feasible to target 100% hardware accuracy and usable performance, so they tend to accept compromises which are technically deviations from the real hardware but usually don't make any observable difference in practice. Anything that uses a JIT recompiler is never going to be perfectly cycle-accurate to the original hardware but it usually doesn't matter unless the game code is deliberately constructed to break emulators. Dolphin had to reckon with that balance when a few commercial Wii games included such anti-emulator code, which abused details of the real Wii CPUs cache behavior. Technically they could have emulated the real CPU cache to make those games work seamlessly, but the performance overhead (likely a 10x slowdown) would make them unplayable, so they hacked around it instead. https://dolphin-emu.org/blog/2017/02/01/dolphin-progress-report-january-2017/ https://dolphin-emu.org/blog/2017/02/01/dolphin-progress-rep...
- deleted 2y ago[deleted]
- bobmcnamara 2y agoI once wrote something that would hard lock cortex-A8 but not the cortex-A9 we shipped on. To my knowledge, nobody tracked down why our app, once exfiltrated from our device, would crash slightly older phones.
- pm215 2y agoWere you exploiting an A8 erratum, or detecting "this is an A8" somehow and then making it barf in a less processor specific way?
- bobmcnamara 2y agoA8 erratum. This was ages ago, but if I recall you could place a thumb2 instruction straddling two pages, only one of which was loaded in the TLBs. If you got everything right, the A8 would hang without trapping. Edit: it was errata #657417, long since scrubbed from arm.com
- pm215 2y agoThe A8 errata doc is at https://developer.arm.com/documentation/prdc008070/latest/ https://developer.arm.com/documentation/prdc008070/latest/ these days and does have a description of 657417 with enough detail to make writing a reproducer possible. Instructions crossing page boundaries are tricky beasts :-)
- bobmcnamara 2y agoWell look at that! I had searched Google and arm.com for that number. This was definitely it.
- AtlasBarfed 2y agoSo they'll patch around it. You're just making your software worthless in the long run for some value probably less than 5 years, or creating a fun problem for an emu hacker. Most of the significant losses to piracy monetarily isn't emulation, it's the chippers/mods that bypass cloned media copy protection. Which emulator authors have a lot more control over in bypassing
- pm215 2y agoIf it hardlocked an A8 but not an A9, chances are very high that an emulator would run it with no problem, because nobody deliberately tries to emulate the kind of CPU bug that lets an app hardlock the CPU. GP appears to have been interested in deterring people from running their code on non-authorised real hardware at the time, not targeting emulator users.
- bobmcnamara 2y agoBingo! Didn't want someone running new product's app on old product's hardware. Company was new to building non-RTOS devices which were tightly hardware bound, wanted similar type restrictions.
- mikestew 2y agoYou assume an anti-piracy attempt when GP, from my reading, made no such statement. More of a mystery, but who cares because the problem hardware wasn’t what they shipped on.
- cwillu 2y agoThey used the word exfiltrate, it's not a stretch.
- FMecha 2y ago>but it usually doesn't matter When it comes to speedrunning: Some speedrunners do, though, to ensure their speedrun tech are reproducible on both emulators and real hardware.
- jsheard 2y agoThat's true, the small differences between a pragmatic "accurate enough" emulator and real hardware can matter for speedrunners. The difference between real hardware running at 60fps and a principled cycle-accurate emulator running at <0.1fps would matter more, though. For the SNES and earlier it's feasible to have exceptional accuracy and still usable performance, but for anything modern it's just not happening. Imagine trying to write a cycle-accurate emulator core for a modern CPU with instruction re-ordering, branch prediction, prefetching, asynchronous memory, etc, nevermind making it go fast.
- FMecha 2y ago>For the SNES and earlier I think the cutline can be moved to the original PlayStation now. >but for anything modern it's just not happening. Which arguably explains a cultural rift in arcade emulation circles. MAME's philosophy is about cycle-accuracy, which might work for bespoke arcade hardware up to early 3D systems, whether they're bespoke (such as Namco's System 22) or console-derived (Namco's System 1x series, which all derive from the original PlayStation hardware) hardware. For newer arcade titles, which are just beefed period PCs, such kind of emulation (philosophy) would not be suffice for gameplay.
- masfuerte 2y ago> Anything that uses a JIT recompiler is never going to be perfectly cycle-accurate to the original hardware beebjit [1] is a cycle-accurate JIT-based emulator for the BBC Micro. It can be done. [1]: https://github.com/scarybeasts/beebjit https://github.com/scarybeasts/beebjit
- xcv123 2y agoThat is not perfectly cycle-accurate, but it is accurate enough to run almost anything without issues.
- mardifoufs 2y agoI wonder how mainframe emulators (that sometimes are used to run legacy, very critical software on modern hardware) manage to do it. Do they go for full complete emulation? As in, implementing the entire hardware in software?
- xcv123 2y agoMainframes typically execute batch processes on a CPU. Much simpler than a game console with a GPU. Cycle-accurate emulation is less relevant for mainframes.
- Locutus_ 2y agoMost of those a JIT recompilers, Mainframe code doesn't usually depend on instruction cycle timing to the level that say beam-racing game code does.
- immibis 2y agoThe good news is that modern systems are so unpredictable relative to each other that games can be relied upon to not require cycle-accuracy. IIRC the cycle timings can differ between different units of the same model.