尝试将放置在浮点堆栈上的值除以整数值
我在调用fidiv之前检查了我的值,我得到了一个段错误,这里有明显的错误吗?
我评论了一些行,因为我现在正在调试
esubprogram:
push eax
fstp qword[ebp] ;copy contents of st0 onto ebp ;checked to see if values where right
mov eax, esi ;move precision number into ebx ;checked to see if values where right
push eax
call factorial ;get the factorial value
mov edx, eax ;move factorial value into edx
fld qword [ebp] ;move value of ebp onto floating point stack
fidiv dword [edx] ;divide ebp value by edx value
; fstp qword [edi] ;move divided value into edi, and pop it off the FPS
; mov eax, edi
pop eax
pop eax
ret
答案 0 :(得分:1)
是的,您要除以edx指向的值。这是一个错误,因为edx不是指针,而是一个值。
lea someaddresswithspaceforfourbytes, esi
mov [esi], edx
fidiv dword[esi] ;divide ebp value by the value at esi
我不知道你是否用现有地址初始化了ebp,如果没有,这可能会导致另一个错误。