|
本帖最后由 布衣木人 于 2021-10-11 14:21 编辑
一、常用寄存器
EAX -Extend Accumulator Register累加器寄存器
ECX -Extend Counter Register计数器寄存器
EDX -Extend Data Register数据寄存器
EBX -Extend Base Register基本注册
ESP -Extend Stack Pointer堆栈指针
EBP -Extend Base Pointer基本指针
ESI -Extend Source Index来源索引
EDI -Extend Destination Index目标索引
Status Flags:
Carry flag — Set if an arithmetic operation generates a carry or a borrow out of the mostsignificantbit of the result;
cf如果运算中在最高位发生进位或借位,cf设为1。
Parity flag — Set if the least-significant byte of the result contains an even number of 1 bits;
pf如果运算结果中最低字节的1的个数为偶数则pf置1。
Auxiliary Carry flag — Set if an arithmetic operation generates a carry or a borrow out of bit 3 of the result;
af如果运算中在第三位发生了进位或借位,af设为1.
Zero flag — Set if the result is zero;
zf运算结果为0,则zf置1;
Sign flag — Set equal to the most-significant bit of the result, which is the sign bit of a signedinteger. (0 indicates a positive value and 1 indicates a negative value.)
sf符号标志位,正数设置为0,负数设置为1.
Overflow flag — Set if the integer result is too large a positive number or too small a negativenumber (excluding the sign-bit) to fit in the destination operand;
of溢出标志位。
二、常用汇编指令
1、逻辑指令
and指令在两个操作数的对应位之间进行逻辑与操作,并将结果存放在目标操作数中:
and destination,source
两个操作数必须大小一直,同时对应的两个位都是1,则为1,否则为0;
or指令在两个操作数的对应位之间进行逻辑或操作,并将结果存放在目标操作数中:
or destination,source
两个操作数必须大小一直,同时对应的两个位都是0,则为0,否则为1;
xor指令在两个操作数的对应位之间进行逻辑异或操作,并将结果存放在目标操作数中:
xor destination,source
两个操作数必须大小一直,同时对应的两个位值相同,则为0,不同则为1;
not指令倒置操作数中的所有位,即0变1,1变0,。
2、比较指令
test指令在两个操作数的对应位之间进行and操作,并根据运算结果设置符号标志位、零标志位和奇偶标志数。test指令与and指令不同的地方是,是test指令不修改目标操作数。
cmp指令用于比较整数,执行从目的操作数中减去源操作数的隐含减法操作,并且不修改任何操作数。
cmp destination,source
cmp结果 | zf | cf | 目标操作数<源操作数 | 0 | 0 | 目标操作数>源操作数 | 0 | 0 | 目标操作数=源操作数 | 1 | 0 |
3、运算操作指令
mov destination,source
movsx reg32,reg/mem扩展并传送
lea指令返回间接操作数的地址。
xchg 交换指令
inc reg/mem 增加1
dec reg/mem 减少1
add destination,source 增加
sub destination,source 减少
neg(非)指令把操作数转换为其二进制补码,将操作数的符号取反。
mul/imul
被乘数 | 乘数 | 乘积 | al | reg/mem8 | ax | ax | reg/mem16 | dx:ax | eax | reg/mem32 | edx:eax |
div/idiv类似于乘法
4、堆栈
push指令首先减少esp的值,再将源操作数复制到堆栈。
pop指令先把esp指向的堆栈内容复制到一个操作数中,再增加esp的值。
衍生的pushad与popad通常保存寄存器环境时用到。
call 指令通常把返回值放在eax中。
ret
5、跳转指令
jmp 直接跳转
jcc 条件跳转
基础的基本就这些,至于函数调用的栈关系图、调用关系、pe结构对初期影响不大,用到了再学。 |
评分
-
查看全部评分
上一篇: 学习破解记录1下一篇: 学习破解 3
|