
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>_go32_dpmi_set_protected_mode_interrupt_vector</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_go32_dpmi_set_protected_mode_interrupt_vector
==============================================
Syntax
------
#include <dpmi.h>
int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
Description
-----------
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 (_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.
Return Value
------------
Zero on success, nonzero on failure.
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;
}
See Also: DPMI Overview _go32_my_cs
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson