A: Timer hook

Michal Kocer kocer na ipex.cz
Pondělí Březen 9 18:37:37 CET 1998


Dobry den!

Nekdo se zde ptal na to, jak se lze povesit na IRQ 0,

odpoved naleznete na 
  http://www.erols.com/rgerharz/Linux/
 
odkud cituji:

The Timer Hook Patch installs a function pointer in the do_timer()
function in
linux/kernel/sched.c. This pointer is declared void (*do_timer_hook)() =
0;.

An if statement is inserted at the beginning of do_timer() which calls the
function pointed to by
do_timer_hook, if it is not zero. A kernel module may install a handler
with the following code:

int init_module(void)
{
    ...                 /* prepare to receive interrupt calls */
    cli();              /* disable interrupts */
    if(do_timer_hook) {
        sti();          /* don't forget this! */
        printk("timer hook (do_timer_hook) already in use\n");
        return -EIO;
    }
    do_timer_hook = my_timer;
    sti();              /* timer interrupts will start now */
    ...                 /* do rest of module setup */
}
  
Pekny den preje
			MK



Další informace o konferenci Linux