《64位汇编艺术》
The Art of 64-bit Assembly

原始链接: https://nostarch.com/art-64-bit-assembly-v2

《64位汇编艺术》(*The Art of 64-Bit Assembly*)填补了高级编程概念与底层执行逻辑之间的鸿沟。尽管人工智能能够对虚函数表(vtables)或闭包等结构的运作方式给出看似合理的解释,但本书通过Windows环境下的指令级操作,精准地展示了这些结构的运行机制。 作者摒弃了C++、Python和Rust等语言的运行时抽象,引导读者使用MASM从零开始重构各类复杂功能。书中每一章都侧重于透明化处理,展示了如何通过显式的汇编逻辑来实现面向对象编程、结构化异常处理(SEH)、协程、并发以及Unicode处理。 本书专为那些已掌握汇编基础、并渴望精通机器运作背后的“原理”与“逻辑”的读者而设计。它助你摆脱盲目认知,建立起真正的专业能力;教你通过直接管理处理器和Windows操作系统的底层机制,来构建稳健且高性能的系统。

这段 Hacker News 讨论澄清了 Windows vtable(虚函数表)布局并非内核 ABI(应用程序二进制接口)的一部分,而是由 MSVC(Microsoft Visual C++)编译器确立的一种约定。 参与者指出,虽然操作系统本身主要通过 C 语言链接进行交互,使得 vtable 在内核层面变得无关紧要,但在 Windows 上运行的软件通常依赖 MSVC ABI 来确保兼容性。从技术上讲,开发者可以自由地在自己的编译器中实现自定义的 ABI 约定;然而,这样做会使代码变得孤立,因为它无法与标准的 Windows 二进制文件兼容。归根结底,vtable 结构是特定于编译器的实现细节,而非 Windows 系统的正式要求。
相关文章

原文

Download Chapter 1: Advanced Macros

You can ask an AI to explain how vtables work in x86. It will give you something that sounds right. What it won’t give you is what Windows actually expects the vtable to look like, why method dispatch behaves the way it does at the instruction level, or what breaks when you deviate from convention. This volume of The Art of 64-Bit Assembly closes the gap between a plausible explanation and genuine understanding.

Every chapter takes a construct you’ve used in C++, Python, or Rust, strips away the runtime, and rebuilds it from scratch in MASM, running under Windows. Objects, exceptions, closures, coroutines, concurrency: Each is dissected at the instruction level, with every decision made visible and explicit.

What you’ll build:

  • Object-oriented programs in MASM: vtables, method dispatch, and inheritance, from scratch by hand
  • Windows structured exception handling (SEH) installed and managed at the instruction level
  • Thunks, closures, and iterators that behave like higher-order functions
  • Coroutines, generators, and fibers without resorting to HLL code
  • Concurrent programs with real synchronization primitives, directly from assembly
  • Unicode string handling done correctly, at the level where most code gets it wrong
  • Domain-specific macro languages inside MASM, built from first principles

If you already know assembly and want to stop taking the hard parts on faith, this is the book.

联系我们 contact @ memedata.com