home *** CD-ROM | disk | FTP | other *** search
/ PC Media 4 / PC MEDIA CD04.iso / share / prog / int32 / readme < prev    next >
Encoding:
Text File  |  1994-07-23  |  2.4 KB  |  49 lines

  1. This is a small library to be used to create thunks for interrupt functions
  2. in 32bit DOS extended applications.   The  idea  is  to  permit  people  to
  3. preserve their interrupt functions written in C/C++ to the greatest  extent
  4. possible  without  adding  compiler  support.   The  argument  layout   for
  5. interrupt functions supported  here matches  that of  the previous  Borland
  6. 16bit interrupt functions, except that  the arguments have been widened  to
  7. 32bits.
  8.  
  9. See the file t.c for an example of an interrupt function for 32bits.
  10.  
  11. We are providing a  _makeInt32Thunk function which  constructs a thunk  for
  12. the C/C++ interrupt functions which loads DS and builds the argument  frame
  13. as expected.  There is an option in  the thunk creation to allow the  thunk
  14. to chain to the old handler once the user handler has completed.
  15.  
  16. void *  _makeInt32Thunk (void *         proc,
  17.                          void *         dsLoc,
  18.                          unsigned short chainSel,
  19.                          unsigned long  chainOffset);
  20.  
  21. Builds a 32bit interrupt thunk for 'proc'.  'proc' should be an interrupt
  22. function declared as follows:
  23.       void iproc (unsigned long ebp, unsigned long edi, unsigned long esi,
  24.                   unsigned long  ds, unsigned long  es, unsigned long edx,
  25.                   unsigned long ecx, unsigned long ebx, unsigned long ebx,
  26.                   unsigned long eip, unsigned long  cs, unsigned long flags);
  27.  
  28. 'dsLoc' should be a pointer to  where the DS which the interrupt  procedure
  29. requires is stored.  The value stored  there will be loaded into DS  before
  30. your interrupt procedure is called.
  31.  
  32. 'chainSel' is the optional selector of the interrupt routine that you  want
  33. to chain to on return from your function.
  34.  
  35. 'chainOffset' is the optional offset of the interrupt routine that you want
  36. to chain to on return from your  function.  If this is 0, then no  chaining
  37. will be performed, and the thunk will return with an IRET instruction.   If
  38. 'chainOffset' is non-zero, then the  thunk  will  chain  to  the  interrupt
  39. routine at chainSel:chainOffset with a  48bit  jump  on  return  from  your
  40. handler.
  41.  
  42. The return value is either a  thunk address which you  can use in calls  to
  43. set protected mode interrupt vectors, or NULL (in the case of failure).
  44.  
  45. Note that the thunk returned is not  allocated from a locked page.  If  you
  46. require that the page  be locked, you  will have to  lock it yourself  with
  47. DPMI call 600.
  48.  
  49.