CFI(calling frame info)的作用是出现异常时stack的回滚(unwind)
而回滚的过程是一级级CFA往上回退,直到异常被catch。
Assembler Directives
都属于汇编的指导语。
可以看下MIT的教程:
https://web.mit.edu/rhel-doc/3/rhel-as-en-3/index.html
The call frame is identified by an address on the stack. We refer to this address as the Canonical Frame Address orCFA. Typically, the CFA is defined to be the value of the stack pointer at the call site in the previous frame (which may be different from its value on entry to the current frame).
1) .cfi_startproc
7.10.2 .cfi startproc [simple]
.cfi startproc is used at the beginning of each function that should have an entry in .eh frame.定义入口。 lt initializes some internal data structures. Don’t forget to close the function by .cfi endproc. Unless .cfi startproc is used along with parameter simple it also emits some architecture dependent initial CFl instructions.
7.10.3 .cfi endproc
cfi endproc is used at the end of a function where it closes its unwind entry previously opened by.cfi startproc and emits it to .eh frame. 对应的,结束。
2) .cfi_def_cfa_offset 16
7.10.11 .cfi def cfa offset offset
.cfi def cfa offset modifies a rule for computing CFA. Register remains the same, but offset is new. Note that it is the absolute offset that will be added to a defined register to compute CFA address
偏移指的是什么东西的偏移?没有太搞清楚。具体是内存中哪个位置?
3)
.cfi_offset 15, -16
4)包括对齐什么的。就是不知道是什么意思。什么是偏移,什么是对齐,要看具体的例子。
8.3. .align abs-expr, abs-expr, abs-expr
5)百度确实搜不出什么有用的信息来,也是醉了。
6)查手册可能更好一些,但是有些道理还是不懂。
《Intel® 64 and IA-32 Architectures Software Developer’s Manual》
7)
MOVSD Move scalar double-precision floating-point value between XMM registers or between an
XMM register and memory.
到底是mov 1个还是2个Double数据?
The MOVSD (move scalar double-precision floating-point) instruction transfers a 64-bit double-precision floatingpoint
operand from memory to the low quadword of an XMM register or vice versa, or between XMM registers.
Alignment of the memory address is not required, unless alignment checking is enabled.
movsd (%rsi), %xmm0 # 把(%rsi)地址的一个64位数据加载到xmm0的低64位。所以是加载一个标题数据到xmm0的low quadword。
8)对寄存器的介绍,这个也不错。
http://www.mokhisin.cn/c/assemble/
9)
这个编译代码调试太牛逼了
第42部分-Linux x86 64位汇编SSE指令_mb611a2e88042f6的技术博客_51CTO博客
10)
The TEST instruction performs a logical AND of two operands and sets the SF, ZF, and PF flags according to the results
jle: Jump near if less or equal (ZF=1 or SF≠ OF).
1952

被折叠的 条评论
为什么被折叠?



