#include <realmode.h>Go to the source code of this file.
Defines | |
| #define | hooked_bios_interrupts __use_text16 ( hooked_bios_interrupts ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| uint16_t | __text16 (hooked_bios_interrupts) |
| Hooked interrupt count. | |
| void | hook_bios_interrupt (unsigned int interrupt, unsigned int handler, struct segoff *chain_vector) |
| Hook INT vector. | |
| int | unhook_bios_interrupt (unsigned int interrupt, unsigned int handler, struct segoff *chain_vector) |
| Unhook INT vector. | |
| #define hooked_bios_interrupts __use_text16 ( hooked_bios_interrupts ) |
Definition at line 25 of file biosint.h.
Referenced by hook_bios_interrupt(), pxenv_stop_undi(), unhide_etherboot(), and unhook_bios_interrupt().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| uint16_t __text16 | ( | hooked_bios_interrupts | ) |
Hooked interrupt count.
At exit, after unhooking all possible interrupts, this counter should be examined. If it is non-zero, it means that we failed to unhook at least one interrupt vector, and so must not free up the memory we are using. (Note that this also implies that we should re-hook INT 15 in order to hide ourselves from the memory map).
| void hook_bios_interrupt | ( | unsigned int | interrupt, | |
| unsigned int | handler, | |||
| struct segoff * | chain_vector | |||
| ) |
Hook INT vector.
| interrupt | INT number | |
| handler | Offset within .text16 to interrupt handler | |
| chain_vector | Vector for chaining to previous handler |
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.
Definition at line 24 of file biosint.c.
References copy_from_real, copy_to_real, DBG, DBG_HDA, DBG_LOG, hooked_bios_interrupts, segoff::offset, rm_cs, and segoff::segment.
Referenced by call_bootsector(), fake_e820(), hide_etherboot(), hook_comboot_interrupts(), hook_int13(), pxe_activate(), and undinet_hook_isr().
00025 { 00026 struct segoff vector = { 00027 .segment = rm_cs, 00028 .offset = handler, 00029 }; 00030 00031 DBG ( "Hooking INT %#02x to %04x:%04x\n", 00032 interrupt, rm_cs, handler ); 00033 00034 if ( ( chain_vector->segment != 0 ) || 00035 ( chain_vector->offset != 0 ) ) { 00036 /* Already hooked; do nothing */ 00037 DBG ( "...already hooked\n" ); 00038 return; 00039 } 00040 00041 copy_from_real ( chain_vector, 0, ( interrupt * 4 ), 00042 sizeof ( *chain_vector ) ); 00043 DBG ( "...chaining to %04x:%04x\n", 00044 chain_vector->segment, chain_vector->offset ); 00045 if ( DBG_LOG ) { 00046 char code[64]; 00047 copy_from_real ( code, chain_vector->segment, 00048 chain_vector->offset, sizeof ( code ) ); 00049 DBG_HDA ( *chain_vector, code, sizeof ( code ) ); 00050 } 00051 00052 copy_to_real ( 0, ( interrupt * 4 ), &vector, sizeof ( vector ) ); 00053 hooked_bios_interrupts++; 00054 }
| int unhook_bios_interrupt | ( | unsigned int | interrupt, | |
| unsigned int | handler, | |||
| struct segoff * | chain_vector | |||
| ) |
Unhook INT vector.
| interrupt | INT number | |
| handler | Offset within .text16 to interrupt handler | |
| chain_vector | Vector containing address of previous handler |
Definition at line 69 of file biosint.c.
References copy_from_real, copy_to_real, DBG, EBUSY, hooked_bios_interrupts, segoff::offset, rm_cs, and segoff::segment.
Referenced by call_bootsector(), pxe_deactivate(), undinet_unhook_isr(), unfake_e820(), unhide_etherboot(), unhook_comboot_interrupts(), and unhook_int13().
00070 { 00071 struct segoff vector; 00072 00073 DBG ( "Unhooking INT %#02x from %04x:%04x\n", 00074 interrupt, rm_cs, handler ); 00075 00076 copy_from_real ( &vector, 0, ( interrupt * 4 ), sizeof ( vector ) ); 00077 if ( ( vector.segment != rm_cs ) || ( vector.offset != handler ) ) { 00078 DBG ( "...cannot unhook; vector points to %04x:%04x\n", 00079 vector.segment, vector.offset ); 00080 return -EBUSY; 00081 } 00082 00083 DBG ( "...restoring to %04x:%04x\n", 00084 chain_vector->segment, chain_vector->offset ); 00085 copy_to_real ( 0, ( interrupt * 4 ), chain_vector, 00086 sizeof ( *chain_vector ) ); 00087 00088 chain_vector->segment = 0; 00089 chain_vector->offset = 0; 00090 hooked_bios_interrupts--; 00091 return 0; 00092 }
1.5.7.1