Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在汇编代码中使用函数C的参数右转_C_Assembly_X86 64_Bit Shift - Fatal编程技术网

如何在汇编代码中使用函数C的参数右转

如何在汇编代码中使用函数C的参数右转,c,assembly,x86-64,bit-shift,C,Assembly,X86 64,Bit Shift,为什么在从C调用函数汇编时不能在汇编代码的ror处使用rsi 错误:操作码和操作数的组合无效 帮帮我谢谢 汇编代码: section .text global en_code en_code: mov ax,[rdi] ror ax,rsi ;???? mov [r13],ax mov rax,r13 ret C代码: #include<stdio.h> #include<string.h> extern char* en

为什么在从C调用函数汇编时不能在汇编代码的ror处使用rsi

错误:操作码和操作数的组合无效

帮帮我谢谢

汇编代码:

section .text
   global  en_code
en_code:
    mov ax,[rdi]
    ror ax,rsi ;????
    mov [r13],ax
    mov rax,r13
    ret
C代码:

#include<stdio.h>
#include<string.h>
extern char* en_code();
int main()
{
    printf("Here:%s .\n",en_code("ng",2));
    return 0; 
}
#包括
#包括
外部字符*en_代码();
int main()
{
printf(“此处:%s.\n”,en_代码(“ng”,2));
返回0;
}

唯一采用两个寄存器的ROR组合要求移位计数在CL中。您可以旋转寄存器或内存操作数,但移位计数必须是立即的或在CL中传递

(英特尔语法):


唯一采用两个寄存器的ROR组合要求移位计数在CL中。您可以旋转寄存器或内存操作数,但移位计数必须是立即数或在CL中传递

(英特尔语法):


如果您坚持将16位输入作为内存中的引用进行旋转,而不是在寄存器本身中作为uint16返回,我会使用
mov ecx,esi
/
ror word[rdi],cl
/
mov rax,rdi
r13
不用于在x86-64 System V中传递arg,IDK为什么要从源字符串加载并通过r13存储。此外,不需要asm来获取旋转指令。C编译器可以发出它们:我没有汇编方面的经验,并试图制作一些简单的示例。如果您坚持将16位输入按引用在内存中进行旋转,而不是在寄存器本身中作为uint16返回,我将使用
mov ecx,esi
/
ror word[rdi],cl
/
mov rax,rdi
r13
不用于在x86-64 System V中传递arg,IDK为什么要从源字符串加载并通过r13存储。此外,不需要asm来获取旋转指令。C编译器可以发出它们:我没有汇编方面的经验,也没有尝试制作一些简单的示例谢谢,但我有从C传下来的参数,它的值存储在RSI中,所以我如何将它传递给CL,我尝试了/mov CL,[RSI]/但它不起作用。谢谢,但是我有一个从C传下来的参数,它的值存储在RSI中,所以我如何将它传递给CL,我尝试了/mov-CL,[RSI]/但它不起作用。
REX.W + D3 /1 | ROR r/m64, CL | MC | Valid | N.E. | Rotate 64 bits r/m64 `right CL times. Uses a 6 bit count. |`