[HN Gopher] Ask HN: Which books/resources to understand modern A...
___________________________________________________________________
Ask HN: Which books/resources to understand modern Assembler?
I'd like to learn more about Assembler in order to be able to work
with LLVM and JIT as well as to write high performance low-level
code. I'm familiar with the basics of x86 but I haven't touched
Assembler in a while, so I'm wondering which resources and in
particular books you'd recommend?
Author : throwaway63467
Score : 30 points
Date : 2024-04-21 11:30 UTC (11 hours ago)
| zoenolan wrote:
| https://www.nand2tetris.org/
|
| As a good refresher on assembly and compilers
| oldmanludd wrote:
| OpenSecurityTraining2 has some Assembly courses
|
| https://p.ost2.fyi/courses
| sargstuff wrote:
| 'Computer Architeture: A Quantitative Apporach" and/or more
| specific design types (mips, arm, etc) can be found under the
| Morgan Kaufmann Series in Computer Architeture and Design.
|
| "Getting Started with LLVM Core Libraries: Get to Grips With Llvm
| Essentials and Use the Core Libraries to Build Advanced Tools "
|
| "The Architecture of Open Source Applications (Volume 1) : LLVM"
| https://aosabook.org/en/v1/llvm.html
|
| "Tourist Guide to LLVM source code" :
| https://blog.regehr.org/archives/1453
|
| llvm home page : https://llvm.org/
|
| llvm tutorial : https://llvm.org/docs/tutorial/
|
| llvm reference : https://llvm.org/docs/LangRef.html
|
| learn by examples : C source code to 'llvm' bitcode :
| https://stackoverflow.com/questions/9148890/how-to-make-clan...
| alexdowad wrote:
| Aside from what has already been suggested, you could consider
| reading selected chapters of Intel's programmer manual. I
| personally read through the whole thing once (well, skimmed some
| parts).
|
| From my experience, Intel's x86 manual is better and easier to
| read than AMD's. It's a free download.
| t-3 wrote:
| I like this book, it's just as good as The Art of Assembly
| Language, but much cheaper:
| https://rayseyfarth.com/asm/index.html
|
| If you are interested in ARM or RISC-V assembly, the concepts are
| pretty similar but the instructions are different. For _any_
| architecture, you 're going to have to read the architecture
| manuals to get a good working knowledge of the instructions and
| how to use them. An easy way to get started is to write a program
| in C, then replace the functions with assembly code one by one
| until your C code is just main() and a header.
|
| ARMv7:
| https://developer.arm.com/documentation/100076/0200/a32-t32-...
|
| ARMv8:
| https://developer.arm.com/documentation/ddi0602/2024-03/Base...
|
| alternative: https://www.scs.stanford.edu/~zyedidia/arm64/
|
| RISC-V: https://riscv.org/technical/specifications/
|
| x86:
| https://www.intel.com/content/www/us/en/developer/articles/t...
|
| web format: http://x86.dapsen.com/
|
| If you like to learn by example (most of these are not great, but
| good enough to get started):
|
| https://rosettacode.org/wiki/Assembly
|
| https://github.com/TheAlgorithms/AArch64_Assembly
| Koshkin wrote:
| A great way to learn assembler is to closely examine code
| generated by a compiler, e.g. on godbolt.org.
| CoastalCoder wrote:
| I don't have a good book to suggest, but one tip you may find
| helpful:
|
| A typical function has two kinds of assembly code:
|
| (1) The ABI-required logic for functions and function calls, and
|
| (2) Everything else, which can be more or less whatever you want.
| As long as you don't stomp on the details required by the ABI.
| mtklein wrote:
| I'd suggest working incrementally from areas of your existing
| strength. Tweak whatever code base you are most familiar with,
| starting with a tiny change, and see how the assembly changes. I
| use objdump -d and git diff --no-index for this all the time.
| pizlonator wrote:
| 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.
| mtreis86 wrote:
| Play through the game Turing Complete, by the end you'll have
| built your own ISA and solved some puzzles with it. Keep playing
| for to get on the high scores list and you'll turn those assembly
| routines into ASICs.
___________________________________________________________________
(page generated 2024-04-21 23:00 UTC)