arch/x86/include/asm/irqflags.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/irqflags.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/irqflags.h- Extension
.h- Size
- 3196 bytes
- Lines
- 164
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
asm/processor-flags.hasm/nospec-branch.hasm/paravirt.hlinux/types.h
Detected Declarations
function native_save_flfunction native_irq_disablefunction native_irq_enablefunction native_safe_haltfunction native_haltfunction native_irqs_disabled_flagsfunction native_local_irq_savefunction native_local_irq_restorefunction arch_safe_haltfunction haltfunction arch_local_save_flagsfunction arch_local_irq_disablefunction arch_local_irq_enablefunction arch_local_irq_savefunction arch_irqs_disabled_flagsfunction arch_irqs_disabledfunction arch_local_irq_restore
Annotated Snippet
#ifndef _X86_IRQFLAGS_H_
#define _X86_IRQFLAGS_H_
#include <asm/processor-flags.h>
#ifndef __ASSEMBLER__
#include <asm/nospec-branch.h>
/*
* Interrupt control:
*/
/* Declaration required for gcc < 4.9 to prevent -Werror=missing-prototypes */
extern inline unsigned long native_save_fl(void);
extern __always_inline unsigned long native_save_fl(void)
{
unsigned long flags;
/*
* "=rm" is safe here, because "pop" adjusts the stack before
* it evaluates its effective address -- this is part of the
* documented behavior of the "pop" instruction.
*/
asm volatile("# __raw_save_flags\n\t"
"pushf ; pop %0"
: ASM_OUTPUT_RM (flags)
: /* no input */
: "memory");
return flags;
}
static __always_inline void native_irq_disable(void)
{
asm volatile("cli": : :"memory");
}
static __always_inline void native_irq_enable(void)
{
asm volatile("sti": : :"memory");
}
static __always_inline void native_safe_halt(void)
{
x86_idle_clear_cpu_buffers();
asm volatile("sti; hlt": : :"memory");
}
static __always_inline void native_halt(void)
{
x86_idle_clear_cpu_buffers();
asm volatile("hlt": : :"memory");
}
static __always_inline int native_irqs_disabled_flags(unsigned long flags)
{
return !(flags & X86_EFLAGS_IF);
}
static __always_inline unsigned long native_local_irq_save(void)
{
unsigned long flags = native_save_fl();
native_irq_disable();
return flags;
}
static __always_inline void native_local_irq_restore(unsigned long flags)
{
if (!native_irqs_disabled_flags(flags))
native_irq_enable();
}
#endif
#ifndef CONFIG_PARAVIRT
#ifndef __ASSEMBLER__
/*
* Used in the idle loop; sti takes one instruction cycle
* to complete:
*/
static __always_inline void arch_safe_halt(void)
{
native_safe_halt();
}
/*
* Used when interrupts are already enabled or to
Annotation
- Immediate include surface: `asm/processor-flags.h`, `asm/nospec-branch.h`, `asm/paravirt.h`, `linux/types.h`.
- Detected declarations: `function native_save_fl`, `function native_irq_disable`, `function native_irq_enable`, `function native_safe_halt`, `function native_halt`, `function native_irqs_disabled_flags`, `function native_local_irq_save`, `function native_local_irq_restore`, `function arch_safe_halt`, `function halt`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.