我在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