【Hacker News搬运】问HN:哪些书籍/资源可以理解现代汇编?
-
Title: Ask HN: Which books/resources to understand modern Assembler?
问HN:哪些书籍/资源可以理解现代汇编?
Text: 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?
我想了解更多关于汇编程序的知识,以便能够使用LLVM和JIT以及编写高性能的低级代码。我熟悉x86的基础知识,但我已经有一段时间没有接触过Assembler了,所以我想知道你会推荐哪些资源,尤其是书籍?
Url:
Post by: throwaway63467
Comments:
jstrieb: Not specific to LLVM or JIT, but if you want a visceral intuition for the basics of ARM assembly, I made a free, online game at work (for mobile and desktop) that may help you:<p><a href="https://ofrak.com/tetris/" rel="nofollow">https://ofrak.com/tetris/</a><p>I didn't do much ARM before working on the game, but since playing a lot, I'm very quick at reading disassembly, even for instructions not present in the game. It might help you to do the same – the timed game aspect forces you to learn to read the instructions quickly.<p>The game is like Tetris, but the blocks are ARM assembly instructions. As instructions fall, you can change the operand registers. Locking instructions into the .text section executes them in a CPU emulator running client-side in the browser, so you can immediately see the effects of every action. Your score is stored in memory at the address pointed to by one of the registers, so even though you earn points for each instruction executed without segfaulting, the true goal is to execute instructions that directly change the memory containing the score value.<p>When I released it a bit less than a year ago, I posted it to Hacker News as a Show HN:<p><a href="https://news.ycombinator.com/item?id=37083309">https://news.ycombinator.com/item?id=37083309</a>
jstrieb: 不是LLVM或JIT特有的,但如果你想对ARM汇编的基本知识有一个发自内心的直觉,我制作了一个免费的在线游戏(适用于移动和桌面),它可能会帮助你:/;ofrak.com/;俄罗斯方块</a> <p>我没有;在玩游戏之前,我不会做太多ARM,但由于玩了很多,我;我阅读拆解的速度很快,即使是游戏中没有的说明。它可能会帮助你做同样的事情——定时游戏方面迫使你学会快速阅读说明<p> 游戏就像俄罗斯方块,但方块是ARM汇编指令。随着指令的下降,您可以更改操作数寄存器。将指令锁定到.text部分将在浏览器客户端运行的CPU模拟器中执行,因此您可以立即看到每个操作的效果。您的分数存储在其中一个寄存器所指向的地址处的内存中,因此,即使您在没有分段错误的情况下执行的每条指令都能获得分数,但真正的目标是执行直接更改包含分数值的内存的指令<p> 当我在不到一年前发布它时,我将它作为一个Show HN:<p><a href=“https://;/;News.ycombinator.com/?id=37083309”>https://发布到了Hacker News/;news.ycombinator.com/;项目id=37083309</a>
rramadass: Not specific to LLVM/JIT but for assembly checkout the books by Larry Pyeatt(ARM) and Daniel Kusswurm(x86).
rramadass: 不特定于LLVM;JIT,但用于组装的检查由Larry Pyeatt(ARM)和Daniel Kussworm(x86)编写。
sargstuff: '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.<p>"Getting Started with LLVM Core Libraries: Get to Grips With Llvm Essentials and Use the Core Libraries to Build Advanced Tools "<p>"The Architecture of Open Source Applications (Volume 1) : LLVM" <a href="https://aosabook.org/en/v1/llvm.html" rel="nofollow">https://aosabook.org/en/v1/llvm.html</a><p>"Tourist Guide to LLVM source code" : <a href="https://blog.regehr.org/archives/1453" rel="nofollow">https://blog.regehr.org/archives/1453</a><p>llvm home page : <a href="https://llvm.org/" rel="nofollow">https://llvm.org/</a><p>llvm tutorial : <a href="https://llvm.org/docs/tutorial/" rel="nofollow">https://llvm.org/docs/tutorial/</a><p>llvm reference : <a href="https://llvm.org/docs/LangRef.html" rel="nofollow">https://llvm.org/docs/LangRef.html</a><p>learn by examples : C source code to 'llvm' bitcode : <a href="https://stackoverflow.com/questions/9148890/how-to-make-clang-compile-to-llvm-ir#9149406" rel="nofollow">https://stackoverflow.com/questions/9148890/how-to-make-clan...</a>
sargstuff: ';计算机体系结构:一个定量的预言;和/F;或者更具体的设计类型(mips、arm等)可以在Morgan Kaufmann系列的计算机架构和设计中找到<p> ”;LLVM核心库入门:掌握LLVM Essentials并使用核心库构建高级工具"<p> ”;开放源代码应用程序的体系结构(第1卷):LLVM“<a href=“https://;/;aosabok.org//,en-/!v1/:llvm.html”rel=“nofollow”>https:///;aosabook.org/;en;v1;llvm.html</a><p>";LLVM源代码旅游指南”:<a href=“https:#x2F;/;blog.regehr.org/!archivess/:1453”rel=“nofollow”>https://;blog.regehr.org/;档案;1453</a><p>llvm主页:<a href=“https://;/;llvm.org/”rel=“nofollow”>https:///;llvm.org/</a> <p>llvm教程:<a href=“https://;/;llvm.org//,docs/!tutorial/”rel=“nofollow”>https:///;llvm.org/;docs/;教程/</a> <p>llvm参考:<a href=“https://;/;llvm.org/!docs/:LangRef.html”rel=“nofollow”>https:///;llvm.org/;docs/;LangRef.html</a><p>通过示例学习:;llvm;位代码:<a href=“https://;/;stackoverflow.com/问题/:9148890/如何使clang编译为llvm ir#9149406”rel=“nofollow”>https:///;stackoverflow;问题;9148890;如何使氏族</一
chc4: IMO You should just stick some programs in Ghidra/Godbolt and see what they emit, especially for small individual snippets whenever you think "I want to do X, what's the best way of doing it". There really isn't much difference between "baby's first assembly" program, where you just have movs and like five other common instructions, and the kind of assembly an optimizing compiler emits: it's a matter of recognizing that some operations can be merged into a more specialized one or the addressing mode of another, or you can use a setcc with a results flag from something you already computed, or what have you. The good code that LLVM and JITs emit for the most part aren't due to much better instruction selection but due to much better optimization passes, which learning more about assembly doesn't help with: it's about transforming code in general at a high level, which you would do at the compiler IR step before touching assembly at all.
chc4: IMO你应该把一些程序放在Ghidra/;Godbolt,看看它们发出了什么,尤其是当你想到“;我想做X,什么;it’这是最好的方法;。真的没有;在“;婴儿;s的第一个组件”;程序,其中只有mov和其他五条常见指令,以及优化编译器发出的程序集类型:;这是一个认识到一些操作可以合并到更专业的操作或另一个操作的寻址模式中的问题,或者您可以使用带有来自您已经计算过的结果标志的setcc,或者您已经计算出的结果标志。LLVM和JIT在大多数情况下发出的好代码是;t,这是由于更好的指令选择,但由于更好的优化通过,学习更多关于组装的知识不等于;t帮助:it;这是关于一般在高级别上转换代码,在接触汇编之前,您将在编译器IR步骤中进行转换。
jmspring: Under no circumstances should knowledge of Assembler be needed to work with LLMs.<p>Many people that work in DS/ML can barely make it with Python.
jmspring: 在任何情况下,使用LLM都不需要了解汇编程序<p> 许多在DS中工作的人;ML几乎无法使用Python。