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

how to use parameters of function C to rotate right in Assembly code

为什么在从 C 调用函数 Assembly 时我不能在 Assembly 代码的 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; 
}

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

来自RCL/RCR/ROL/ROR — Rotate

(英特尔语法):

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. |`