Linux movq ;(%rsi),%rcx有人能告诉我这是什么意思吗?

Linux movq ;(%rsi),%rcx有人能告诉我这是什么意思吗?,linux,assembly,linux-kernel,Linux,Assembly,Linux Kernel,这是../sysdeps/x86_64/memcpy.S中的一行,在这行之后我遇到了VM崩溃,所以我需要知道发生了什么。基本上我知道这有点像把rsi复制到rcx。但这是否意味着rsi和rcx本身都应该是有效地址? 因为当我输入“信息寄存器”时,我得到: 当我使用“x/s”查看地址中的内容时,我得到: (gdb) x/s 0x7fb47787e820 0x7fb47787e820: "" (gdb) x/s 0xfa7e828 0xfa7e828: <Address 0xfa7e828

这是../sysdeps/x86_64/memcpy.S中的一行,在这行之后我遇到了VM崩溃,所以我需要知道发生了什么。基本上我知道这有点像把rsi复制到rcx。但这是否意味着rsi和rcx本身都应该是有效地址? 因为当我输入“信息寄存器”时,我得到:

当我使用“x/s”查看地址中的内容时,我得到:

(gdb) x/s 0x7fb47787e820
0x7fb47787e820:  ""
(gdb) x/s 0xfa7e828
0xfa7e828:   <Address 0xfa7e828 out of bounds>
(gdb) p $rsi
$2 = 9
(gdb) x/s 0x9
0x9:     <Address 0x9 out of bounds>
如果有帮助,该行的回溯和代码如下:

(gdb) bt
#0  memcpy () at ../sysdeps/x86_64/memcpy.S:102
#1  0x00007fb484688f68 in ?? ()
#2  0x00007fb4830399d1 in start_thread (arg=0x7fb464af8700) at pthread_create.c:301
#3  0x00007fb482d86b7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) l
97  
98  L(1c):                  /* 8-byte once */
99      testb   $8, %dl
100     jz  L(1d)
101 
102     movq    (%rsi), %rcx
103     movq    %rcx, (%rdi)
104 
105     addq    $8, %rsi
106     addq    $8, %rdi
(gdb) 
107 
108     .p2align 4,, 4
109 
110 L(1d):                  /* 16-byte loop */
111     andl    $0xf0, %edx
112     jz  L(exit)
113 
114     .p2align 4
115 
116 L(1loop):

非常感谢您的宝贵时间。

GDB正在为您提供关键信息。源地址0x9超出范围,您正在告知0x9实际上是要复制的值。因此,您不是向memcpy传递有效的源地址,而是传递值

可能您传递的是一个变量
x
,而不是它的地址
&x

...
x = 9;
memcpy(destination_address, x, N); //<-- should be &x
。。。
x=9;

memcpy(目的地地址,x,N)//好啊所以我之前的问题应该是:“rsi”和“rcx”中的值,它们是实际值还是仅仅是保存该值的地址?根据你的回答,他们应该是地址。。。这里我没有使用memcpy,只是一个libvmi write函数,它最终将调用system write()函数。因此,我想我将尝试找出libvmi write()函数。(%rsi)意味着使用%rsi作为内存位置的地址。movq表示移动四字(8字节值)。
(gdb) bt
#0  memcpy () at ../sysdeps/x86_64/memcpy.S:102
#1  0x00007fb484688f68 in ?? ()
#2  0x00007fb4830399d1 in start_thread (arg=0x7fb464af8700) at pthread_create.c:301
#3  0x00007fb482d86b7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) l
97  
98  L(1c):                  /* 8-byte once */
99      testb   $8, %dl
100     jz  L(1d)
101 
102     movq    (%rsi), %rcx
103     movq    %rcx, (%rdi)
104 
105     addq    $8, %rsi
106     addq    $8, %rdi
(gdb) 
107 
108     .p2align 4,, 4
109 
110 L(1d):                  /* 16-byte loop */
111     andl    $0xf0, %edx
112     jz  L(exit)
113 
114     .p2align 4
115 
116 L(1loop):
...
x = 9;
memcpy(destination_address, x, N); //<-- should be &x