How to Write a Computer Emulator
fms.komkon.org
fms.komkon.org
So, not only did I write the emulator, I wrote an assembler to assemble the stock Fig source code.
It's hard to express how interesting it was testing unknown source code, with a buggy assembler, on a buggy CPU. For extra loads of laughs, my "benchmark" system that I happened to be testing opcodes and such against (for flags and what not) was a buggy web emulator. You just never knew what was going to go wrong where. Amazingly, I sussed it all out.
The good news is that the Fig source pretty much worked out of the box. Outside of my minor changes to adapt to my "I/O", it worked really well.
It's billed as a "debugger"... but it has an entire x86 emulator! The code is very small and clear. Written by national treasure Justine Tunney, of Redbean fame.
I'm considering modifying it to count x86 calls, to trace an executable running, to find hotspots and code that doesn't get called.
If perf isn't doing the job then you need to use a "proper" profiler like vTune. Perf is really good for the first pass but the analysis it provides is very superficial compared to a better profiler. This is better than analysis in an emulated environment as far as I'm concerned, most simulators don't even come close to mimicing a real processor (even gem5 isn't cycle accurate so if you are latency bound you may get the wrong result)
It also can track page faults, if you want to know where they happen you probably want perf mem
Why would it? I have every faith that the tool is sound (i.e. parses X86 correctly etc.), I was just thinking aloud about this kind of analysis.
What do you need to optimize but can't run on a desktop? Or is this the same type of "optimization" that I do fiddling around on compiler explorer? e.g. I like making little snippets faster
https://hackernoon.com/how-to-build-an-emulator-for-a-fantas...
What I want to know though is are there any good tutorials on writing circuit simulators? I haven't come across any yet. Probably not as common since it requires some physics and electronics knowledge.
So, if I print it out on paper and give it to a colleague, that's copyright infringement?
What about if the page no longer exists and it got archived on the Internet Archive? Is accessing that copy a violation of copyright?
But, according to the laws of copyright, the context is the creator’s to share or not. And, to take down if they so please.