Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d0ee0de in mainline


Ignore:
Timestamp:
2010-05-20T21:25:35Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
8aa9265
Parents:
3d948be
Message:

Add amd64 interrupts_disabled().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/asm.h

    r3d948be rd0ee0de  
    3838#include <config.h>
    3939#include <typedefs.h>
     40#include <arch/cpu.h>
    4041
    4142extern void asm_delay_loop(uint32_t t);
     
    269270        return v;
    270271}
     272
     273/** Check interrupts state.
     274 *
     275 * @return True if interrupts are disabled.
     276 *
     277 */
     278static inline bool interrupts_disabled(void)
     279{
     280        ipl_t v;
     281       
     282        asm volatile (
     283                "pushfq\n"
     284                "popq %[v]\n"
     285                : [v] "=r" (v)
     286        );
     287       
     288        return ((v & RFLAGS_IF) == 0);
     289}
     290
    271291
    272292/** Write to MSR */
Note: See TracChangeset for help on using the changeset viewer.