home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / arch / 9072 < prev    next >
Encoding:
Text File  |  1992-08-27  |  4.7 KB  |  109 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!torn!cunews!nrcnet0!bnrgate!bmerh85!bcars64a!bqneh3!schow
  3. From: schow@bqneh3.bnr.ca (Stanley T.H. Chow)
  4. Subject: Re: trapping speculative ops
  5. Message-ID: <1992Aug27.195549.10546@bcars64a.bnr.ca>
  6. Sender: news@bcars64a.bnr.ca (Usenet News)
  7. Organization: Bell Northern Research Ltd, Ottawa
  8. References: <1992Aug27.005340.6547@bcars64a.bnr.ca> <CLIFFC.92Aug27082745@medea.rice.edu>
  9. Date: Thu, 27 Aug 1992 19:55:49 GMT
  10. Lines: 97
  11.  
  12. ><Stanley T.H. Chow>
  13. >| Very nice model, but what to do about saving and restoring registers
  14. >| across subroutine call, interupts, etc.?
  15. >
  16. ><Cliff Click>
  17. >Soft answer:
  18. >The compiler knows that live and possibly dangerous results cannot be 
  19. >carried across a subroutine call.  Therefore it uses every possibly 
  20. >dangerous result before the subroutine call.  This means you cannot 
  21. >lift that divide-by-zero across the subroutine call.
  22.  
  23. Not very nice. Depending on the language and type of program, this
  24. could pretty much stop hosting anything. In any case, there still
  25. remain the problem of interrupts.
  26.  
  27. >Hard answer:
  28. >The hardware allows these bits to be read and written using a special 
  29. >register.  The special register can be "slow" because it's assumed to be
  30. >an infrequent operation.  The trap bits are saved and restored along with
  31. >the registers.
  32.  
  33. So you are suggesting that all the "trap" bits are addressable as one
  34. registers. Accesses to "normal" registers will check the relevant bit
  35. in this register. In an interrupt handler, this trap-bits registers 
  36. will be saved and restored along with the normal registers.
  37.  
  38. I believe this is the same as option 3 suggested by Homayoon Akhiani in
  39. his article (as you mentioned later, the only difference is when the
  40. exception is actually raised).
  41.  
  42. Unforturnately, this does not allow you to reserve some registers for
  43. use during interrupt since the trap-bits register must be saved/restored
  44. as a single entity.
  45.  
  46. On second thought, this is not a problem, you can save/restore the 
  47. whole trap-bits register while only save/restore some of the normal
  48. registers. (Hmm, touching an uninitialized register may cause a trap,
  49. may be this is a feature!)
  50.  
  51. >Interrupts appear to require the "hard answer", but there is another way
  52. >(albeit possible worse):
  53. >
  54. >Harder Soft answer:
  55. >Only 1 interruptable condition can exist at a time.  The compiler forces the
  56. >issue by using the possible dangerous register before it allows another 
  57. >operation which can cause a dangerous register.  External interrupts are
  58. >disabled while a dangerous register exists.  The compiler ensures that no
  59. >register is kept dangerous for longer than the desired interrupt latency.
  60. >Since only 1 interrupt can occur at a time, no trap bits need to be saved
  61. >or restored.
  62. >Scheduling restrictions in this answer are probably worse than implementing 
  63. >the hardware solution.  I have no idea what you can implement cheaply in
  64. >hardware.
  65.  
  66. Not to mention that external interrupts are now gated by register values
  67. that could change every clock, could get tricky.
  68. >
  69. ><Cliff Click>
  70. >|| Pre-fetch for long-distance memory can be implemented with a simple LOAD.  
  71. >|| If a page fault is required for the LOAD the fault is delayed until the 
  72. >|| register is used.  If the pre-fetch is speculative, no page fault occurs.
  73. >
  74. ><Stanley T.H. Chow>
  75. >| Presumably, the prefetch will use a different opcode, or do you mean all
  76. >| references should behave like this?
  77. >
  78. ><Cliff Click>
  79. >All references behave this way.  No seperate prefetch opcode required.
  80.  
  81. But if the prefetch was not speculative, it would be nice to have the load
  82. go forward. For page fault, it doesn't make much difference, but a TLB 
  83. miss could well have been hidden. Conceivabily, one may want control over
  84. the cache behaviour as well.
  85.  
  86. ><Homayoon Akhiani>
  87. >| I believe that there is a 3rd option:
  88. >| Hardware has Trap Status and Control register
  89. >|   Using the control resgister, Software will disable all traps.
  90. >|   So when a exception rises, the hardware will not trap, it will update the
  91. >|   "Status Register" and follows the normal execution path.
  92. >
  93. ><Cliff Click>
  94. >Upon re-reading your example, I see that you can test the trap results on a
  95. >*per-register* basis.  Thus the only difference between your model and my
  96. >model is that (1) traps are tested explicitly by the software, instead of
  97. >implicitly (by reading the register) and (2) interrupts can be made precise
  98. >by having the hardware trap as soon as they occur (software ENABLEs all traps).
  99.  
  100. also:
  101. (3) software can choose to ignore traps for the whole program, just enable
  102. traps at the end to see if anything happened.
  103.  
  104. --
  105. Stanley Chow            InterNet: schow@BNR.CA
  106. Bell Northern Research  UUCP:     ..!uunet!bnrgate!bqneh3!schow
  107. (613) 763-2831
  108. Me? Represent other people? Don't make them laugh so hard.
  109.