delorie.com/djgpp/doc/libc/libc_446.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <dpmi.h> int _go32_dpmi_set_protected_mode_interrupt_vector( int vector, _go32_dpmi_seginfo *info ); |
See section DPMI Overview.
This function sets the protected mode interrupt vector specified to
point to the given function. The pm_offset
and
pm_selector
fields of info must be filled in
(see section _go32_my_cs). The following should be noted:
You may not longjmp
out of an interrupt handler.
You may not make any function calls that require system calls, such
as printf
.
This function will not wrap the handler for you. The
_go32_dpmi_allocate_iret_wrapper
and
_go32_dpmi_chain_protected_mode_interrupt_vector
functions can
wrap your function if you want.
You must set the pm_selector field of info. Use
_go32_my_cs
to get a selector valid for your functions.
Zero on success, nonzero on failure.
ANSI/ISO C | No |
POSIX | No |
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; } |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |