哪个 x86 寄存器表示 movsb 指令中的源位置?

发布于 2024-09-26 06:40:27 字数 34 浏览 0 评论 0原文

哪个 x86 寄存器表示 movsb 指令中的源位置?

What x86 register denotes source location in movsb instruction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

允世 2024-10-03 06:40:27

在 32 位模式下,esi

具体来说,movsb 将一个字节从 ds:esi 复制到 es:edi,然后递增或递减两个 esi和 edi 减 1,具体取决于方向标志 (DF)。

英特尔的手册对每条指令都有详细的参考条目。
PDF 的 HTML 片段包含 movs,以及 rep movs

In 32-bit mode, esi.

In specific, movsb copies one byte from ds:esi to es:edi, then increments or decrements both esi and edi by 1, depending on the direction flag (DF).

Intel's manuals have a detailed reference entry for every instruction.
An HTML scrapes of the PDF has and entry for movs, and for rep movs.

满意归宿 2024-10-03 06:40:27

如何从手册中提取该信息

现在您已经登录 osdev.org,是时候通过实际学习来偿还您的道德债务了。 :-)

英特尔手册第 2 卷指令集参考 - 325383-056US 2015 年 9 月 部分“MOVS/ MOVSB/MOVSW/MOVSD/MOVSQ - 将数据从字符串移动到字符串”说:

将第二个操作数(源操作数)指定的字节、字或双字移动到指定的位置
与第一个操作数(目标操作数)。源操作数和目标操作数都位于内存中。这
源操作数的地址从 DS:ESI 或 DS:SI 寄存器中读取

最小测试程序

最后,您必须编写一个使用该指令的最小程序来查看您是否正确理解它:

section .data
    src db 0
    dest db 1
section .text
global _start
_start:
    mov esi, src
    mov edi, dest
    cld
    movsb
    /* dest == 0*/

带有断言的可运行版本 GitHub 上

How to extract that information from the manual

Now that you've logged into osdev.org, it's time to pay your moral debt by actually learning it. :-)

Intel Manual Volume 2 Instruction Set Reference - 325383-056US September 2015 section "MOVS/MOVSB/MOVSW/MOVSD/MOVSQ—Move Data from String to String" says:

Moves the byte, word, or doubleword specified with the second operand (source operand) to the location specified
with the first operand (destination operand). Both the source and destination operands are located in memory. The
address of the source operand is read from the DS:ESI or the DS:SI registers

Minimal test program

Finally, you must make a minimal program that uses the instruction to see if you've understood it correctly:

section .data
    src db 0
    dest db 1
section .text
global _start
_start:
    mov esi, src
    mov edi, dest
    cld
    movsb
    /* dest == 0*/

Runnable version of this with assertions on GitHub.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文