home *** CD-ROM | disk | FTP | other *** search
- @node _go32_dpmi_get_protected_mode_interrupt_vector, dpmi
- @subheading Syntax
-
- @example
- #include <dpmi.h>
-
- int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
- @end example
-
- @subheading Description
-
- @xref{DPMI Overview}
-
- This function puts the selector and offset of the specified interrupt
- vector into the @code{pm_selector} and @code{pm_offset} fields of
- @var{info}. This structure can be saved and later passed to
- @code{_go32_dpmi_get_protected_mode_interrupt_vector} to restore
- a vector.
-
- @subheading Return Value
-
- Zero on success, nonzero on failure.
-
- @subheading Example
-
- @xref{_go32_dpmi_set_protected_mode_interrupt_vector}
-
- @c ----------------------------------------------------------------------
- @node _go32_dpmi_set_protected_mode_interrupt_vector, dpmi
- @subheading Syntax
-
- @example
- #include <dpmi.h>
-
- int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
- @end example
-
- @subheading Description
-
- @xref{DPMI Overview}
-
- This function sets the protected mode interrupt vector specified to
- point to the given function. The @code{pm_offset} and
- @code{pm_selector} fields of @var{info} must be filled in
- (@pxref{_go32_my_cs}). The following should be noted:
-
- @itemize @bullet
-
- @item
-
- You may not @code{longjmp} out of an interrupt handler.
-
- @item
-
- You may not make any function calls that require system calls, such
- as @code{printf}.
-
- @item
-
- This function will not wrap the handler for you. The
- @code{_go32_dpmi_allocate_iret_wrapper} and
- @code{_go32_dpmi_chain_protected_mode_interrupt_vector} functions can
- wrap your function if you want.
-
- @item
-
- You must set the pm_selector field of @var{info}. Use
- @code{_go32_my_cs} to get a selector valid for your functions.
-
- @end itemize
-
- @subheading Return Value
-
- Zero on success, nonzero on failure.
-
- @subheading Example
-
- @example
- volatile int tics = 0;
-
- timer_handler()
- @{
- tics++;
- @}
-
- int main()
- @{
- _go32_dpmi_seginfo old_handler, new_handler;
-
- printf("grabbing timer interrupt\n");
- _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
-
- new_handler.pm_offset = (int)tic_handler;
- new_handler.pm_selector = _go32_my_cs();
- _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
-
- getkey();
-
- printf("releasing timer interrupt\n");
- _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
-
- return 0;
- @}
-
- @end example
-
-