3 ms·
How I learned: Step #1: read the arch manual for some CPU. Read most if not all of it. It’s a lot of reading but it’s worth it. My first was PowerPC and my sec
by pizlonator 3y ago
How I learned:
Step #1: read the arch manual for some CPU. Read most if not all of it. It’s a lot of reading but it’s worth it. My first was PowerPC and my second was x86. By the time I got to arm, I only needed to use the manual as a reference. These days I would start with x86 because the manuals are well written and easily available. And the HW is easily available.
Step #2: compile small programs for that arch using GCC, clang, whatever and then dump disassembly and try to understand the correspondence between your code and the instructions.
- treyd 3y agoThe Godbolt compiler explorer can be very helpful for step 2 there. It's neat to see how different compilers codegen the same source.
- rerdavies 3y ago> I would start with x86 because the manuals are well written and easily available .. and because the ARM system manuals are just unimaginably awful. ;-P
- pm215 3y agoMaybe I'm biased because I've spent a lot more time with them, but I rather prefer the Arm manuals, because I found they more reliably have the exact detail and solid pseudocode for how everything behaves. Plus for ages Intel split it up annoyingly into multiple different PDF documents (though it looks like you can get a combined manual now).