我在x64程序集(masm)中编写了一个过程,当代码的执行到达ret语句时,出现此错误:HW04_Q01.exe中的0x00007FF69997AA5C抛出异常:0xC0000005:访问冲突读取位置0xFFFFFFFFFFFFFFFFFF。发生
getSquareRoot proc
.data?
temp2 complex <>
a real8 ?
b real8 ?
x real8 ?
.data
zero real8 0.0
_two real8 2.0
minusOne real8 -1.0
.code
movsd xmm0, real8 ptr [rsi]
movsd xmm1, real8 ptr [rsi + 8]
movsd a, xmm0
movsd b, xmm1
mulsd xmm0, a
mulsd xmm1, b
movsd xmm2, xmm0
addsd xmm2, xmm1
movsd x, xmm2
movsd xmm1, b
_IF:
ucomisd xmm1, zero
jb _else
movsd xmm0,x
call sqrt
addsd xmm0, a
divsd xmm0, _two
call sqrt
movsd temp2.real, xmm0
movsd xmm0,x
call sqrt
movsd xmm1, minusOne
mulsd xmm1, a
addsd xmm0, xmm1
divsd xmm0, _two
call sqrt
movsd temp2.imag, xmm0
jmp _endIf
_else:
movsd xmm0,x
call sqrt
addsd xmm0, a
divsd xmm0, _two
call sqrt
movsd temp2.real, xmm0
movsd xmm0,x
call sqrt
movsd xmm1, minusOne
mulsd xmm1, a
addsd xmm0, xmm1
divsd xmm0, _two
call sqrt
mulsd xmm0, minusOne
movsd temp2.imag, xmm0
_endIf:
movsd xmm0, temp2.real
movsd xmm1, temp2.imag
ret
getSquareRoot endp
答案 0 :(得分:0)
实际上,我将每个对sqrt()C函数的调用都替换为助记符sqrtsd,因为我处理的所有值都存储在SSE寄存器(xmm0,xmm1,xmm2等)中,并且可以正常工作