现在的位置: 首页 > 综合 > 正文

AT&T汇编语言笔记

2013年09月08日 ⁄ 综合 ⁄ 共 691字 ⁄ 字号 评论关闭

1。在gcc产生的汇编中,$0x80498d4表示立即数,而0x80498d4表示内存地址0x80498d4对应的内容。对于lable,比如value,则$value表示value的地址,value表示value的值。设函数func的地址
&func = 0x8048828
这两种调用都是一样的
1) call 0x8048828
2) movl $0x8048828 %edx
    call *%edx

 2.如果寄存器存的是一个地址,就说这个寄存器是一个指针,加括号表示取这个指针所指的对象

int w = 5;

movl &w %edx    //%edx = &w,%edx是一个指针

movl (%edx) %eax        //%eax = *&w = w = 5

 3.base_address(offset_address, index, size) = base_address + offset_address + index * size

 4.movb:取1个字节,movw:取2个字节,movl:取4个字节

5.8个32bit的通用寄存器及其作用

EAX Accumulator for operands and results data

EBX Pointer to data in the data memory segment

ECX Counter for string and loop operations

EDX I/O pointer

EDI Data pointer for destination of string operations

ESI Data pointer for source of string operations

ESP Stack pointer

EBP Stack data pointer

抱歉!评论已关闭.