home *** CD-ROM | disk | FTP | other *** search
- This is a small library to be used to create thunks for interrupt functions
- in 32bit DOS extended applications. The idea is to permit people to
- preserve their interrupt functions written in C/C++ to the greatest extent
- possible without adding compiler support. The argument layout for
- interrupt functions supported here matches that of the previous Borland
- 16bit interrupt functions, except that the arguments have been widened to
- 32bits.
-
- See the file t.c for an example of an interrupt function for 32bits.
-
- We are providing a _makeInt32Thunk function which constructs a thunk for
- the C/C++ interrupt functions which loads DS and builds the argument frame
- as expected. There is an option in the thunk creation to allow the thunk
- to chain to the old handler once the user handler has completed.
-
- void * _makeInt32Thunk (void * proc,
- void * dsLoc,
- unsigned short chainSel,
- unsigned long chainOffset);
-
- Builds a 32bit interrupt thunk for 'proc'. 'proc' should be an interrupt
- function declared as follows:
- void iproc (unsigned long ebp, unsigned long edi, unsigned long esi,
- unsigned long ds, unsigned long es, unsigned long edx,
- unsigned long ecx, unsigned long ebx, unsigned long ebx,
- unsigned long eip, unsigned long cs, unsigned long flags);
-
- 'dsLoc' should be a pointer to where the DS which the interrupt procedure
- requires is stored. The value stored there will be loaded into DS before
- your interrupt procedure is called.
-
- 'chainSel' is the optional selector of the interrupt routine that you want
- to chain to on return from your function.
-
- 'chainOffset' is the optional offset of the interrupt routine that you want
- to chain to on return from your function. If this is 0, then no chaining
- will be performed, and the thunk will return with an IRET instruction. If
- 'chainOffset' is non-zero, then the thunk will chain to the interrupt
- routine at chainSel:chainOffset with a 48bit jump on return from your
- handler.
-
- The return value is either a thunk address which you can use in calls to
- set protected mode interrupt vectors, or NULL (in the case of failure).
-
- Note that the thunk returned is not allocated from a locked page. If you
- require that the page be locked, you will have to lock it yourself with
- DPMI call 600.
-