Skip to content

Instantly share code, notes, and snippets.

@erincandescent
Created April 17, 2013 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erincandescent/5406435 to your computer and use it in GitHub Desktop.
Save erincandescent/5406435 to your computer and use it in GitHub Desktop.
static inline int disable_interrupts(void)
{
int r;
__asm__ __volatile__(
"pushfd;"
"cli;"
"pop %0;"
: "=mr"(r)
);
return r;
}
static inline void restore_interrupts(int r)
{
__asm__ __volatile__ ("push %0; popfd;" :: "mr"(r));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment