Assembly 美国电话电报公司;T语法错误:垃圾';(限制性商业惯例)和#x27;组装incq-8(rbp)时表达后
我在编译代码时遇到了这些错误,我不知道为什么。谁能帮帮我吗。我在用AT&T的语法写作 错误:inout子例程中带***的行上的表达式后出现错误垃圾(rbp) 代码:Assembly 美国电话电报公司;T语法错误:垃圾';(限制性商业惯例)和#x27;组装incq-8(rbp)时表达后,assembly,x86-64,att,Assembly,X86 64,Att,我在编译代码时遇到了这些错误,我不知道为什么。谁能帮帮我吗。我在用AT&T的语法写作 错误:inout子例程中带***的行上的表达式后出现错误垃圾(rbp) 代码: .text #section directive intended to hold all instructions formatint: .asciz "%ld" formatstr: .asciz "%s" #format string for string prin
.text #section directive intended to hold all instructions
formatint: .asciz "%ld"
formatstr: .asciz "%s" #format string for string printing, the s stands for string
DNNIDA: .asciz "names: x and y \nnetID's: xID and yID\nThis is assignment 1b inout\n"
enter: .asciz "\n"
.global main #this is the main label
main:
movq $0, %rax #no vector registers in use for printf (labmanual)
movq $formatstr, %rdi
movq $DNNIDA, %rdi #load adress of string to rdi register
call printf #printing the string that is displayed on top
call inout #calling the inout subroutine
movq $0, %rax #no vector registers in use for printf (labmanual)
movq $formatstr, %rdi
movq $enter, %rdi #load the adress off the next string into rdi register
call printf #printing the enter string (a return)
call end
end:
mov $0, %rdi #load program exit code
call exit #exiting the program
inout:
pushq %rbp #Prologue: push the base pointer
movq %rsp, %rbp #copy stack pointer to RBP
subq $8, %rsp #reserve stack space for variable
leaq -8(%rbp), %rsi #load adress of stack var in rsi
movq $formatint, %rdi #load first argument of scanf
movq $0, %rax #no vector registers in use for printf (labmanual)
call scanf #call scanf
movq $formatint, %rdi
movq $0, %rax #no vector registers in use for printf (labmanual)
***incq -8(rbp) #increments the number by one
***movq -8(rbp), %rsi #move a return value into RAX
call printf #call printf
movq %rbp, %rsp #Epilogue: clear local variables from stack
popq %rbp #Restore caller's base pointer
ret #returns from subroutine
我认为
%
丢失了。我在哪里丢失了%?发生错误的行是您使用rbp
而不是%rbp
的唯一行。是的,谢谢。我想我拿到的手册有错误。Anways THANKS没有问题:)我对AT&T的语法不是很精通,但这似乎很奇怪。我认为%
丢失了。我在哪里丢失了%?发生错误的行是您使用rbp
而不是%rbp
的唯一行是的,谢谢。我想我拿到的手册有错误。Anways thanksNo问题:)我对AT&T的语法不是很精通,但这似乎很奇怪。