home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9286 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  2.4 KB

  1. From: huck@aspen.NSA.HP.COM (Jerry Huck)
  2. Date: Thu, 13 Aug 1992 21:51:30 GMT
  3. Subject: Re: signal behaviour differs between hp9000 machines
  4. Message-ID: <2130058@aspen.NSA.HP.COM>
  5. Organization: HP Networked Systems Architecture - Cupertino, CA
  6. Path: sparky!uunet!wupost!sdd.hp.com!hpscdc!hplextra!hpcc05!aspen!huck
  7. Newsgroups: comp.sys.hp
  8. References: <1992Jul30.085325.26753@bohra.cpg.oz.au>
  9. Lines: 46
  10.  
  11. In comp.sys.hp, cary@hpcuhe.cup.hp.com (Cary Coutant) writes:
  12.  
  13.     > On the /800 the divide instruction is restarted and another exception is
  14.     > raised, resulting in an infinite loop.
  15.  
  16.     Are you sure it is the divide instruction that's restarted, or is it a
  17.     subsequent floating-point instruction that uses the result of the divide?
  18.     By the way, how did you arm the exceptions?  On PA, floating-point
  19.     exceptions are disabled by default.
  20.  
  21.     Because of the pipelined nature of the PA-RISC FPU, most exceptions are
  22.     delayed. ...
  23.  
  24. Cary gives an excellent description of the operation of the PA-RISC
  25. floating-point unit and I'ld like to add a little more detail to
  26. assist anyone writing such a signal handler.
  27.  
  28. It's possible (even likely with a 720) that multiple exceptions are
  29. being reported by the floating-point unit.  Sometimes it is a normal
  30. IEEE exception (if enabled), sometimes its an instruction that the
  31. chip is unable to execute (like NaN handling), and finally it can
  32. be an instruction where an earlier exception has created a data
  33. dependency.  For example:
  34.        fadd,dbl r4,r5 -> r6      <= overflow trap
  35.        fsub,dbl r6,r7 -> r8
  36.        fstw r8...
  37.  
  38. A 720 will probably trap on the FSTW instruction with the FADD reporting
  39. OVERFLOW and the FSUB reporting UNIMPLEMENTED.  So now the exception
  40. handler needs to creat a result for the FADD and then get that
  41. FSUB instruction to execute.
  42.  
  43. So what does this all mean?  When the 720 traps and raises the SIGFPE
  44. signal, the signal handler should deal with the first problem,
  45. clear that exception register, and then return.  In the example, the
  46. T-bit in the status register will still be set, the FSTW will get
  47. restarted and immediately trap, the kernel exception handler will emulate
  48. the UNIMPLMENTED FSUB, clear that exception register, find no other
  49. exceptions, clear the T-bit, and then restart the FSTW (which can
  50. now procede.  This simplifies the user's signal handler.  You can
  51. assume that something needs to be handled, doing nothing to the
  52. exception registers is a sure infinite loop.
  53.  
  54. Jerry Huck
  55. Hewlett-Packard
  56.  
  57.