home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / c / break.arc / BREAK.DOC < prev   
Internet Message Format  |  1985-08-21  |  2KB

  1. Date: Tuesday, 20 August 1985 11:42:41 EDT
  2. From: Joe.Newcomer@cmu-sei.arpa
  3. To: info-ibmpc@usc-isib.arpa
  4. Subject: Control-break handler
  5. Message-ID: <1985.8.20.15.38.52.Joe.Newcomer@cmu-sei.arpa>
  6.  
  7.  
  8. Abstract:
  9.  
  10. MS-DOS has the truly fascinating feature that it is impossible to
  11. abort a program which has entered an infinite loop.  When debugging
  12. a program this becomes very painful.  I have written an assembly code
  13. intercept routine that is intended to be used with Lattice C.  There is
  14. a routine to call to establish the interceptor, and one which MUST be
  15. called to dis-establish it.  When control-break is hit, if the CS:IP
  16. is in the user code, the program is terminated upon return from the
  17. keyboard interrupt handler.
  18.  
  19. Restrictions: This only works with the S and D (64K code segment) models
  20. of Lattice C.  It is very, very, very delicate hackery and has been
  21. tested only in a restricted environment.  No guarantees are made, but
  22. it is up to each user to determine if this can work in his/her environment.
  23.  
  24. The code is a bit rough in spots; I make to pretensions to being an
  25. expert assembler hacker.  If anyone can clean it up, feel free to do so.
  26. I may have missed some subtlety of DOS/BIOS interactions as well.  Please
  27. let me know.  
  28.  
  29. There are two completely magic stack offsets used to determine the user's
  30. CS:IP when the keyboard interrupt is taken.  This is extreme magic.
  31. If anyone knows a better way of doing this than reading the BIOS listings
  32. and using the debugger to determine the magical offsets, I'd love to
  33. hear about it.
  34.  
  35. This has been tested with Lattice C 2.14 S model code on a Hercules
  36. monochrome card.  No keyboard enhancers were in use.  This is the only
  37. configuration under which it has been tested.  Correctness for other
  38. configurations is pure conjecture.  
  39.