周梦康 发表于 2019-08-20 983 次浏览 标签 : 汇编

原文地址:https://www3.nd.edu/~dthain/courses/cse40243/fall2015/intel-intro.html

  • Directives begin with a dot and indicate structural information useful to the assembler, linker, or debugger. but are not in and of themselves assembly instructions. For example, .file simply records the name of the original source file. .data indicates the start of the data section of the program, while .text indicates the start of the actual program code. .string indicates a string constant within the data section, and .globl main indicates that the label main is a global symbol that can be accessed by other code modules. (You can ignore most of the other directives.)
  • Labels end with a colon and indicate by their position the association between names and locations. For example, the label .LC0: indicates that the immediately following string should be called .LC0. The label main: indicates that the instruction pushq %rbp is the first instruction of the main function. By convention, labels beginning with a dot are temporary local labels generated by the compiler, while other symbols are user-visible functions and global variables.
  • Instructions are the actual assembly code (pushq %rbp), typically indented to visually distinguish them from directives and labels.

大多数生产编译器使用混合模式:32位寄存器通常用于整数算术,因为大多数程序不需要大于2^32(42亿)的整数值。64位寄存器通常用于保存内存地址(指针),支持最多16EB (exa-bytes)的虚拟内存寻址。

https://www.cnblogs.com/bangerlee/archive/2012/05/22/2508772.html

pushq   %rbp        ; Save address of previous stack frame
movq    %rsp, %rbp  ; Address of current stack frame
subq    $16, %rsp   ; Reserve 16 bytes for local variables

; ... function ...

movq    %rbp, %rsp  ; \ equivalent to the
popq    %rbp        ; / 'leave' instruction
ret

https://0xax.github.io/asm_3/

国内找到一篇翻译版
https://blog.csdn.net/pro_technician/article/details/78173777

评论列表