ぱんつ
God I was fucked up last night (again). I remember trying to compile devel/cross-gcc for some reason (and laughing when I remembered I had to apply patches to get the arm-eabi version to build). I should submit those patches upstream one of these days.
You know what’s always bothered me a bit? Why don’t NDS emulations use dynamic recompilation to make them not slow as balls? Naturally, due to Nintendo’s API model (ie, “nothing” except memory-mapped registers) there are a couple tricks — not only do those registers have to be emulated (by mmap‘ing those regions and reading them with a helper thread in the same process space), but you’d also have to simulate interrupts.
On the DS, interrupts aren’t that bad. There’s a couple of IRQ tables sitting off in memory where you put pointers to your interrupt handlers. Simulating interrupts are basically just a matter of pthread_suspend_np‘ing the application code, jumping to it’s interrupt function, then resuming the application (I think).
And then there’s the actual recompilation of the ARM binaries to a native assembly (honestly, it’d be better to recompile to LLVM or GCC bytecode, then push that through a compiler to generate the native assembly), which I imagine is a massive pain in the ass.
Not nearly as much a pain in the ass as going through and figuring out what all the hundreds of little weird places in memory are supposed to do. It’d be a lot of digging through reverse-engineered documentation and diving into the code for other emulators and stuff.
But I think this is basically the only way to get any reasonable performance. I think emulating the hardware with an ARM interpreter is a needlessly costly way to implement the functionality (though it works, for the most part). Blah.
6 comments