home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / bsd / 4589 < prev    next >
Encoding:
Text File  |  1992-08-22  |  2.1 KB  |  55 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!sgi!rigden.wpd.sgi.com!rpw3
  3. From: rpw3@rigden.wpd.sgi.com (Rob Warnock)
  4. Subject: Re: Possable pccons.c bug in 0.1
  5. Message-ID: <ou7s85c@sgi.sgi.com>
  6. Sender: rpw3@rigden.wpd.sgi.com
  7. Organization: Silicon Graphics, Inc.  Mountain View, CA
  8. Date: Sun, 23 Aug 1992 11:37:52 GMT
  9. Lines: 44
  10.  
  11. veit@du9ds3.uni-duisburg.de writes:
  12. +---------------
  13. | (Josh Osborne) writes:
  14. | >    was = *cp;
  15. | >    *cp = (u_short) 0xA55A;
  16. | >    if (*cp != 0xA55A) {
  17. | >I *think* it looks like the if should be
  18. | >    if (was != 0xA55A) ...
  19. | "was" saves the old value at the address "cp" is pointing to. It is 
  20. | restored in the else path if there is RAM at this address. With a 
  21. | Hercules card, there is none there.
  22. | The only problem that might be there is that the cc must be prevented to
  23. | put the value "*cp" into a register (after storing it). This might be done
  24. | by making "cp" "volatile".
  25. +---------------
  26.  
  27. There's another potential bug with this style of code, which is somewhat
  28. hardware-dependent, but more & more common these days. Just as such code
  29. might fail to detect the missing RAM in the absence of "volatile u_short *cp",
  30. so also it is that in machines that use mostly CMOS logic instead of TTL
  31. (or even *with* TTL, in very fast machines) it is possible that the value
  32. 0xA55A is still "floating" on the CPU bus or the device's internal bus, and
  33. the "if (*cp != 0xA55A)" will read back the *floating* value rather than
  34. some "pulled-up" all 1's or "pulled-down" all 0's.
  35.  
  36. That is, with fast CMOS logic, you can't presume *anything* about which way
  37. *if any* busses will be "pulled" when they are not actively driven. This is
  38. especially true if the instructions to do the test are in the cache, or were
  39. pre-fetched from memory before the "*cp = (u_short) 0xA55A;" was done. I have
  40. seen values "float" on data busses for as long as several dozen cycles after
  41. the last active tri-state driver shut off!
  42.  
  43. Kernel programmers, be warned!
  44.  
  45.  
  46. -Rob
  47.  
  48. -----
  49. Rob Warnock, MS-9U/510        rpw3@sgi.com
  50. Silicon Graphics, Inc.        (415)390-1673
  51. 2011 N. Shoreline Blvd.
  52. Mountain View, CA  94043
  53.  
  54.