cregit-Linux how code gets into the kernel

Release 4.14 arch/x86/include/asm/irqflags.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _X86_IRQFLAGS_H_

#define _X86_IRQFLAGS_H_

#include <asm/processor-flags.h>

#ifndef __ASSEMBLY__

/* Provide __cpuidle; we can't safely include <linux/cpu.h> */

#define __cpuidle __attribute__((__section__(".cpuidle.text")))

/*
 * Interrupt control:
 */


static 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" : "=rm" (flags) : /* no input */ : "memory"); return flags; }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1878.26%133.33%
Joe Perches313.04%133.33%
H. Peter Anvin28.70%133.33%
Total23100.00%3100.00%


static inline void native_restore_fl(unsigned long flags) { asm volatile("push %0 ; popf" : /* no output */ :"g" (flags) :"memory", "cc"); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1275.00%150.00%
Joe Perches425.00%150.00%
Total16100.00%2100.00%


static inline void native_irq_disable(void) { asm volatile("cli": : :"memory"); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa12100.00%1100.00%
Total12100.00%1100.00%


static inline void native_irq_enable(void) { asm volatile("sti": : :"memory"); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa12100.00%1100.00%
Total12100.00%1100.00%


static inline __cpuidle void native_safe_halt(void) { asm volatile("sti; hlt": : :"memory"); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1292.31%150.00%
Chris Metcalf17.69%150.00%
Total13100.00%2100.00%


static inline __cpuidle void native_halt(void) { asm volatile("hlt": : :"memory"); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1292.31%150.00%
Chris Metcalf17.69%150.00%
Total13100.00%2100.00%

#endif #ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> #else #ifndef __ASSEMBLY__ #include <linux/types.h>
static inline notrace unsigned long arch_local_save_flags(void) { return native_save_fl(); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1386.67%133.33%
David Howells16.67%133.33%
Steven Rostedt16.67%133.33%
Total15100.00%3100.00%


static inline notrace void arch_local_irq_restore(unsigned long flags) { native_restore_fl(flags); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1588.24%133.33%
David Howells15.88%133.33%
Steven Rostedt15.88%133.33%
Total17100.00%3100.00%


static inline notrace void arch_local_irq_disable(void) { native_irq_disable(); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1184.62%133.33%
David Howells17.69%133.33%
Steven Rostedt17.69%133.33%
Total13100.00%3100.00%


static inline notrace void arch_local_irq_enable(void) { native_irq_enable(); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1184.62%133.33%
David Howells17.69%133.33%
Steven Rostedt17.69%133.33%
Total13100.00%3100.00%

/* * Used in the idle loop; sti takes one instruction cycle * to complete: */
static inline __cpuidle void arch_safe_halt(void) { native_safe_halt(); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1184.62%133.33%
David Howells17.69%133.33%
Chris Metcalf17.69%133.33%
Total13100.00%3100.00%

/* * Used when interrupts are already enabled or to * shutdown the processor: */
static inline __cpuidle void halt(void) { native_halt(); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1292.31%150.00%
Chris Metcalf17.69%150.00%
Total13100.00%2100.00%

/* * For spinlocks, etc: */
static inline notrace unsigned long arch_local_irq_save(void) { unsigned long flags = arch_local_save_flags(); arch_local_irq_disable(); return flags; }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa2083.33%133.33%
David Howells312.50%133.33%
Steven Rostedt14.17%133.33%
Total24100.00%3100.00%

#else #define ENABLE_INTERRUPTS(x) sti #define DISABLE_INTERRUPTS(x) cli #ifdef CONFIG_X86_64 #define SWAPGS swapgs /* * Currently paravirt can't handle swapgs nicely when we * don't have a stack we can rely on (such as a user space * stack). So we either find a way around these or just fault * and emulate if a guest tries to call swapgs directly. * * Either way, this is a good way to document that we don't * have a reliable stack. x86_64 only. */ #define SWAPGS_UNSAFE_STACK swapgs #define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ #define INTERRUPT_RETURN jmp native_iret #define USERGS_SYSRET64 \ swapgs; \ sysretq; #define USERGS_SYSRET32 \ swapgs; \ sysretl #else #define INTERRUPT_RETURN iret #define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit #define GET_CR0_INTO_EAX movl %cr0, %eax #endif #endif /* __ASSEMBLY__ */ #endif /* CONFIG_PARAVIRT */ #ifndef __ASSEMBLY__
static inline int arch_irqs_disabled_flags(unsigned long flags) { return !(flags & X86_EFLAGS_IF); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1894.74%150.00%
David Howells15.26%150.00%
Total19100.00%2100.00%


static inline int arch_irqs_disabled(void) { unsigned long flags = arch_local_save_flags(); return arch_irqs_disabled_flags(flags); }

Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa1986.36%150.00%
David Howells313.64%150.00%
Total22100.00%2100.00%

#endif /* !__ASSEMBLY__ */ #ifdef __ASSEMBLY__ #ifdef CONFIG_TRACE_IRQFLAGS # define TRACE_IRQS_ON call trace_hardirqs_on_thunk; # define TRACE_IRQS_OFF call trace_hardirqs_off_thunk; #else # define TRACE_IRQS_ON # define TRACE_IRQS_OFF #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC # ifdef CONFIG_X86_64 # define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk # define LOCKDEP_SYS_EXIT_IRQ \ TRACE_IRQS_ON; \ sti; \ call lockdep_sys_exit_thunk; \ cli; \ TRACE_IRQS_OFF; # else # define LOCKDEP_SYS_EXIT \ pushl %eax; \ pushl %ecx; \ pushl %edx; \ call lockdep_sys_exit; \ popl %edx; \ popl %ecx; \ popl %eax; # define LOCKDEP_SYS_EXIT_IRQ # endif #else # define LOCKDEP_SYS_EXIT # define LOCKDEP_SYS_EXIT_IRQ #endif #endif /* __ASSEMBLY__ */ #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Glauber de Oliveira Costa32177.16%16.25%
Denys Vlasenko266.25%318.75%
Jeremy Fitzhardinge215.05%425.00%
David Howells122.88%16.25%
Chris Metcalf92.16%16.25%
Thomas Gleixner81.92%16.25%
Steven Rostedt81.92%16.25%
Joe Perches71.68%16.25%
H. Peter Anvin20.48%16.25%
Andrew Lutomirski10.24%16.25%
Greg Kroah-Hartman10.24%16.25%
Total416100.00%16100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.