Bona Fide OS Development
http://forums.osdever.net/

trying to hook a interrupt locks the machine
http://forums.osdever.net/viewtopic.php?f=4&t=72
Page 1 of 1

Author:  smeezekitty [ Sat Nov 07, 2009 7:08 pm ]
Post subject:  trying to hook a interrupt locks the machine

:x 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

Author:  smeezekitty [ Sat Nov 07, 2009 9:49 pm ]
Post subject:  Re: trying to hook a interrupt locks the machine

fixed it! the compiler thought i loaded the kernel at 0000:0100 insted of 4000:0100 :) :) :)

Author:  DudeOfX [ Mon Nov 09, 2009 1:24 pm ]
Post subject:  Re: trying to hook a interrupt locks the machine

I see you went the route of settin up soft interrupts instead of calling them directly...
...cool 8-)

Author:  Love4Boobies [ Tue Nov 10, 2009 10:28 am ]
Post subject:  Re: trying to hook a interrupt locks the machine

DudeOfX wrote:
I see you went the route of settin up soft interrupts instead of calling them directly...
...cool 8-)


This doesn't even mean anything... :!: He only gave an example where an interrupt handler would be called.

Cheers,
Bogdan

Author:  DudeOfX [ Tue Nov 10, 2009 5:43 pm ]
Post subject:  Re: trying to hook a interrupt locks the machine

WTF man... the likelyhood of that being the reason of using interrupts is high due to the problems he had in the past... it was a safe assumption to make.

Author:  smeezekitty [ Fri Nov 13, 2009 5:18 pm ]
Post subject:  Re: trying to hook a interrupt locks the machine

its so so much easier then calling directly.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/