trying to hook a interrupt locks the machine
I am writing a real mode operating system in C and decided to use interrupts for system calls but my code to hook the vector is not working:
Code:
void setvector(unsigned char inter, unsigned seg, unsigned off){
unsigned char far *data=0;
data[inter*4] = (seg & 0xFF00) >> 8;
data[inter*4 + 1] = (seg & 0x00FF);
data[inter*4 + 2] = (off & 0xFF00) >> 8;
data[inter*4 + 3] = (off & 0x00FF);
}
but the machine freezes when the hooked interrupt is fired!
for example:
Code:
setvector(0x32, FP_SEG(hello_world), FP_OFF(hello_world));
asm {int 0x32} //Freeze here