ASM错误消息:`(RAX%,%edx中,4)'不是一个有效的基本/指数前pression [英] asm error message: `(%rax,%edx,4)' is not a valid base/index expression
问题描述
:96:错误:'(%RAX,EDX%,4)'不是一个有效的基本/指数前pression
:96: Error: `(%rax,%edx,4)' is not a valid base/index expression
line97:错误:`-4(RAX%,%edx中,4)'不是一个有效的基本/指数前pression
line97: Error: `-4(%rax,%edx,4)' is not a valid base/index expression
line101:错误:`(RAX%,%edx中,4)'不是一个有效的基本/指数前pression
line101: Error: `(%rax,%edx,4)' is not a valid base/index expression
line102:错误:`-4(RAX%,%edx中,4)'不是一个有效的基本/指数前pression
line102: Error: `-4(%rax,%edx,4)' is not a valid base/index expression
我得到这些错误信息,我不知道如何解决它。
I get these error messages and am not sure how to fix it.
这是我的code:
__asm__ (
"loop: \n\t"
"movl $1,%3\n\t"
"movl $0, %6\n"
"start: \n\t"
"movl (%1,%3,4),%4\n\t"
"movl -4(%1, %3, 4), %5\n\t"
"cmpl %4, %5\n\t"
"jle next\n\t"
"xchgl %4, %5\n\t"
"movl %4, (%1, %3, 4)\n\t"
"movl %5, -4(%1, %3, 4)\n\t"
"movl $1, %6\n\t"
"next: \n\t"
"incl %3 \n\t"
"cmpl %3, %2\n\t"
"jge start\n\t"
"cmpl $0, %6\n\t"
"je end\n\t"
"jmp loop\n\t"
"end: \n\t"
一些帮助说明如何解决这些错误信息,请。
我试图在ASM冒泡排序。
Some help explaining how to fix these error message, please. I am trying to make a bubble sort in ASM.
推荐答案
您没有说你的目标是什么处理器,但它似乎是64位。在x64上,(%RAX,EDX%,4)
不是合法的组合。请查阅有效的寻址模式列表中的处理器手册。我的猜测是,你的意思是(%RAX,RDX%,4)
。
You didn't say what processor you are targeting, but it appears to be x64. On x64, (%rax, %edx, 4)
is not a legal combination. Consult the processor manual for a list of valid addressing modes. My guess is that you meant (%rax, %rdx, 4)
.
这篇关于ASM错误消息:`(RAX%,%edx中,4)'不是一个有效的基本/指数前pression的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!