cregit-Linux how code gets into the kernel

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

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

#define _ASM_X86_HWEIGHT_H

#include <asm/cpufeatures.h>

#ifdef CONFIG_64BIT
/* popcnt %edi, %eax */

#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc7"
/* popcnt %rdi, %rax */

#define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7"

#define REG_IN "D"

#define REG_OUT "a"
#else
/* popcnt %eax, %eax */

#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0"

#define REG_IN "a"

#define REG_OUT "a"
#endif


#define __HAVE_ARCH_SW_HWEIGHT


static __always_inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); return res; }

Contributors

PersonTokensPropCommitsCommitProp
Borislav Petkov1995.00%266.67%
Denys Vlasenko15.00%133.33%
Total20100.00%3100.00%


static inline unsigned int __arch_hweight16(unsigned int w) { return __arch_hweight32(w & 0xffff); }

Contributors

PersonTokensPropCommitsCommitProp
Borislav Petkov20100.00%1100.00%
Total20100.00%1100.00%


static inline unsigned int __arch_hweight8(unsigned int w) { return __arch_hweight32(w & 0xff); }

Contributors

PersonTokensPropCommitsCommitProp
Borislav Petkov20100.00%1100.00%
Total20100.00%1100.00%

#ifdef CONFIG_X86_32
static inline unsigned long __arch_hweight64(__u64 w) { return __arch_hweight32((u32)w) + __arch_hweight32((u32)(w >> 32)); }

Contributors

PersonTokensPropCommitsCommitProp
Borislav Petkov3196.88%150.00%
Denys Vlasenko13.12%150.00%
Total32100.00%2100.00%

#else
static __always_inline unsigned long __arch_hweight64(__u64 w) { unsigned long res; asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); return res; }

Contributors

PersonTokensPropCommitsCommitProp
Denys Vlasenko1473.68%133.33%
Borislav Petkov526.32%266.67%
Total19100.00%3100.00%

#endif /* CONFIG_X86_32 */ #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Borislav Petkov14483.72%350.00%
Denys Vlasenko2212.79%116.67%
H. Peter Anvin52.91%116.67%
Greg Kroah-Hartman10.58%116.67%
Total172100.00%6100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.