home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / go32 / gopvec.txh < prev    next >
Encoding:
Text File  |  1995-12-23  |  2.4 KB  |  107 lines

  1. @node _go32_dpmi_get_protected_mode_interrupt_vector, dpmi
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <dpmi.h>
  6.  
  7. int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. @xref{DPMI Overview}
  13.  
  14. This function puts the selector and offset of the specified interrupt
  15. vector into the @code{pm_selector} and @code{pm_offset} fields of
  16. @var{info}.  This structure can be saved and later passed to
  17. @code{_go32_dpmi_get_protected_mode_interrupt_vector} to restore
  18. a vector.
  19.  
  20. @subheading Return Value
  21.  
  22. Zero on success, nonzero on failure.
  23.  
  24. @subheading Example
  25.  
  26. @xref{_go32_dpmi_set_protected_mode_interrupt_vector}
  27.  
  28. @c ----------------------------------------------------------------------
  29. @node _go32_dpmi_set_protected_mode_interrupt_vector, dpmi
  30. @subheading Syntax
  31.  
  32. @example
  33. #include <dpmi.h>
  34.  
  35. int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  36. @end example
  37.  
  38. @subheading Description
  39.  
  40. @xref{DPMI Overview}
  41.  
  42. This function sets the protected mode interrupt vector specified to
  43. point to the given function.  The @code{pm_offset} and
  44. @code{pm_selector} fields of @var{info} must be filled in
  45. (@pxref{_go32_my_cs}).  The following should be noted:
  46.  
  47. @itemize @bullet
  48.  
  49. @item
  50.  
  51. You may not @code{longjmp} out of an interrupt handler.
  52.  
  53. @item
  54.  
  55. You may not make any function calls that require system calls, such
  56. as @code{printf}. 
  57.  
  58. @item
  59.  
  60. This function will not wrap the handler for you.  The
  61. @code{_go32_dpmi_allocate_iret_wrapper} and
  62. @code{_go32_dpmi_chain_protected_mode_interrupt_vector} functions can
  63. wrap your function if you want.
  64.  
  65. @item
  66.  
  67. You must set the pm_selector field of @var{info}.  Use
  68. @code{_go32_my_cs} to get a selector valid for your functions. 
  69.  
  70. @end itemize
  71.  
  72. @subheading Return Value
  73.  
  74. Zero on success, nonzero on failure.
  75.  
  76. @subheading Example
  77.  
  78. @example
  79. volatile int tics = 0;
  80.  
  81. timer_handler()
  82. @{
  83.   tics++;
  84. @}
  85.  
  86. int main()
  87. @{
  88.   _go32_dpmi_seginfo old_handler, new_handler;
  89.  
  90.   printf("grabbing timer interrupt\n");
  91.   _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  92.   
  93.   new_handler.pm_offset = (int)tic_handler;
  94.   new_handler.pm_selector = _go32_my_cs();
  95.   _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  96.  
  97.   getkey();
  98.  
  99.   printf("releasing timer interrupt\n");
  100.   _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  101.  
  102.   return 0;
  103. @}
  104.  
  105. @end example
  106.  
  107.