开发者

What x86 register denotes source location in movsb instruction?

What x86 register den开发者_C百科otes source location in movsb instruction?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜