#include <errno.h>
#include <realmode.h>
#include <biosint.h>
/**
* @file BIOS interrupts
*
*/
/**
* Hook INT vector
*
* @v interrupt INT number
* @v handler Offset within .text16 to interrupt handler
* @v chain_vector Vector for chaining to previous handler
*
* Hooks in an i386 INT handler. The handler itself must reside
* within the .text16 segment. @c chain_vector will be filled in with
* the address of the previously-installed handler for this interrupt;
* the handler should probably exit by ljmping via this vector.
*/
struct segoff *chain_vector ) {
};
DBG ( "Hooking INT %#02x to %04x:%04x\n",
if ( ( chain_vector->segment != 0 ) ||
( chain_vector->offset != 0 ) ) {
/* Already hooked; do nothing */
DBG ( "...already hooked\n" );
return;
}
sizeof ( *chain_vector ) );
DBG ( "...chaining to %04x:%04x\n",
if ( DBG_LOG ) {
}
}
/**
* Unhook INT vector
*
* @v interrupt INT number
* @v handler Offset within .text16 to interrupt handler
* @v chain_vector Vector containing address of previous handler
*
* Unhooks an i386 interrupt handler hooked by hook_i386_vector().
* Note that this operation may fail, if some external code has hooked
* the vector since we hooked in our handler. If it fails, it means
* that it is not possible to unhook our handler, and we must leave it
* (and its chaining vector) resident in memory.
*/
struct segoff *chain_vector ) {
DBG ( "Unhooking INT %#02x from %04x:%04x\n",
DBG ( "...cannot unhook; vector points to %04x:%04x\n",
return -EBUSY;
}
DBG ( "...restoring to %04x:%04x\n",
sizeof ( *chain_vector ) );
chain_vector->segment = 0;
chain_vector->offset = 0;
return 0;
}