80387如何编程?是否需要处理异常?

bailingke 2008-04-22 10:57:20
各位大虾,本人正在调试一块CPU,为80386EX+80387架构。调试过程中,发现浮点运算经常出错,且容易挂起,失去响应。请调试过类似CPU的大虾指点一二,80387如何编程?如何初始化?是否需要处理协处理器异常?如何处理?谢谢!
...全文
130 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bailingke 2008-05-04
  • 打赏
  • 举报
回复
抱歉,最近一直在忙着调试,没空来结帖。
最后我调试出来的结论是硬件问题,搞硬件的同事把387的READY信号没有处理好,所以一运行浮点指令就出错。后来把READY信号的针脚去掉,浮点运算才恢复正常,确实不需要处理什么异常。
好了,马上结帖。
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
支持搂主,收藏
cnzdgs 2008-04-27
  • 打赏
  • 举报
回复
LZ在网上搜索一下可以找到更详细的解释。大体做法是把操作数装入FPU,然后进行运算并等待结果,运算完后取回结果。初始化用FINIT指令。异常好象是当不存在FPU时才会发生,应该不用处理。
cnzdgs 2008-04-27
  • 打赏
  • 举报
回复
浮点指令集:

x87浮点运算处理单元指令支持浮点数,整数,BCD操作数.
X87浮点运算处理单元数据传输指令集
FLD
Load floating-point value
FST
Store floating-point value
FSTP
Store floating-point value and pop
FILD
Load integer
FIST
Store integer
FISTP1
Store integer and pop
FBLD
Load BCD
FBSTP
Store BCD and pop
FXCH
Exchange registers
FCMOVE
Floating-point conditional move if equal
FCMOVNE
Floating-point conditional move if not equal
FCMOVB
Floating-point conditional move if below
FCMOVBE
Floating-point conditional move if below or equal
FCMOVNB
Floating-point conditional move if not below
FCMOVNBE
Floating-point conditional move if not below or equal
FCMOVU
Floating-point conditional move if unordered
FCMOVNU
Floating-point conditional move if not unordered
X87浮点运算处理单元基本算术指令集
FADD
Add floating-point
FADDP
Add floating-point and pop
FIADD
Add integer
FSUB
Subtract floating-point
FSUBP
Subtract floating-point and po
FISUB
Subtract integer
FSUBR
Subtract floating-point reverse
FSUBRP
Subtract floating-point reverse and po
FISUBR
Subtract integer reverse
FMUL
Multiply floating-point
FMULP
Multiply floating-point and pop
FIMUL
Multiply integer
FDIV
Divide floating-point
FDIVP
Divide floating-point and pop
FIDIV
Divide integer
FDIVR
Divide floating-point reverse
FDIVRP
Divide floating-point reverse and pop
FIDIVR
Divide integer reverse
FPREM
Partial remainder
FPREM1
IEEE Partial remainder
FABS
Absolute value
FCHS
Change sign
FRNDINT
Round to integer
FSCALE
Scale by power of two
FSQRT
Square root
FXTRACT
Extract exponent and significand
X87浮点运算处理单元比较指令集
FCOM
Compare floating-point
FCOMP
Compare floating-point and pop
FCOMPP
Compare floating-point and pop twice
FUCOM
Unordered compare floating-point
FUCOMP
Unordered compare floating-point and pop
FUCOMPP
Unordered compare floating-point and pop twice
FICOM
Compare integer
FICOMP
Compare integer and pop
FCOMI
Compare floating-point and set EFLAGS
FUCOMI
Unordered compare floating-point and set EFLAGS
FCOMIP
Compare floating-point, set EFLAGS, and pop
FUCOMIP
Unordered compare floating-point, set EFLAGS, and pop
FTST
Test floating-point (compare with 0.0)
FXAM
Examine floating-point
x87 浮点运算处理单元超越函数指令集
FSIN
Sine
FCOS
Cosine
FSINCOS
Sine and cosine
FPTAN
Partial tangent
FPATAN
Partial arctangent
F2XM1
2x 1
FYL2X
Y*log2x
FYL2XP1
Y*log2(x+1)
x87 浮点运算处理单元常数装载指令集
FLD1
Load +1.0
FLDZ
Load +0.0
FLDPI
Load π
FLDL2E
Load log2e
FLDLN2
Load loge2
FLDL2T
Load log210
FLDLG2
Load log102
x87 浮点运算处理单元控制指令集
FINCSTP
Increment FPU register stack pointer
FDECSTP
Decrement FPU register stack pointer
FFREE
Free floating-point register
FINIT
Initialize FPU after checking error conditions
FNINIT
Initialize FPU without checking error conditions
FCLEX
Clear floating-point exception flags after checking for error conditions
FNCLEX
Clear floating-point exception flags without checking for error conditions
FSTCW
Store FPU control word after checking error conditions
FNSTCW
Store FPU control word without checking error conditions
FLDCW
Load FPU control word
FSTENV
Store FPU environment after checking error conditions
FNSTENV
Store FPU environment without checking error conditions
FLDENV
Load FPU environment
FSAVE
Save FPU state after checking error conditions
FNSAVE
Save FPU state without checking error conditions
FRSTOR
Restore FPU state
FSTSW
Store FPU status word after checking error conditions
FNSTSW
Store FPU status word without checking error conditions
WAIT/FWAIT
Wait for FPU
FNOP
FPU no operation
bailingke 2008-04-27
  • 打赏
  • 举报
回复
我是在做嵌入式开发,没有操作系统支持的,也没有用到线程。请大虾们继续指点啊
明天结帖了!
cnzdgs 2008-04-23
  • 打赏
  • 举报
回复
可能要在纯DOS环境下调试,以免其它线程干扰。

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧