当我尝试编译代码时出现这些错误,我不知道为什么。任何人都可以帮助我。我正在写AT& T语法 错误:错误垃圾'(rbp)在inout子例程中用***指出的行上表达后
代码:
.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