Disable interrupts from user space

Example Code





int main (int argc, char **argv)
{
    iopl(3);        // Go to the privileged level

    asm("cli");  // Disable interrupts

    /* Code goes here  (Make sure this part is as small as possible) */

    asm("sti");  // Enable interrupts
}


IMPORTANT: This code should be run with superuser privileges

The header file 'sys/io.h' must be included for iopl

No comments:

Post a Comment

Followers