x86-64 Intel 어셈블리의 배열에 값을 입력하려고하는데이를 이해할 수 없습니다.x86-64 배열 입력 및 인쇄
세그먼트를 .bss로 배열을 만듭니다. 그런 다음 r15를 사용하여 배열의 주소를 다른 모듈로 전달하려고합니다. 그 모듈 안에 배열에 삽입 할 번호를 물어 봅니다. 그러나 그것은 효과가 없습니다. 내가 inputqarary의 내부 다음
segment .bss
dataArray resq 15 ; Array that will be manipulated
segment .text
mov rdi, dataArray ; Store memory address of array so the next module can use it.
call inputqarray ; Calling inputqarray module
을 할 노력하고있어
나는이 :
mov r15, rdi ; Move the memory address of the array into r15 for safe keeping
push qword 0 ; Make space on the stack for the value we are reading
mov rsi, rsp ; Set the second argument to point to the new locaiton on the stack
mov rax, 0 ; No SSE input
mov rdi, oneFloat ; "%f", 0
call scanf ; Call C Standard Library scanf function
call getchar ; Clean the input stream
pop qword [r15]
그때
push qword 0
mov rax, 1
mov rdi, oneFloat
movsd xmm0, [dataArray]
call printf
pop rax
을 수행하여 출력을 이용하여 입력 한 값을 시도
불행히도 출력물을 얻는 건 0.00000
입니다.
정말 고마워요. 나는 네가 나보다 다르게 한 것을 정말로 모르지만 지금은 효과가있다. 나는 모르는 것이 불편하다. '% f'에서 '% lf'(으)로 서식을 수정했습니다. 바로 그 문제를 해결하지 못했습니다. 나는 코드를 지우고 거기에있는 것을 천천히 만들었고 나에게도 똑같이 보였다. 팁을 어레이에 직접로드하는 것에 대해 감사드립니다. 그리고 네, 그렇게 많은 기억을 할당하려고했습니다. 어셈블리에서 직접 배열을 만드는 중입니다. – RNikoopour