当前位置:网站首页>No.3汇编进阶
No.3汇编进阶
2022-07-17 18:44:00 【L.Bubu】
目录
1.栈操作指令
●压栈:push
●出栈:pop
栈顶朝着0地址方向增长,寄存器esp储存栈顶地址:

1).pushw $0x88888888
该指令表示将一个两字节大小的值入栈,但是0x88888888占四个字节,该操作的结果是将0x88888888高四位的值舍弃,使其变为两个字节大小(0x8888),再将其入栈。
2).pushw value
此处value为地址,该指令表示将value后两个字节的值入栈。
3).push $value
将value的地址入栈。
4).popl %ebx
弹出四个字节的数据写入ebx。
push与pop是两个独立的操作,互不干扰。比如入栈时一次性压入四个字节的数据,出栈时可以两个两个的弹出或者以其他方式弹出。
2.算术逻辑运算指令

3.跳转与条件传送
3.1跳转指令
寄存器eip储存下一条指令的地址。
●直接跳转:jmp
●条件跳转指令:
▲条件在寄存器eflags中:

名称 | 作用 | 在eflags中位置 |
SF | 符号位 | 第7位 |
ZF | 零标志位 | 第6位 |
CF | 进位或借位 | 第0位 |
OF | 溢出 | 第11位 |
例:四位数字运算:
无符号数,最小为0000(0),最大为1111(15)
有符号数,最小为0000(-8),最大为0111(7)
x=1010(10或-6),y=0111(7)
x-y=1010 – 0111=0011(3)
ZF=0 结果不是零
CF=0 做无符号数减法时没有借位
SF=0 结果的第一位为0
OF=1 做有符号数减法时有溢出
OF位的计算:
计算机在计算时采用双符号位,在有符号数前补一个数,使其前两个数变成11/00,计算结果中,如果前两位为10/01,则有溢出;前两位为11/00则无溢出。eg:11010 – 00111=10 011 符号不是00或11
▲条件跳转指令集:

3.2有条件传送
●标志位指令:满足条件则设置相关寄存器的值。

●有条件传送:满足条件才执行传送

●条件码相关知识:
▲inc和dec指令不影响进位标志位,而add $1,%eax与sub $1,%eax等指令会影响进位标志位。
▲cmp指令是对两个数做减法,但不保留结果,仅根据结果设置标志位。
▲test指令对两个操作数做逻辑与(按位与)运算,但不保留结果。
testl $0x4,%eax #0x4=00000000 00000000 00000000 00000100
jnz #如果此例中eax的倒数第三个bit为1,则跳转。
testl %ecx, %ecx
jz #如果ecx为零,则跳转。
▲对于CF标志位,有三条专门的指令:
clc:将CF标志位清零
stc:将CF标志位设置为1
cmc:将CF标志位置反
4.循环指令
循环用两种方式实现:
1).条件跳转指令
2).loop指令
在遇到loop指令时,会判断ecx中的值是否为0,不为0则跳转至指定位置,每跳转一次ecx的值自动减一,当该值为0时跳出循环。
边栏推荐
- (pc+wap) dream weaving template clothing dress website
- Onvif protocol related: 4.1.4 WS username token method to obtain the stream address
- Computer dial-up Internet access
- [机缘参悟-46]:鬼谷子-第十谋篇-谋者,智慧之意也
- 如何优雅的升级 Flink Job?
- [code hoof set novice village question 600] format specifier of float and double
- codeforce:A. Doremy‘s IQ【反向贪心】
- Start from here by counting the information of the broadcast room
- [code hoof set novice village question 600] formatted input and output, using 0 to replace the completed space
- Codeforce:a. difference operations [mathematical thinking]
猜你喜欢

健康防猝指南3:健康保健
![[code hoof set novice village question 600] operator / type conversion in different operation sequences](/img/a0/ba793491f4b1ad1c7545968b61723e.png)
[code hoof set novice village question 600] operator / type conversion in different operation sequences

onvif协议相关:4.1.3 WS-Username token方式获取截图url

onvif协议相关:3.1.3 Digest方式获取截图url

Attachment handling of SAP Fiori

Onvif protocol related: 4.1.3 WS username token method to obtain screenshot URL

Onvif protocol related: 3.1.4 get the stream address in digest mode

「津津樂道播客」#392 原湯話原食:仲夏夜,馬砂、肉串兒、趿拉板兒
![Codeforce:a. difference operations [mathematical thinking]](/img/be/28bcb5dd8b9a36f2955f1912f289a3.png)
Codeforce:a. difference operations [mathematical thinking]

STM32F1与STM32CubeIDE编程实例-MPU-6050 六轴(陀螺仪 + 加速度计)驱动
随机推荐
OpenSSL operation
onvif协议相关:常用类说明
【7.12】Codeforces Round #806 (Div. 4)
Health prevention guide 3: health care
onvif协议相关:3.1.4 Digest方式获取流地址
Attachment handling of SAP Fiori
Onvif protocol related: 3.1.1 digest access authorization
Template virtual machine environment preparation
SSH keyless login
STL string查找子串
Onvif protocol related: common class description
torch. utils. data. Dataloader description
【7.12】Codeforces Round #806 (Div. 4)
Onvif protocol related: 4.1.3 WS username token method to obtain screenshot URL
onvif协议相关:3.1.3 Digest方式获取截图url
Li Kou's 302 weekly match
2.三数之和
Realize automatic logging
Transphorm's surface mount packaging product series adds industry standard to-263 (D2Pak) packaging products to expand the advantages of supergan platform
Some common operation commands of the command line and solutions to common errors