Storing and Loading Strings
来源:互联网 发布:redis可视化工具 知乎 编辑:程序博客网 时间:2024/05/15 22:39
Besides moving strings from one memory location to another, there are also instructions for loading string values in memory into registers, and then back into memory locations.
This section describes the STOS and LODS instructions that are used for this purpose.
The LODS instruction
The LODS instruction is used to move a string value in memory into the EAX register
LODSB: Loads a byte into the AL register
LODSW: Loads a word (2 bytes) into the AX register
LODSL: Loads a doubleword (4 bytes) into the EAX register
The LODS instructions use an implied source operand of the ESI register.
The ESI register must contain the memory address of the location of the string to load.
The LODS instruction increments or decrements (depending on the DF flag status) the ESI register by the amount of data loaded after the data is moved.
The STOS instruction
After the LODS instruction is used to place a string value in the EAX register, the STOS instruction can be used to place it in another memory location.
❑ STOSB: Stores a byte of data from the AL register
❑ STOSW: Stores a word (2 bytes) of data from the AX register
❑ STOSL: Stores a doubleword (4 bytes) of data from the EAX register
The STOS instruction uses an implied destination operand of the EDI register.
This section describes the STOS and LODS instructions that are used for this purpose.
The LODS instruction
The LODS instruction is used to move a string value in memory into the EAX register
LODSB: Loads a byte into the AL register
LODSW: Loads a word (2 bytes) into the AX register
LODSL: Loads a doubleword (4 bytes) into the EAX register
The LODS instructions use an implied source operand of the ESI register.
The ESI register must contain the memory address of the location of the string to load.
The LODS instruction increments or decrements (depending on the DF flag status) the ESI register by the amount of data loaded after the data is moved.
The STOS instruction
After the LODS instruction is used to place a string value in the EAX register, the STOS instruction can be used to place it in another memory location.
❑ STOSB: Stores a byte of data from the AL register
❑ STOSW: Stores a word (2 bytes) of data from the AX register
❑ STOSL: Stores a doubleword (4 bytes) of data from the EAX register
The STOS instruction uses an implied destination operand of the EDI register.
When the STOS instruction is executed, it will either increment or decrement the EDI register value by the data size used.
.section .dataspace:.ascii “ “.section .bss.lcomm buffer, 256.section .text.globl _start_start:nopleal space, %esileal buffer, %edimovl $256, %ecxcldlodsbrep stosbmovl $1, %eaxmovl $0, %int $0x80
阅读全文
0 0
- Storing and Loading Strings
- Storing Information: Variables and Constants in C (一)
- Storing Information: Variables and Constants in C (二)
- Storing Information: Variables and Constants in C (三)
- This script allows capturing and storing occured errors
- Storing and Searching for Data 数据存储和搜索
- android-Storing and Searching for Data,Remaining Backward Compatible
- Strings and Regular Expressions
- NLS strings and JNI
- A. Petya and Strings
- Arrays and Strings----1
- Arrays and Strings----3
- Arrays and Strings----4
- Arrays and Strings----7
- Learning and treatment strings
- [贪心]cf226bBear and Strings
- B. Bear and Strings
- Vitaly and Strings
- JQuery学习(1)
- hdu1049 Climbing Worm(C语言)
- SpringBoot9-Spring MVC-Spring MVC高级配置
- Tips3 编写测试用例
- nginx(虚拟主机配置、ip、域名、端口号)
- Storing and Loading Strings
- C语言 基本数据类型
- 小明の魔法计划
- ARM开发(3)基于STM32的矩阵键盘控制蜂鸣器
- 用Opencv实现简单的图片翻页
- MySQL索引底层数据结构
- JSP案例_Cookie传值
- 重学设计模式——中介者模式
- canvas 穿透效果