extern void __VERIFIER_error() __attribute__ ((__noreturn__)); long ldv__builtin_expect(long val, long res); struct ftrace_branch_data { const char *func; const char *file; unsigned line; union { struct { unsigned long correct; unsigned long incorrect; }; struct { unsigned long miss; unsigned long hit; }; unsigned long miss_hit[2]; }; }; typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; __extension__ typedef __signed__ long long __s64; __extension__ typedef unsigned long long __u64; typedef signed char s8; typedef unsigned char u8; typedef signed short s16; typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; enum { false = 0, true = 1 }; typedef struct { unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))]; } __kernel_fd_set; typedef void (*__kernel_sighandler_t)(int); typedef int __kernel_key_t; typedef int __kernel_mqd_t; typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; typedef unsigned long __kernel_old_dev_t; typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; typedef __kernel_ulong_t __kernel_ino_t; typedef unsigned int __kernel_mode_t; typedef __kernel_ulong_t __kernel_nlink_t; typedef int __kernel_pid_t; typedef int __kernel_ipc_pid_t; typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; typedef __kernel_long_t __kernel_suseconds_t; typedef int __kernel_daddr_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; typedef struct { int val[2]; } __kernel_fsid_t; typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_time_t; typedef __kernel_long_t __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; typedef __u32 __kernel_dev_t; typedef __kernel_fd_set fd_set; typedef __kernel_dev_t dev_t; typedef __kernel_ino_t ino_t; typedef __kernel_mode_t mode_t; typedef unsigned short umode_t; typedef __kernel_nlink_t nlink_t; typedef __kernel_off_t off_t; typedef __kernel_pid_t pid_t; typedef __kernel_daddr_t daddr_t; typedef __kernel_key_t key_t; typedef __kernel_suseconds_t suseconds_t; typedef __kernel_timer_t timer_t; typedef __kernel_clockid_t clockid_t; typedef __kernel_mqd_t mqd_t; typedef _Bool bool; typedef __kernel_uid32_t uid_t; typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_t uid16_t; typedef __kernel_gid16_t gid16_t; typedef unsigned long uintptr_t; typedef __kernel_old_uid_t old_uid_t; typedef __kernel_old_gid_t old_gid_t; typedef __kernel_loff_t loff_t; typedef __kernel_size_t size_t; typedef __kernel_ssize_t ssize_t; typedef __kernel_ptrdiff_t ptrdiff_t; typedef __kernel_time_t time_t; typedef __kernel_clock_t clock_t; typedef __kernel_caddr_t caddr_t; typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned char unchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef __u8 u_int8_t; typedef __s8 int8_t; typedef __u16 u_int16_t; typedef __s16 int16_t; typedef __u32 u_int32_t; typedef __s32 int32_t; typedef __u8 uint8_t; typedef __u16 uint16_t; typedef __u32 uint32_t; typedef __u64 uint64_t; typedef __u64 u_int64_t; typedef __s64 int64_t; typedef unsigned long sector_t; typedef unsigned long blkcnt_t; typedef u64 dma_addr_t; typedef __u16 __le16; typedef __u16 __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; typedef __u16 __sum16; typedef __u32 __wsum; typedef unsigned gfp_t; typedef unsigned fmode_t; typedef u64 phys_addr_t; typedef phys_addr_t resource_size_t; typedef unsigned long irq_hw_number_t; typedef struct { int counter; } atomic_t; typedef struct { long counter; } atomic64_t; struct list_head { struct list_head *next, *prev; }; struct hlist_head { struct hlist_node *first; }; struct hlist_node { struct hlist_node *next, **pprev; }; struct ustat { __kernel_daddr_t f_tfree; __kernel_ino_t f_tinode; char f_fname[6]; char f_fpack[6]; }; struct rcu_head { struct rcu_head *next; void (*func)(struct rcu_head *head); }; typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); extern initcall_t __con_initcall_start[], __con_initcall_end[]; extern initcall_t __security_initcall_start[], __security_initcall_end[]; typedef void (*ctor_fn_t)(void); extern int do_one_initcall(initcall_t fn); extern char __attribute__ ((__section__(".init.data"))) boot_command_line[]; extern char *saved_command_line; extern unsigned int reset_devices; void setup_arch(char **); void prepare_namespace(void); extern void (*late_time_init)(void); extern bool initcall_debug; typedef unsigned long kernel_ulong_t; struct pci_device_id { __u32 vendor, device; __u32 subvendor, subdevice; __u32 class, class_mask; kernel_ulong_t driver_data; }; struct ieee1394_device_id { __u32 match_flags; __u32 vendor_id; __u32 model_id; __u32 specifier_id; __u32 version; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct usb_device_id { __u16 match_flags; __u16 idVendor; __u16 idProduct; __u16 bcdDevice_lo; __u16 bcdDevice_hi; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; kernel_ulong_t driver_info; }; struct hid_device_id { __u16 bus; __u16 pad1; __u32 vendor; __u32 product; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct ccw_device_id { __u16 match_flags; __u16 cu_type; __u16 dev_type; __u8 cu_model; __u8 dev_model; kernel_ulong_t driver_info; }; struct ap_device_id { __u16 match_flags; __u8 dev_type; __u8 pad1; __u32 pad2; kernel_ulong_t driver_info; }; struct css_device_id { __u8 match_flags; __u8 type; __u16 pad2; __u32 pad3; kernel_ulong_t driver_data; }; struct acpi_device_id { __u8 id[16]; kernel_ulong_t driver_data; }; struct pnp_device_id { __u8 id[8]; kernel_ulong_t driver_data; }; struct pnp_card_device_id { __u8 id[8]; kernel_ulong_t driver_data; struct { __u8 id[8]; } devs[8]; }; struct serio_device_id { __u8 type; __u8 extra; __u8 id; __u8 proto; }; struct of_device_id { char name[32]; char type[32]; char compatible[128]; void *data; }; struct vio_device_id { char type[32]; char compat[32]; }; struct pcmcia_device_id { __u16 match_flags; __u16 manf_id; __u16 card_id; __u8 func_id; __u8 function; __u8 device_no; __u32 prod_id_hash[4] __attribute__((aligned(sizeof(__u32)))); const char * prod_id[4]; kernel_ulong_t driver_info; char * cisfile; }; struct input_device_id { kernel_ulong_t flags; __u16 bustype; __u16 vendor; __u16 product; __u16 version; kernel_ulong_t evbit[0x1f / 64 + 1]; kernel_ulong_t keybit[0x2ff / 64 + 1]; kernel_ulong_t relbit[0x0f / 64 + 1]; kernel_ulong_t absbit[0x3f / 64 + 1]; kernel_ulong_t mscbit[0x07 / 64 + 1]; kernel_ulong_t ledbit[0x0f / 64 + 1]; kernel_ulong_t sndbit[0x07 / 64 + 1]; kernel_ulong_t ffbit[0x7f / 64 + 1]; kernel_ulong_t swbit[0x0f / 64 + 1]; kernel_ulong_t driver_info; }; struct eisa_device_id { char sig[8]; kernel_ulong_t driver_data; }; struct parisc_device_id { __u8 hw_type; __u8 hversion_rev; __u16 hversion; __u32 sversion; }; struct sdio_device_id { __u8 class; __u16 vendor; __u16 device; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct ssb_device_id { __u16 vendor; __u16 coreid; __u8 revision; }; struct bcma_device_id { __u16 manuf; __u16 id; __u8 rev; __u8 class; }; struct virtio_device_id { __u32 device; __u32 vendor; }; struct hv_vmbus_device_id { __u8 guid[16]; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct rpmsg_device_id { char name[32]; }; struct i2c_device_id { char name[20]; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct spi_device_id { char name[32]; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; enum dmi_field { DMI_NONE, DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_BIOS_DATE, DMI_SYS_VENDOR, DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_PRODUCT_SERIAL, DMI_PRODUCT_UUID, DMI_BOARD_VENDOR, DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_BOARD_SERIAL, DMI_BOARD_ASSET_TAG, DMI_CHASSIS_VENDOR, DMI_CHASSIS_TYPE, DMI_CHASSIS_VERSION, DMI_CHASSIS_SERIAL, DMI_CHASSIS_ASSET_TAG, DMI_STRING_MAX, }; struct dmi_strmatch { unsigned char slot; char substr[79]; }; struct dmi_system_id { int (*callback)(const struct dmi_system_id *); const char *ident; struct dmi_strmatch matches[4]; void *driver_data; }; struct platform_device_id { char name[20]; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct mdio_device_id { __u32 phy_id; __u32 phy_id_mask; }; struct zorro_device_id { __u32 id; kernel_ulong_t driver_data; }; struct isapnp_device_id { unsigned short card_vendor, card_device; unsigned short vendor, function; kernel_ulong_t driver_data; }; struct amba_id { unsigned int id; unsigned int mask; void *data; }; struct x86_cpu_id { __u16 vendor; __u16 family; __u16 model; __u16 feature; kernel_ulong_t driver_data; }; static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u32 __arch_swab32(__u32 val) { asm("bswapl %0" : "=r" (val) : "0" (val)); return val; } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u64 __arch_swab64(__u64 val) { asm("bswapq %0" : "=r" (val) : "0" (val)); return val; } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u16 __fswab16(__u16 val) { return ((__u16)( (((__u16)(val) & (__u16)0x00ffU) << 8) | (((__u16)(val) & (__u16)0xff00U) >> 8))); } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u32 __fswab32(__u32 val) { return __arch_swab32(val); } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u64 __fswab64(__u64 val) { return __arch_swab64(val); } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u32 __fswahw32(__u32 val) { return ((__u32)( (((__u32)(val) & (__u32)0x0000ffffUL) << 16) | (((__u32)(val) & (__u32)0xffff0000UL) >> 16))); } static inline __attribute__((no_instrument_function)) __attribute__((__const__)) __u32 __fswahb32(__u32 val) { return ((__u32)( (((__u32)(val) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(val) & (__u32)0xff00ff00UL) >> 8))); } static inline __attribute__((no_instrument_function)) __u16 __swab16p(const __u16 *p) { return (__builtin_constant_p((__u16)(*p)) ? ((__u16)( (((__u16)(*p) & (__u16)0x00ffU) << 8) | (((__u16)(*p) & (__u16)0xff00U) >> 8))) : __fswab16(*p)); } static inline __attribute__((no_instrument_function)) __u32 __swab32p(const __u32 *p) { return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x000000ffUL) << 24) | (((__u32)(*p) & (__u32)0x0000ff00UL) << 8) | (((__u32)(*p) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(*p) & (__u32)0xff000000UL) >> 24))) : __fswab32(*p)); } static inline __attribute__((no_instrument_function)) __u64 __swab64p(const __u64 *p) { return (__builtin_constant_p((__u64)(*p)) ? ((__u64)( (((__u64)(*p) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(*p) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(*p) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(*p) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(*p) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(*p) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(*p) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(*p) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(*p)); } static inline __attribute__((no_instrument_function)) __u32 __swahw32p(const __u32 *p) { return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x0000ffffUL) << 16) | (((__u32)(*p) & (__u32)0xffff0000UL) >> 16))) : __fswahw32(*p)); } static inline __attribute__((no_instrument_function)) __u32 __swahb32p(const __u32 *p) { return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(*p) & (__u32)0xff00ff00UL) >> 8))) : __fswahb32(*p)); } static inline __attribute__((no_instrument_function)) void __swab16s(__u16 *p) { *p = __swab16p(p); } static inline __attribute__((no_instrument_function)) void __swab32s(__u32 *p) { *p = __swab32p(p); } static inline __attribute__((no_instrument_function)) void __swab64s(__u64 *p) { *p = __swab64p(p); } static inline __attribute__((no_instrument_function)) void __swahw32s(__u32 *p) { *p = __swahw32p(p); } static inline __attribute__((no_instrument_function)) void __swahb32s(__u32 *p) { *p = __swahb32p(p); } static inline __attribute__((no_instrument_function)) __le64 __cpu_to_le64p(const __u64 *p) { return ( __le64)*p; } static inline __attribute__((no_instrument_function)) __u64 __le64_to_cpup(const __le64 *p) { return ( __u64)*p; } static inline __attribute__((no_instrument_function)) __le32 __cpu_to_le32p(const __u32 *p) { return ( __le32)*p; } static inline __attribute__((no_instrument_function)) __u32 __le32_to_cpup(const __le32 *p) { return ( __u32)*p; } static inline __attribute__((no_instrument_function)) __le16 __cpu_to_le16p(const __u16 *p) { return ( __le16)*p; } static inline __attribute__((no_instrument_function)) __u16 __le16_to_cpup(const __le16 *p) { return ( __u16)*p; } static inline __attribute__((no_instrument_function)) __be64 __cpu_to_be64p(const __u64 *p) { return ( __be64)__swab64p(p); } static inline __attribute__((no_instrument_function)) __u64 __be64_to_cpup(const __be64 *p) { return __swab64p((__u64 *)p); } static inline __attribute__((no_instrument_function)) __be32 __cpu_to_be32p(const __u32 *p) { return ( __be32)__swab32p(p); } static inline __attribute__((no_instrument_function)) __u32 __be32_to_cpup(const __be32 *p) { return __swab32p((__u32 *)p); } static inline __attribute__((no_instrument_function)) __be16 __cpu_to_be16p(const __u16 *p) { return ( __be16)__swab16p(p); } static inline __attribute__((no_instrument_function)) __u16 __be16_to_cpup(const __be16 *p) { return __swab16p((__u16 *)p); } static inline __attribute__((no_instrument_function)) void le16_add_cpu(__le16 *var, u16 val) { *var = (( __le16)(__u16)((( __u16)(__le16)(*var)) + val)); } static inline __attribute__((no_instrument_function)) void le32_add_cpu(__le32 *var, u32 val) { *var = (( __le32)(__u32)((( __u32)(__le32)(*var)) + val)); } static inline __attribute__((no_instrument_function)) void le64_add_cpu(__le64 *var, u64 val) { *var = (( __le64)(__u64)((( __u64)(__le64)(*var)) + val)); } static inline __attribute__((no_instrument_function)) void be16_add_cpu(__be16 *var, u16 val) { *var = (( __be16)(__builtin_constant_p((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val))) ? ((__u16)( (((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val)) & (__u16)0x00ffU) << 8) | (((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val)) & (__u16)0xff00U) >> 8))) : __fswab16(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val)))); } static inline __attribute__((no_instrument_function)) void be32_add_cpu(__be32 *var, u32 val) { *var = (( __be32)(__builtin_constant_p((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val))) ? ((__u32)( (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x000000ffUL) << 24) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0xff000000UL) >> 24))) : __fswab32(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)))); } static inline __attribute__((no_instrument_function)) void be64_add_cpu(__be64 *var, u64 val) { *var = (( __be64)(__builtin_constant_p((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val))) ? ((__u64)( (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)))); } struct usb_ctrlrequest { __u8 bRequestType; __u8 bRequest; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); struct usb_descriptor_header { __u8 bLength; __u8 bDescriptorType; } __attribute__ ((packed)); struct usb_device_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 iManufacturer; __u8 iProduct; __u8 iSerialNumber; __u8 bNumConfigurations; } __attribute__ ((packed)); struct usb_config_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumInterfaces; __u8 bConfigurationValue; __u8 iConfiguration; __u8 bmAttributes; __u8 bMaxPower; } __attribute__ ((packed)); struct usb_string_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wData[1]; } __attribute__ ((packed)); struct usb_interface_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bInterfaceNumber; __u8 bAlternateSetting; __u8 bNumEndpoints; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 iInterface; } __attribute__ ((packed)); struct usb_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; __u8 bRefresh; __u8 bSynchAddress; } __attribute__ ((packed)); static inline __attribute__((no_instrument_function)) int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) { return epd->bEndpointAddress & 0x0f; } static inline __attribute__((no_instrument_function)) int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) { return epd->bmAttributes & 0x03; } static inline __attribute__((no_instrument_function)) int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & 0x80) == 0x80); } static inline __attribute__((no_instrument_function)) int usb_endpoint_dir_out( const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & 0x80) == 0); } static inline __attribute__((no_instrument_function)) int usb_endpoint_xfer_bulk( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & 0x03) == 2); } static inline __attribute__((no_instrument_function)) int usb_endpoint_xfer_control( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & 0x03) == 0); } static inline __attribute__((no_instrument_function)) int usb_endpoint_xfer_int( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & 0x03) == 3); } static inline __attribute__((no_instrument_function)) int usb_endpoint_xfer_isoc( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & 0x03) == 1); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_bulk_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_bulk_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_int_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_int_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_isoc_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_is_isoc_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); } static inline __attribute__((no_instrument_function)) int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) { return (( __u16)(__le16)(epd->wMaxPacketSize)); } struct usb_ss_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bmAttributes; __le16 wBytesPerInterval; } __attribute__ ((packed)); static inline __attribute__((no_instrument_function)) int usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) { int max_streams; if (!comp) return 0; max_streams = comp->bmAttributes & 0x1f; if (!max_streams) return 0; max_streams = 1 << max_streams; return max_streams; } struct usb_qualifier_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __u8 bNumConfigurations; __u8 bRESERVED; } __attribute__ ((packed)); struct usb_otg_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; } __attribute__ ((packed)); struct usb_debug_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDebugInEndpoint; __u8 bDebugOutEndpoint; } __attribute__((packed)); struct usb_interface_assoc_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bFirstInterface; __u8 bInterfaceCount; __u8 bFunctionClass; __u8 bFunctionSubClass; __u8 bFunctionProtocol; __u8 iFunction; } __attribute__ ((packed)); struct usb_security_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumEncryptionTypes; } __attribute__((packed)); struct usb_key_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 tTKID[3]; __u8 bReserved; __u8 bKeyData[0]; } __attribute__((packed)); struct usb_encryption_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEncryptionType; __u8 bEncryptionValue; __u8 bAuthKeyIndex; } __attribute__((packed)); struct usb_bos_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumDeviceCaps; } __attribute__((packed)); struct usb_dev_cap_header { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; } __attribute__((packed)); struct usb_wireless_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; __le16 wPHYRates; __u8 bmTFITXPowerInfo; __u8 bmFFITXPowerInfo; __le16 bmBandGroup; __u8 bReserved; } __attribute__((packed)); struct usb_ext_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __le32 bmAttributes; } __attribute__((packed)); struct usb_ss_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; __le16 wSpeedSupported; __u8 bFunctionalitySupport; __u8 bU1devExitLat; __le16 bU2DevExitLat; } __attribute__((packed)); struct usb_ss_container_id_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 ContainerID[16]; } __attribute__((packed)); struct usb_wireless_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bMaxSequence; __le16 wMaxStreamDelay; __le16 wOverTheAirPacketSize; __u8 bOverTheAirInterval; __u8 bmCompAttributes; } __attribute__((packed)); struct usb_handshake { __u8 bMessageNumber; __u8 bStatus; __u8 tTKID[3]; __u8 bReserved; __u8 CDID[16]; __u8 nonce[16]; __u8 MIC[8]; } __attribute__((packed)); struct usb_connection_context { __u8 CHID[16]; __u8 CDID[16]; __u8 CK[16]; } __attribute__((packed)); enum usb_device_speed { USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_WIRELESS, USB_SPEED_SUPER, }; extern const char *usb_speed_string(enum usb_device_speed speed); enum usb_device_state { USB_STATE_NOTATTACHED = 0, USB_STATE_ATTACHED, USB_STATE_POWERED, USB_STATE_RECONNECTING, USB_STATE_UNAUTHENTICATED, USB_STATE_DEFAULT, USB_STATE_ADDRESS, USB_STATE_CONFIGURED, USB_STATE_SUSPENDED }; struct sysinfo { __kernel_long_t uptime; __kernel_ulong_t loads[3]; __kernel_ulong_t totalram; __kernel_ulong_t freeram; __kernel_ulong_t sharedram; __kernel_ulong_t bufferram; __kernel_ulong_t totalswap; __kernel_ulong_t freeswap; __u16 procs; __u16 pad; __kernel_ulong_t totalhigh; __kernel_ulong_t freehigh; __u32 mem_unit; char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; }; typedef __builtin_va_list __gnuc_va_list; typedef __gnuc_va_list va_list; extern unsigned int __sw_hweight8(unsigned int w); extern unsigned int __sw_hweight16(unsigned int w); extern unsigned int __sw_hweight32(unsigned int w); extern unsigned long __sw_hweight64(__u64 w); struct alt_instr { s32 instr_offset; s32 repl_offset; u16 cpuid; u8 instrlen; u8 replacementlen; }; extern void alternative_instructions(void); extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); struct module; extern void alternatives_smp_module_add(struct module *mod, char *name, void *locks, void *locks_end, void *text, void *text_end); extern void alternatives_smp_module_del(struct module *mod); extern void alternatives_smp_switch(int smp); extern int alternatives_text_reserved(void *start, void *end); extern bool skip_smp_alternatives; extern const char * const x86_cap_flags[10*32]; extern const char * const x86_power_flags[32]; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((pure)) bool __static_cpu_has(u16 bit) { u8 flag; asm volatile("1: movb $0,%0\n" "2:\n" ".section .altinstructions,\"a\"\n" " .long 1b - .\n" " .long 3f - .\n" " .word %P1\n" " .byte 2b - 1b\n" " .byte 4f - 3f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (4f-3f) - (2b-1b)\n" ".previous\n" ".section .altinstr_replacement,\"ax\"\n" "3: movb $1,%0\n" "4:\n" ".previous\n" : "=qm" (flag) : "i" (bit)); return flag; } struct paravirt_patch_site; void apply_paravirt(struct paravirt_patch_site *start, struct paravirt_patch_site *end); extern void *text_poke_early(void *addr, const void *opcode, size_t len); struct text_poke_param { void *addr; const void *opcode; size_t len; }; extern void *text_poke(void *addr, const void *opcode, size_t len); extern void *text_poke_smp(void *addr, const void *opcode, size_t len); extern void text_poke_smp_batch(struct text_poke_param *params, int n); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void set_bit(unsigned int nr, volatile unsigned long *addr) { if ((__builtin_constant_p(nr))) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "orb %1,%0" : "+m" (*(volatile long *) ((void *)(addr) + ((nr)>>3))) : "iq" ((u8)(1 << ((nr) & 7))) : "memory"); } else { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "bts %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); } } static inline __attribute__((no_instrument_function)) void __set_bit(int nr, volatile unsigned long *addr) { asm volatile("bts %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void clear_bit(int nr, volatile unsigned long *addr) { if ((__builtin_constant_p(nr))) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "andb %1,%0" : "+m" (*(volatile long *) ((void *)(addr) + ((nr)>>3))) : "iq" ((u8)~(1 << ((nr) & 7)))); } else { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "btr %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr)); } } static inline __attribute__((no_instrument_function)) void clear_bit_unlock(unsigned nr, volatile unsigned long *addr) { __asm__ __volatile__("": : :"memory"); clear_bit(nr, addr); } static inline __attribute__((no_instrument_function)) void __clear_bit(int nr, volatile unsigned long *addr) { asm volatile("btr %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr)); } static inline __attribute__((no_instrument_function)) void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr) { __asm__ __volatile__("": : :"memory"); __clear_bit(nr, addr); } static inline __attribute__((no_instrument_function)) void __change_bit(int nr, volatile unsigned long *addr) { asm volatile("btc %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr)); } static inline __attribute__((no_instrument_function)) void change_bit(int nr, volatile unsigned long *addr) { if ((__builtin_constant_p(nr))) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xorb %1,%0" : "+m" (*(volatile long *) ((void *)(addr) + ((nr)>>3))) : "iq" ((u8)(1 << ((nr) & 7)))); } else { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "btc %1,%0" : "+m" (*(volatile long *) (addr)) : "Ir" (nr)); } } static inline __attribute__((no_instrument_function)) int test_and_set_bit(int nr, volatile unsigned long *addr) { int oldbit; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "bts %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); return oldbit; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int test_and_set_bit_lock(int nr, volatile unsigned long *addr) { return test_and_set_bit(nr, addr); } static inline __attribute__((no_instrument_function)) int __test_and_set_bit(int nr, volatile unsigned long *addr) { int oldbit; asm("bts %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr)); return oldbit; } static inline __attribute__((no_instrument_function)) int test_and_clear_bit(int nr, volatile unsigned long *addr) { int oldbit; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "btr %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); return oldbit; } static inline __attribute__((no_instrument_function)) int __test_and_clear_bit(int nr, volatile unsigned long *addr) { int oldbit; asm volatile("btr %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr)); return oldbit; } static inline __attribute__((no_instrument_function)) int __test_and_change_bit(int nr, volatile unsigned long *addr) { int oldbit; asm volatile("btc %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); return oldbit; } static inline __attribute__((no_instrument_function)) int test_and_change_bit(int nr, volatile unsigned long *addr) { int oldbit; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "btc %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), "+m" (*(volatile long *) (addr)) : "Ir" (nr) : "memory"); return oldbit; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int constant_test_bit(unsigned int nr, const volatile unsigned long *addr) { return ((1UL << (nr % 64)) & (addr[nr / 64])) != 0; } static inline __attribute__((no_instrument_function)) int variable_test_bit(int nr, volatile const unsigned long *addr) { int oldbit; asm volatile("bt %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit) : "m" (*(unsigned long *)addr), "Ir" (nr)); return oldbit; } static inline __attribute__((no_instrument_function)) unsigned long __ffs(unsigned long word) { asm("bsf %1,%0" : "=r" (word) : "rm" (word)); return word; } static inline __attribute__((no_instrument_function)) unsigned long ffz(unsigned long word) { asm("bsf %1,%0" : "=r" (word) : "r" (~word)); return word; } static inline __attribute__((no_instrument_function)) unsigned long __fls(unsigned long word) { asm("bsr %1,%0" : "=r" (word) : "rm" (word)); return word; } static inline __attribute__((no_instrument_function)) int ffs(int x) { int r; //long tmp = -1; asm("bsfl %1,%0" : "=r" (r) : "rm" (x), "0" (-1)); return r + 1; } static inline __attribute__((no_instrument_function)) int fls(int x) { int r; //long tmp = -1; asm("bsrl %1,%0" : "=r" (r) : "rm" (x), "0" (-1)); return r + 1; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int fls64(__u64 x) { long bitpos = -1; asm("bsrq %1,%0" : "+r" (bitpos) : "rm" (x)); return bitpos + 1; } extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); extern unsigned long find_first_bit(const unsigned long *addr, unsigned long size); extern unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size); static inline __attribute__((no_instrument_function)) int sched_find_first_bit(const unsigned long *b) { if (b[0]) return __ffs(b[0]); return __ffs(b[1]) + 64; } static inline __attribute__((no_instrument_function)) unsigned int __arch_hweight32(unsigned int w) { unsigned int res = 0; asm ("661:\n\t" "call __sw_hweight32" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(4*32+23)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" ".byte 0xf3,0x40,0x0f,0xb8,0xc7" "\n664:\n" ".previous" : "=""a" (res) : "D" (w)); return res; } static inline __attribute__((no_instrument_function)) unsigned int __arch_hweight16(unsigned int w) { return __arch_hweight32(w & 0xffff); } static inline __attribute__((no_instrument_function)) unsigned int __arch_hweight8(unsigned int w) { return __arch_hweight32(w & 0xff); } static inline __attribute__((no_instrument_function)) unsigned long __arch_hweight64(__u64 w) { unsigned long res = 0; asm ("661:\n\t" "call __sw_hweight64" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(4*32+23)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" ".byte 0xf3,0x48,0x0f,0xb8,0xc7" "\n664:\n" ".previous" : "=""a" (res) : "D" (w)); return res; } static inline __attribute__((no_instrument_function)) unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset) { return find_next_zero_bit(addr, size, offset); } static inline __attribute__((no_instrument_function)) unsigned long find_next_bit_le(const void *addr, unsigned long size, unsigned long offset) { return find_next_bit(addr, size, offset); } static inline __attribute__((no_instrument_function)) unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) { return find_first_zero_bit(addr, size); } static inline __attribute__((no_instrument_function)) int test_bit_le(int nr, const void *addr) { return (__builtin_constant_p((nr ^ 0)) ? constant_test_bit((nr ^ 0), (addr)) : variable_test_bit((nr ^ 0), (addr))); } static inline __attribute__((no_instrument_function)) void __set_bit_le(int nr, void *addr) { __set_bit(nr ^ 0, addr); } static inline __attribute__((no_instrument_function)) void __clear_bit_le(int nr, void *addr) { __clear_bit(nr ^ 0, addr); } static inline __attribute__((no_instrument_function)) int test_and_set_bit_le(int nr, void *addr) { return test_and_set_bit(nr ^ 0, addr); } static inline __attribute__((no_instrument_function)) int test_and_clear_bit_le(int nr, void *addr) { return test_and_clear_bit(nr ^ 0, addr); } static inline __attribute__((no_instrument_function)) int __test_and_set_bit_le(int nr, void *addr) { return __test_and_set_bit(nr ^ 0, addr); } static inline __attribute__((no_instrument_function)) int __test_and_clear_bit_le(int nr, void *addr) { return __test_and_clear_bit(nr ^ 0, addr); } static __inline__ __attribute__((no_instrument_function)) int get_bitmask_order(unsigned int count) { int order; order = fls(count); return order; } static __inline__ __attribute__((no_instrument_function)) int get_count_order(unsigned int count) { int order; order = fls(count) - 1; if (count & (count - 1)) order++; return order; } static inline __attribute__((no_instrument_function)) unsigned long hweight_long(unsigned long w) { return sizeof(w) == 4 ? (__builtin_constant_p(w) ? ((( (!!((w) & (1ULL << 0))) + (!!((w) & (1ULL << 1))) + (!!((w) & (1ULL << 2))) + (!!((w) & (1ULL << 3))) + (!!((w) & (1ULL << 4))) + (!!((w) & (1ULL << 5))) + (!!((w) & (1ULL << 6))) + (!!((w) & (1ULL << 7))) ) + ( (!!(((w) >> 8) & (1ULL << 0))) + (!!(((w) >> 8) & (1ULL << 1))) + (!!(((w) >> 8) & (1ULL << 2))) + (!!(((w) >> 8) & (1ULL << 3))) + (!!(((w) >> 8) & (1ULL << 4))) + (!!(((w) >> 8) & (1ULL << 5))) + (!!(((w) >> 8) & (1ULL << 6))) + (!!(((w) >> 8) & (1ULL << 7))) )) + (( (!!(((w) >> 16) & (1ULL << 0))) + (!!(((w) >> 16) & (1ULL << 1))) + (!!(((w) >> 16) & (1ULL << 2))) + (!!(((w) >> 16) & (1ULL << 3))) + (!!(((w) >> 16) & (1ULL << 4))) + (!!(((w) >> 16) & (1ULL << 5))) + (!!(((w) >> 16) & (1ULL << 6))) + (!!(((w) >> 16) & (1ULL << 7))) ) + ( (!!((((w) >> 16) >> 8) & (1ULL << 0))) + (!!((((w) >> 16) >> 8) & (1ULL << 1))) + (!!((((w) >> 16) >> 8) & (1ULL << 2))) + (!!((((w) >> 16) >> 8) & (1ULL << 3))) + (!!((((w) >> 16) >> 8) & (1ULL << 4))) + (!!((((w) >> 16) >> 8) & (1ULL << 5))) + (!!((((w) >> 16) >> 8) & (1ULL << 6))) + (!!((((w) >> 16) >> 8) & (1ULL << 7))) ))) : __arch_hweight32(w)) : (__builtin_constant_p(w) ? (((( (!!((w) & (1ULL << 0))) + (!!((w) & (1ULL << 1))) + (!!((w) & (1ULL << 2))) + (!!((w) & (1ULL << 3))) + (!!((w) & (1ULL << 4))) + (!!((w) & (1ULL << 5))) + (!!((w) & (1ULL << 6))) + (!!((w) & (1ULL << 7))) ) + ( (!!(((w) >> 8) & (1ULL << 0))) + (!!(((w) >> 8) & (1ULL << 1))) + (!!(((w) >> 8) & (1ULL << 2))) + (!!(((w) >> 8) & (1ULL << 3))) + (!!(((w) >> 8) & (1ULL << 4))) + (!!(((w) >> 8) & (1ULL << 5))) + (!!(((w) >> 8) & (1ULL << 6))) + (!!(((w) >> 8) & (1ULL << 7))) )) + (( (!!(((w) >> 16) & (1ULL << 0))) + (!!(((w) >> 16) & (1ULL << 1))) + (!!(((w) >> 16) & (1ULL << 2))) + (!!(((w) >> 16) & (1ULL << 3))) + (!!(((w) >> 16) & (1ULL << 4))) + (!!(((w) >> 16) & (1ULL << 5))) + (!!(((w) >> 16) & (1ULL << 6))) + (!!(((w) >> 16) & (1ULL << 7))) ) + ( (!!((((w) >> 16) >> 8) & (1ULL << 0))) + (!!((((w) >> 16) >> 8) & (1ULL << 1))) + (!!((((w) >> 16) >> 8) & (1ULL << 2))) + (!!((((w) >> 16) >> 8) & (1ULL << 3))) + (!!((((w) >> 16) >> 8) & (1ULL << 4))) + (!!((((w) >> 16) >> 8) & (1ULL << 5))) + (!!((((w) >> 16) >> 8) & (1ULL << 6))) + (!!((((w) >> 16) >> 8) & (1ULL << 7))) ))) + ((( (!!(((w) >> 32) & (1ULL << 0))) + (!!(((w) >> 32) & (1ULL << 1))) + (!!(((w) >> 32) & (1ULL << 2))) + (!!(((w) >> 32) & (1ULL << 3))) + (!!(((w) >> 32) & (1ULL << 4))) + (!!(((w) >> 32) & (1ULL << 5))) + (!!(((w) >> 32) & (1ULL << 6))) + (!!(((w) >> 32) & (1ULL << 7))) ) + ( (!!((((w) >> 32) >> 8) & (1ULL << 0))) + (!!((((w) >> 32) >> 8) & (1ULL << 1))) + (!!((((w) >> 32) >> 8) & (1ULL << 2))) + (!!((((w) >> 32) >> 8) & (1ULL << 3))) + (!!((((w) >> 32) >> 8) & (1ULL << 4))) + (!!((((w) >> 32) >> 8) & (1ULL << 5))) + (!!((((w) >> 32) >> 8) & (1ULL << 6))) + (!!((((w) >> 32) >> 8) & (1ULL << 7))) )) + (( (!!((((w) >> 32) >> 16) & (1ULL << 0))) + (!!((((w) >> 32) >> 16) & (1ULL << 1))) + (!!((((w) >> 32) >> 16) & (1ULL << 2))) + (!!((((w) >> 32) >> 16) & (1ULL << 3))) + (!!((((w) >> 32) >> 16) & (1ULL << 4))) + (!!((((w) >> 32) >> 16) & (1ULL << 5))) + (!!((((w) >> 32) >> 16) & (1ULL << 6))) + (!!((((w) >> 32) >> 16) & (1ULL << 7))) ) + ( (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 0))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 1))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 2))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 3))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 4))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 5))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 6))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 7))) )))) : __arch_hweight64(w)); } static inline __attribute__((no_instrument_function)) __u64 rol64(__u64 word, unsigned int shift) { return (word << shift) | (word >> (64 - shift)); } static inline __attribute__((no_instrument_function)) __u64 ror64(__u64 word, unsigned int shift) { return (word >> shift) | (word << (64 - shift)); } static inline __attribute__((no_instrument_function)) __u32 rol32(__u32 word, unsigned int shift) { return (word << shift) | (word >> (32 - shift)); } static inline __attribute__((no_instrument_function)) __u32 ror32(__u32 word, unsigned int shift) { return (word >> shift) | (word << (32 - shift)); } static inline __attribute__((no_instrument_function)) __u16 rol16(__u16 word, unsigned int shift) { return (word << shift) | (word >> (16 - shift)); } static inline __attribute__((no_instrument_function)) __u16 ror16(__u16 word, unsigned int shift) { return (word >> shift) | (word << (16 - shift)); } static inline __attribute__((no_instrument_function)) __u8 rol8(__u8 word, unsigned int shift) { return (word << shift) | (word >> (8 - shift)); } static inline __attribute__((no_instrument_function)) __u8 ror8(__u8 word, unsigned int shift) { return (word >> shift) | (word << (8 - shift)); } static inline __attribute__((no_instrument_function)) __s32 sign_extend32(__u32 value, int index) { __u8 shift = 31 - index; return (__s32)(value << shift) >> shift; } static inline __attribute__((no_instrument_function)) unsigned fls_long(unsigned long l) { if (sizeof(l) == 4) return fls(l); return fls64(l); } static inline __attribute__((no_instrument_function)) unsigned long __ffs64(u64 word) { return __ffs((unsigned long)word); } extern unsigned long find_last_bit(const unsigned long *addr, unsigned long size); extern __attribute__((const, noreturn)) int ____ilog2_NaN(void); static inline __attribute__((no_instrument_function)) __attribute__((const)) int __ilog2_u32(u32 n) { return fls(n) - 1; } static inline __attribute__((no_instrument_function)) __attribute__((const)) int __ilog2_u64(u64 n) { return fls64(n) - 1; } static inline __attribute__((no_instrument_function)) __attribute__((const)) bool is_power_of_2(unsigned long n) { return (n != 0 && ((n & (n - 1)) == 0)); } static inline __attribute__((no_instrument_function)) __attribute__((const)) unsigned long __roundup_pow_of_two(unsigned long n) { return 1UL << fls_long(n - 1); } static inline __attribute__((no_instrument_function)) __attribute__((const)) unsigned long __rounddown_pow_of_two(unsigned long n) { return 1UL << (fls_long(n) - 1); } extern const char linux_banner[]; extern const char linux_proc_banner[]; extern int console_printk[]; static inline __attribute__((no_instrument_function)) void console_silent(void) { (console_printk[0]) = 0; } static inline __attribute__((no_instrument_function)) void console_verbose(void) { if ((console_printk[0])) (console_printk[0]) = 15; } struct va_format { const char *fmt; va_list *va; }; static inline __attribute__((no_instrument_function)) __attribute__((format(printf, 1, 2))) int no_printk(const char *fmt, ...) { return 0; } extern __attribute__((format(printf, 1, 2))) void early_printk(const char *fmt, ...); extern int printk_needs_cpu(int cpu); extern void printk_tick(void); __attribute__((format(printf, 1, 0))) int vprintk(const char *fmt, va_list args); __attribute__((format(printf, 1, 2))) int printk(const char *fmt, ...); __attribute__((format(printf, 1, 2))) int printk_sched(const char *fmt, ...); extern int __printk_ratelimit(const char *func); extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, unsigned int interval_msec); extern int printk_delay_msec; extern int dmesg_restrict; extern int kptr_restrict; void log_buf_kexec_setup(void); void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) setup_log_buf(int early); extern void dump_stack(void) ; enum { DUMP_PREFIX_NONE, DUMP_PREFIX_ADDRESS, DUMP_PREFIX_OFFSET }; extern void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii); extern void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii); extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, const void *buf, size_t len); struct _ddebug { const char *modname; const char *function; const char *filename; const char *format; unsigned int lineno:18; unsigned int flags:8; } __attribute__((aligned(8))); int ddebug_add_module(struct _ddebug *tab, unsigned int n, const char *modname); extern int ddebug_remove_module(const char *mod_name); extern __attribute__((format(printf, 2, 3))) int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); struct device; extern __attribute__((format(printf, 3, 4))) int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev, const char *fmt, ...); struct net_device; extern __attribute__((format(printf, 3, 4))) int __dynamic_netdev_dbg(struct _ddebug *descriptor, const struct net_device *dev, const char *fmt, ...); struct completion; struct pt_regs; struct user; void __might_sleep(const char *file, int line, int preempt_offset); static inline __attribute__((no_instrument_function)) void might_fault(void) { do { __might_sleep("include/linux/kernel.h", 196, 0); do { } while (0); } while (0); } extern struct atomic_notifier_head panic_notifier_list; extern long (*panic_blink)(int state); __attribute__((format(printf, 1, 2))) void panic(const char *fmt, ...) __attribute__((noreturn)) ; extern void oops_enter(void); extern void oops_exit(void); void print_oops_end_marker(void); extern int oops_may_print(void); void do_exit(long error_code) __attribute__((noreturn)); void complete_and_exit(struct completion *, long) __attribute__((noreturn)); int __attribute__((warn_unused_result)) _kstrtoul(const char *s, unsigned int base, unsigned long *res); int __attribute__((warn_unused_result)) _kstrtol(const char *s, unsigned int base, long *res); int __attribute__((warn_unused_result)) kstrtoull(const char *s, unsigned int base, unsigned long long *res); int __attribute__((warn_unused_result)) kstrtoll(const char *s, unsigned int base, long long *res); static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtoul(const char *s, unsigned int base, unsigned long *res) { if (sizeof(unsigned long) == sizeof(unsigned long long) && __alignof__(unsigned long) == __alignof__(unsigned long long)) return kstrtoull(s, base, (unsigned long long *)res); else return _kstrtoul(s, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtol(const char *s, unsigned int base, long *res) { if (sizeof(long) == sizeof(long long) && __alignof__(long) == __alignof__(long long)) return kstrtoll(s, base, (long long *)res); else return _kstrtol(s, base, res); } int __attribute__((warn_unused_result)) kstrtouint(const char *s, unsigned int base, unsigned int *res); int __attribute__((warn_unused_result)) kstrtoint(const char *s, unsigned int base, int *res); static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtou64(const char *s, unsigned int base, u64 *res) { return kstrtoull(s, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtos64(const char *s, unsigned int base, s64 *res) { return kstrtoll(s, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtou32(const char *s, unsigned int base, u32 *res) { return kstrtouint(s, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtos32(const char *s, unsigned int base, s32 *res) { return kstrtoint(s, base, res); } int __attribute__((warn_unused_result)) kstrtou16(const char *s, unsigned int base, u16 *res); int __attribute__((warn_unused_result)) kstrtos16(const char *s, unsigned int base, s16 *res); int __attribute__((warn_unused_result)) kstrtou8(const char *s, unsigned int base, u8 *res); int __attribute__((warn_unused_result)) kstrtos8(const char *s, unsigned int base, s8 *res); int __attribute__((warn_unused_result)) kstrtoull_from_user(const char *s, size_t count, unsigned int base, unsigned long long *res); int __attribute__((warn_unused_result)) kstrtoll_from_user(const char *s, size_t count, unsigned int base, long long *res); int __attribute__((warn_unused_result)) kstrtoul_from_user(const char *s, size_t count, unsigned int base, unsigned long *res); int __attribute__((warn_unused_result)) kstrtol_from_user(const char *s, size_t count, unsigned int base, long *res); int __attribute__((warn_unused_result)) kstrtouint_from_user(const char *s, size_t count, unsigned int base, unsigned int *res); int __attribute__((warn_unused_result)) kstrtoint_from_user(const char *s, size_t count, unsigned int base, int *res); int __attribute__((warn_unused_result)) kstrtou16_from_user(const char *s, size_t count, unsigned int base, u16 *res); int __attribute__((warn_unused_result)) kstrtos16_from_user(const char *s, size_t count, unsigned int base, s16 *res); int __attribute__((warn_unused_result)) kstrtou8_from_user(const char *s, size_t count, unsigned int base, u8 *res); int __attribute__((warn_unused_result)) kstrtos8_from_user(const char *s, size_t count, unsigned int base, s8 *res); static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtou64_from_user(const char *s, size_t count, unsigned int base, u64 *res) { return kstrtoull_from_user(s, count, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtos64_from_user(const char *s, size_t count, unsigned int base, s64 *res) { return kstrtoll_from_user(s, count, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtou32_from_user(const char *s, size_t count, unsigned int base, u32 *res) { return kstrtouint_from_user(s, count, base, res); } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) kstrtos32_from_user(const char *s, size_t count, unsigned int base, s32 *res) { return kstrtoint_from_user(s, count, base, res); } extern unsigned long simple_strtoul(const char *,char **,unsigned int); extern long simple_strtol(const char *,char **,unsigned int); extern unsigned long long simple_strtoull(const char *,char **,unsigned int); extern long long simple_strtoll(const char *,char **,unsigned int); extern int num_to_str(char *buf, int size, unsigned long long num); extern __attribute__((format(printf, 2, 3))) int sprintf(char *buf, const char * fmt, ...); extern __attribute__((format(printf, 2, 0))) int vsprintf(char *buf, const char *, va_list); extern __attribute__((format(printf, 3, 4))) int snprintf(char *buf, size_t size, const char *fmt, ...); extern __attribute__((format(printf, 3, 0))) int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); extern __attribute__((format(printf, 3, 4))) int scnprintf(char *buf, size_t size, const char *fmt, ...); extern __attribute__((format(printf, 3, 0))) int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); extern __attribute__((format(printf, 2, 3))) char *kasprintf(gfp_t gfp, const char *fmt, ...); extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); extern __attribute__((format(scanf, 2, 3))) int sscanf(const char *, const char *, ...); extern __attribute__((format(scanf, 2, 0))) int vsscanf(const char *, const char *, va_list); extern int get_option(char **str, int *pint); extern char *get_options(const char *str, int nints, int *ints); extern unsigned long long memparse(const char *ptr, char **retptr); extern int core_kernel_text(unsigned long addr); extern int core_kernel_data(unsigned long addr); extern int __kernel_text_address(unsigned long addr); extern int kernel_text_address(unsigned long addr); extern int func_ptr_is_kernel_text(void *ptr); struct pid; extern struct pid *session_of_pgrp(struct pid *pgrp); unsigned long int_sqrt(unsigned long); extern void bust_spinlocks(int yes); extern void wake_up_klogd(void); extern int oops_in_progress; extern int panic_timeout; extern int panic_on_oops; extern int panic_on_unrecovered_nmi; extern int panic_on_io_nmi; extern int sysctl_panic_on_stackoverflow; extern const char *print_tainted(void); extern void add_taint(unsigned flag); extern int test_taint(unsigned flag); extern unsigned long get_taint(void); extern int root_mountflags; extern bool early_boot_irqs_disabled; extern enum system_states { SYSTEM_BOOTING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF, SYSTEM_RESTART, SYSTEM_SUSPEND_DISK, } system_state; extern const char hex_asc[]; static inline __attribute__((no_instrument_function)) char *hex_byte_pack(char *buf, u8 byte) { *buf++ = hex_asc[((byte) & 0xf0) >> 4]; *buf++ = hex_asc[((byte) & 0x0f)]; return buf; } static inline __attribute__((no_instrument_function)) char * __attribute__((deprecated)) pack_hex_byte(char *buf, u8 byte) { return hex_byte_pack(buf, byte); } extern int hex_to_bin(char ch); extern int __attribute__((warn_unused_result)) hex2bin(u8 *dst, const char *src, size_t count); void tracing_off_permanent(void); enum ftrace_dump_mode { DUMP_NONE, DUMP_ALL, DUMP_ORIG, }; void tracing_on(void); void tracing_off(void); int tracing_is_on(void); extern void tracing_start(void); extern void tracing_stop(void); extern void ftrace_off_permanent(void); static inline __attribute__((no_instrument_function)) __attribute__((format(printf, 1, 2))) void ____trace_printk_check_format(const char *fmt, ...) { } extern __attribute__((format(printf, 2, 3))) int __trace_bprintk(unsigned long ip, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int __trace_printk(unsigned long ip, const char *fmt, ...); extern void trace_dump_stack(void); extern int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); extern int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); extern int do_sysinfo(struct sysinfo *info); extern unsigned long loops_per_jiffy; extern void __bad_udelay(void); extern void __bad_ndelay(void); extern void __udelay(unsigned long usecs); extern void __ndelay(unsigned long nsecs); extern void __const_udelay(unsigned long xloops); extern void __delay(unsigned long loops); void use_tsc_delay(void); extern unsigned long lpj_fine; void calibrate_delay(void); void msleep(unsigned int msecs); unsigned long msleep_interruptible(unsigned int msecs); void usleep_range(unsigned long min, unsigned long max); static inline __attribute__((no_instrument_function)) void ssleep(unsigned int seconds) { msleep(seconds * 1000); } struct timespec; struct compat_timespec; struct restart_block { long (*fn)(struct restart_block *); union { struct { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } futex; struct { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } nanosleep; struct { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } poll; }; }; extern long do_no_restart_syscall(struct restart_block *parm); void clear_page(void *page); void copy_page(void *to, void *from); extern unsigned long max_pfn; extern unsigned long phys_base; extern unsigned long __phys_addr(unsigned long); extern void init_extra_mapping_uc(unsigned long phys, unsigned long size); extern void init_extra_mapping_wb(unsigned long phys, unsigned long size); extern int devmem_is_allowed(unsigned long pagenr); extern unsigned long max_low_pfn_mapped; extern unsigned long max_pfn_mapped; static inline __attribute__((no_instrument_function)) phys_addr_t get_max_mapped(void) { return (phys_addr_t)max_pfn_mapped << 12; } extern unsigned long init_memory_mapping(unsigned long start, unsigned long end); extern void initmem_init(void); struct page; static inline __attribute__((no_instrument_function)) void clear_user_page(void *page, unsigned long vaddr, struct page *pg) { clear_page(page); } static inline __attribute__((no_instrument_function)) void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage) { copy_page(to, from); } extern bool __virt_addr_valid(unsigned long kaddr); static inline __attribute__((no_instrument_function)) __attribute__((__const__)) int __get_order(unsigned long size) { int order; size--; size >>= 12; order = fls64(size); return order; } struct task_struct; struct exec_domain; struct task_struct; struct mm_struct; struct vm86_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; long __null_ds; long __null_es; long __null_fs; long __null_gs; long orig_eax; long eip; unsigned short cs, __csh; long eflags; long esp; unsigned short ss, __ssh; unsigned short es, __esh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh; }; struct revectored_struct { unsigned long __map[8]; }; struct vm86_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; }; struct vm86plus_info_struct { unsigned long force_return_for_pic:1; unsigned long vm86dbg_active:1; unsigned long vm86dbg_TFpendig:1; unsigned long unused:28; unsigned long is_vm86pus:1; unsigned char vm86dbg_intxxtab[32]; }; struct vm86plus_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; struct vm86plus_info_struct vm86plus; }; extern const char early_idt_handlers[32][10]; static inline __attribute__((no_instrument_function)) unsigned long get_limit(unsigned long segment) { unsigned long __limit; asm("lsll %1,%0" : "=r" (__limit) : "r" (segment)); return __limit + 1; } struct pt_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; }; struct desc_struct { union { struct { unsigned int a; unsigned int b; }; struct { u16 limit0; u16 base0; unsigned base1: 8, type: 4, s: 1, dpl: 2, p: 1; unsigned limit: 4, avl: 1, l: 1, d: 1, g: 1, base2: 8; }; }; } __attribute__((packed)); enum { GATE_INTERRUPT = 0xE, GATE_TRAP = 0xF, GATE_CALL = 0xC, GATE_TASK = 0x5, }; struct gate_struct64 { u16 offset_low; u16 segment; unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1; u16 offset_middle; u32 offset_high; u32 zero1; } __attribute__((packed)); enum { DESC_TSS = 0x9, DESC_LDT = 0x2, DESCTYPE_S = 0x10, }; struct ldttss_desc64 { u16 limit0; u16 base0; unsigned base1 : 8, type : 5, dpl : 2, p : 1; unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8; u32 base3; u32 zero1; } __attribute__((packed)); typedef struct gate_struct64 gate_desc; typedef struct ldttss_desc64 ldt_desc; typedef struct ldttss_desc64 tss_desc; struct desc_ptr { unsigned short size; unsigned long address; } __attribute__((packed)) ; enum km_type { KM_BOUNCE_READ, KM_SKB_SUNRPC_DATA, KM_SKB_DATA_SOFTIRQ, KM_USER0, KM_USER1, KM_BIO_SRC_IRQ, KM_BIO_DST_IRQ, KM_PTE0, KM_PTE1, KM_IRQ0, KM_IRQ1, KM_SOFTIRQ0, KM_SOFTIRQ1, KM_SYNC_ICACHE, KM_SYNC_DCACHE, KM_UML_USERCOPY, KM_IRQ_PTE, KM_NMI, KM_NMI_PTE, KM_KDB, KM_TYPE_NR }; typedef unsigned long pteval_t; typedef unsigned long pmdval_t; typedef unsigned long pudval_t; typedef unsigned long pgdval_t; typedef unsigned long pgprotval_t; typedef struct { pteval_t pte; } pte_t; typedef struct pgprot { pgprotval_t pgprot; } pgprot_t; typedef struct { pgdval_t pgd; } pgd_t; static inline __attribute__((no_instrument_function)) pgd_t native_make_pgd(pgdval_t val) { return (pgd_t) { val }; } static inline __attribute__((no_instrument_function)) pgdval_t native_pgd_val(pgd_t pgd) { return pgd.pgd; } static inline __attribute__((no_instrument_function)) pgdval_t pgd_flags(pgd_t pgd) { return native_pgd_val(pgd) & (~((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))); } typedef struct { pudval_t pud; } pud_t; static inline __attribute__((no_instrument_function)) pud_t native_make_pud(pmdval_t val) { return (pud_t) { val }; } static inline __attribute__((no_instrument_function)) pudval_t native_pud_val(pud_t pud) { return pud.pud; } typedef struct { pmdval_t pmd; } pmd_t; static inline __attribute__((no_instrument_function)) pmd_t native_make_pmd(pmdval_t val) { return (pmd_t) { val }; } static inline __attribute__((no_instrument_function)) pmdval_t native_pmd_val(pmd_t pmd) { return pmd.pmd; } static inline __attribute__((no_instrument_function)) pudval_t pud_flags(pud_t pud) { return native_pud_val(pud) & (~((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))); } static inline __attribute__((no_instrument_function)) pmdval_t pmd_flags(pmd_t pmd) { return native_pmd_val(pmd) & (~((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))); } static inline __attribute__((no_instrument_function)) pte_t native_make_pte(pteval_t val) { return (pte_t) { .pte = val }; } static inline __attribute__((no_instrument_function)) pteval_t native_pte_val(pte_t pte) { return pte.pte; } static inline __attribute__((no_instrument_function)) pteval_t pte_flags(pte_t pte) { return native_pte_val(pte) & (~((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))); } typedef struct page *pgtable_t; extern pteval_t __supported_pte_mask; extern void set_nx(void); extern int nx_enabled; extern pgprot_t pgprot_writecombine(pgprot_t prot); struct file; pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, unsigned long size, pgprot_t vma_prot); int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, unsigned long size, pgprot_t *vma_prot); void set_pte_vaddr(unsigned long vaddr, pte_t pte); extern void native_pagetable_reserve(u64 start, u64 end); struct seq_file; extern void arch_report_meminfo(struct seq_file *m); enum { PG_LEVEL_NONE, PG_LEVEL_4K, PG_LEVEL_2M, PG_LEVEL_1G, PG_LEVEL_NUM }; extern void update_page_count(int level, unsigned long pages); extern pte_t *lookup_address(unsigned long address, unsigned int *level); struct page; struct thread_struct; struct desc_ptr; struct tss_struct; struct mm_struct; struct desc_struct; struct task_struct; struct cpumask; struct paravirt_callee_save { void *func; }; struct pv_info { unsigned int kernel_rpl; int shared_kernel_pmd; u16 extra_user_64bit_cs; int paravirt_enabled; const char *name; }; struct pv_init_ops { unsigned (*patch)(u8 type, u16 clobber, void *insnbuf, unsigned long addr, unsigned len); }; struct pv_lazy_ops { void (*enter)(void); void (*leave)(void); }; struct pv_time_ops { unsigned long long (*sched_clock)(void); unsigned long long (*steal_clock)(int cpu); unsigned long (*get_tsc_khz)(void); }; struct pv_cpu_ops { unsigned long (*get_debugreg)(int regno); void (*set_debugreg)(int regno, unsigned long value); void (*clts)(void); unsigned long (*read_cr0)(void); void (*write_cr0)(unsigned long); unsigned long (*read_cr4_safe)(void); unsigned long (*read_cr4)(void); void (*write_cr4)(unsigned long); unsigned long (*read_cr8)(void); void (*write_cr8)(unsigned long); void (*load_tr_desc)(void); void (*load_gdt)(const struct desc_ptr *); void (*load_idt)(const struct desc_ptr *); void (*store_gdt)(struct desc_ptr *); void (*store_idt)(struct desc_ptr *); void (*set_ldt)(const void *desc, unsigned entries); unsigned long (*store_tr)(void); void (*load_tls)(struct thread_struct *t, unsigned int cpu); void (*load_gs_index)(unsigned int idx); void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum, const void *desc); void (*write_gdt_entry)(struct desc_struct *, int entrynum, const void *desc, int size); void (*write_idt_entry)(gate_desc *, int entrynum, const gate_desc *gate); void (*alloc_ldt)(struct desc_struct *ldt, unsigned entries); void (*free_ldt)(struct desc_struct *ldt, unsigned entries); void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); void (*set_iopl_mask)(unsigned mask); void (*wbinvd)(void); void (*io_delay)(void); void (*cpuid)(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx); u64 (*read_msr)(unsigned int msr, int *err); int (*rdmsr_regs)(u32 *regs); int (*write_msr)(unsigned int msr, unsigned low, unsigned high); int (*wrmsr_regs)(u32 *regs); u64 (*read_tsc)(void); u64 (*read_pmc)(int counter); unsigned long long (*read_tscp)(unsigned int *aux); void (*irq_enable_sysexit)(void); void (*usergs_sysret64)(void); void (*usergs_sysret32)(void); void (*iret)(void); void (*swapgs)(void); void (*start_context_switch)(struct task_struct *prev); void (*end_context_switch)(struct task_struct *next); }; struct pv_irq_ops { struct paravirt_callee_save save_fl; struct paravirt_callee_save restore_fl; struct paravirt_callee_save irq_disable; struct paravirt_callee_save irq_enable; void (*safe_halt)(void); void (*halt)(void); void (*adjust_exception_frame)(void); }; struct pv_apic_ops { void (*startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp); }; struct pv_mmu_ops { unsigned long (*read_cr2)(void); void (*write_cr2)(unsigned long); unsigned long (*read_cr3)(void); void (*write_cr3)(unsigned long); void (*activate_mm)(struct mm_struct *prev, struct mm_struct *next); void (*dup_mmap)(struct mm_struct *oldmm, struct mm_struct *mm); void (*exit_mmap)(struct mm_struct *mm); void (*flush_tlb_user)(void); void (*flush_tlb_kernel)(void); void (*flush_tlb_single)(unsigned long addr); void (*flush_tlb_others)(const struct cpumask *cpus, struct mm_struct *mm, unsigned long va); int (*pgd_alloc)(struct mm_struct *mm); void (*pgd_free)(struct mm_struct *mm, pgd_t *pgd); void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn); void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn); void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn); void (*release_pte)(unsigned long pfn); void (*release_pmd)(unsigned long pfn); void (*release_pud)(unsigned long pfn); void (*set_pte)(pte_t *ptep, pte_t pteval); void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval); void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); void (*set_pmd_at)(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmdval); void (*pte_update)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); void (*pte_update_defer)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); void (*pmd_update)(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp); void (*pmd_update_defer)(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp); pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); void (*ptep_modify_prot_commit)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); struct paravirt_callee_save pte_val; struct paravirt_callee_save make_pte; struct paravirt_callee_save pgd_val; struct paravirt_callee_save make_pgd; void (*set_pud)(pud_t *pudp, pud_t pudval); struct paravirt_callee_save pmd_val; struct paravirt_callee_save make_pmd; struct paravirt_callee_save pud_val; struct paravirt_callee_save make_pud; void (*set_pgd)(pgd_t *pudp, pgd_t pgdval); struct pv_lazy_ops lazy_mode; void (*set_fixmap)(unsigned idx, phys_addr_t phys, pgprot_t flags); }; struct arch_spinlock; struct pv_lock_ops { int (*spin_is_locked)(struct arch_spinlock *lock); int (*spin_is_contended)(struct arch_spinlock *lock); void (*spin_lock)(struct arch_spinlock *lock); void (*spin_lock_flags)(struct arch_spinlock *lock, unsigned long flags); int (*spin_trylock)(struct arch_spinlock *lock); void (*spin_unlock)(struct arch_spinlock *lock); }; struct paravirt_patch_template { struct pv_init_ops pv_init_ops; struct pv_time_ops pv_time_ops; struct pv_cpu_ops pv_cpu_ops; struct pv_irq_ops pv_irq_ops; struct pv_apic_ops pv_apic_ops; struct pv_mmu_ops pv_mmu_ops; struct pv_lock_ops pv_lock_ops; }; extern struct pv_info pv_info; extern struct pv_init_ops pv_init_ops; extern struct pv_time_ops pv_time_ops; extern struct pv_cpu_ops pv_cpu_ops; extern struct pv_irq_ops pv_irq_ops; extern struct pv_apic_ops pv_apic_ops; extern struct pv_mmu_ops pv_mmu_ops; extern struct pv_lock_ops pv_lock_ops; unsigned paravirt_patch_nop(void); unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len); unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len); unsigned paravirt_patch_ignore(unsigned len); unsigned paravirt_patch_call(void *insnbuf, const void *target, u16 tgt_clobbers, unsigned long addr, u16 site_clobbers, unsigned len); unsigned paravirt_patch_jmp(void *insnbuf, const void *target, unsigned long addr, unsigned len); unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf, unsigned long addr, unsigned len); unsigned paravirt_patch_insns(void *insnbuf, unsigned len, const char *start, const char *end); unsigned native_patch(u8 type, u16 clobbers, void *ibuf, unsigned long addr, unsigned len); int paravirt_disable_iospace(void); enum paravirt_lazy_mode { PARAVIRT_LAZY_NONE, PARAVIRT_LAZY_MMU, PARAVIRT_LAZY_CPU, }; enum paravirt_lazy_mode paravirt_get_lazy_mode(void); void paravirt_start_context_switch(struct task_struct *prev); void paravirt_end_context_switch(struct task_struct *next); void paravirt_enter_lazy_mmu(void); void paravirt_leave_lazy_mmu(void); void _paravirt_nop(void); u32 _paravirt_ident_32(u32); u64 _paravirt_ident_64(u64); struct paravirt_patch_site { u8 *instr; u8 instrtype; u8 len; u16 clobbers; }; extern struct paravirt_patch_site __parainstructions[], __parainstructions_end[]; struct cpuinfo_x86; struct task_struct; extern unsigned long profile_pc(struct pt_regs *regs); extern unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs); extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code, int si_code); extern long syscall_trace_enter(struct pt_regs *); extern void syscall_trace_leave(struct pt_regs *); static inline __attribute__((no_instrument_function)) unsigned long regs_return_value(struct pt_regs *regs) { return regs->ax; } static inline __attribute__((no_instrument_function)) int user_mode(struct pt_regs *regs) { return !!(regs->cs & 3); } static inline __attribute__((no_instrument_function)) int user_mode_vm(struct pt_regs *regs) { return user_mode(regs); } static inline __attribute__((no_instrument_function)) int v8086_mode(struct pt_regs *regs) { return 0; } static inline __attribute__((no_instrument_function)) bool user_64bit_mode(struct pt_regs *regs) { return regs->cs == (6*8+3) || regs->cs == pv_info.extra_user_64bit_cs; } static inline __attribute__((no_instrument_function)) unsigned long kernel_stack_pointer(struct pt_regs *regs) { return regs->sp; } static inline __attribute__((no_instrument_function)) unsigned long instruction_pointer(struct pt_regs *regs) { return ((regs)->ip); } static inline __attribute__((no_instrument_function)) void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { (((regs)->ip) = (val)); } static inline __attribute__((no_instrument_function)) unsigned long user_stack_pointer(struct pt_regs *regs) { return ((regs)->sp); } static inline __attribute__((no_instrument_function)) void user_stack_pointer_set(struct pt_regs *regs, unsigned long val) { (((regs)->sp) = (val)); } static inline __attribute__((no_instrument_function)) unsigned long frame_pointer(struct pt_regs *regs) { return ((regs)->bp); } static inline __attribute__((no_instrument_function)) void frame_pointer_set(struct pt_regs *regs, unsigned long val) { (((regs)->bp) = (val)); } extern int regs_query_register_offset(const char *name); extern const char *regs_query_register_name(unsigned int offset); static inline __attribute__((no_instrument_function)) unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset) { if (ldv__builtin_expect(!!(offset > (__builtin_offsetof(struct pt_regs,ss))), 0)) return 0; return *(unsigned long *)((unsigned long)regs + offset); } static inline __attribute__((no_instrument_function)) int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr) { return ((addr & ~((((1UL) << 12) << 1) - 1)) == (kernel_stack_pointer(regs) & ~((((1UL) << 12) << 1) - 1))); } static inline __attribute__((no_instrument_function)) unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n) { unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); addr += n; if (regs_within_kernel_stack(regs, (unsigned long)addr)) return *addr; else return 0; } struct user_desc; extern int do_get_thread_area(struct task_struct *p, int idx, struct user_desc *info); extern int do_set_thread_area(struct task_struct *p, int idx, struct user_desc *info, int can_allocate); struct kernel_vm86_regs { struct pt_regs pt; unsigned short es, __esh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh; }; struct kernel_vm86_struct { struct kernel_vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; struct vm86plus_info_struct vm86plus; struct pt_regs *regs32; }; static inline __attribute__((no_instrument_function)) int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c) { return 0; } struct math_emu_info { long ___orig_eip; union { struct pt_regs *regs; struct kernel_vm86_regs *vm86; }; }; struct _fpx_sw_bytes { __u32 magic1; __u32 extended_size; __u64 xstate_bv; __u32 xstate_size; __u32 padding[7]; }; struct _fpstate { __u16 cwd; __u16 swd; __u16 twd; __u16 fop; __u64 rip; __u64 rdp; __u32 mxcsr; __u32 mxcsr_mask; __u32 st_space[32]; __u32 xmm_space[64]; __u32 reserved2[12]; union { __u32 reserved3[12]; struct _fpx_sw_bytes sw_reserved; }; }; struct sigcontext { unsigned long r8; unsigned long r9; unsigned long r10; unsigned long r11; unsigned long r12; unsigned long r13; unsigned long r14; unsigned long r15; unsigned long di; unsigned long si; unsigned long bp; unsigned long bx; unsigned long dx; unsigned long ax; unsigned long cx; unsigned long sp; unsigned long ip; unsigned long flags; unsigned short cs; unsigned short gs; unsigned short fs; unsigned short __pad0; unsigned long err; unsigned long trapno; unsigned long oldmask; unsigned long cr2; void *fpstate; unsigned long reserved1[8]; }; struct _xsave_hdr { __u64 xstate_bv; __u64 reserved1[2]; __u64 reserved2[5]; }; struct _ymmh_state { __u32 ymmh_space[64]; }; struct _xstate { struct _fpstate fpstate; struct _xsave_hdr xstate_hdr; struct _ymmh_state ymmh; }; extern void __bad_percpu_size(void); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int x86_this_cpu_constant_test_bit(unsigned int nr, const unsigned long *addr) { unsigned long *a = (unsigned long *)addr + nr / 64; return ((1UL << (nr % 64)) & ({ typeof(*a) pfo_ret__; switch (sizeof(*a)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (*a)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (*a)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (*a)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (*a)); break; default: __bad_percpu_size(); } pfo_ret__; })) != 0; } static inline __attribute__((no_instrument_function)) int x86_this_cpu_variable_test_bit(int nr, const unsigned long *addr) { int oldbit; asm volatile("bt ""%%""gs"":" "%P" "2"",%1\n\t" "sbb %0,%0" : "=r" (oldbit) : "m" (*(unsigned long *)addr), "Ir" (nr)); return oldbit; } extern unsigned long __per_cpu_offset[4096]; extern void setup_per_cpu_areas(void); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_this_cpu_off; extern __attribute__((section(".data..percpu" ""))) __typeof__(unsigned long) this_cpu_off; struct task_struct; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_current_task; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct task_struct *) current_task; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) struct task_struct *get_current(void) { return ({ typeof(current_task) pfo_ret__; switch (sizeof(current_task)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "p" (&(current_task))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(current_task))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(current_task))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(current_task))); break; default: __bad_percpu_size(); } pfo_ret__; }); } extern unsigned int __invalid_size_argument_for_IOC; extern char *strndup_user(const char *, long); extern void *memdup_user(const void *, size_t); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void *__inline_memcpy(void *to, const void *from, size_t n) { unsigned long d0, d1, d2; asm volatile("rep ; movsl\n\t" "testb $2,%b4\n\t" "je 1f\n\t" "movsw\n" "1:\ttestb $1,%b4\n\t" "je 2f\n\t" "movsb\n" "2:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "q" (n), "1" ((long)to), "2" ((long)from) : "memory"); return to; } extern void *__memcpy(void *to, const void *from, size_t len); void *memset(void *s, int c, size_t n); void *memmove(void *dest, const void *src, size_t count); int memcmp(const void *cs, const void *ct, size_t count); size_t strlen(const char *s); char *strcpy(char *dest, const char *src); char *strcat(char *dest, const char *src); int strcmp(const char *cs, const char *ct); extern char * strcpy(char *,const char *); extern char * strncpy(char *,const char *, __kernel_size_t); size_t strlcpy(char *, const char *, size_t); extern char * strcat(char *, const char *); extern char * strncat(char *, const char *, __kernel_size_t); extern size_t strlcat(char *, const char *, __kernel_size_t); extern int strcmp(const char *,const char *); extern int strncmp(const char *,const char *,__kernel_size_t); extern int strnicmp(const char *, const char *, __kernel_size_t); extern int strcasecmp(const char *s1, const char *s2); extern int strncasecmp(const char *s1, const char *s2, size_t n); extern char * strchr(const char *,int); extern char * strnchr(const char *, size_t, int); extern char * strrchr(const char *,int); extern char * __attribute__((warn_unused_result)) skip_spaces(const char *); extern char *strim(char *); static inline __attribute__((no_instrument_function)) __attribute__((warn_unused_result)) char *strstrip(char *str) { return strim(str); } extern char * strstr(const char *, const char *); extern char * strnstr(const char *, const char *, size_t); extern __kernel_size_t strlen(const char *); extern __kernel_size_t strnlen(const char *,__kernel_size_t); extern char * strpbrk(const char *,const char *); extern char * strsep(char **,const char *); extern __kernel_size_t strspn(const char *,const char *); extern __kernel_size_t strcspn(const char *,const char *); extern void * memscan(void *,int,__kernel_size_t); extern int memcmp(const void *,const void *,__kernel_size_t); extern void * memchr(const void *,int,__kernel_size_t); void *memchr_inv(const void *s, int c, size_t n); extern char *kstrdup(const char *s, gfp_t gfp); extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); extern bool sysfs_streq(const char *s1, const char *s2); extern int strtobool(const char *s, bool *res); int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4))); extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, const void *from, size_t available); static inline __attribute__((no_instrument_function)) bool strstarts(const char *str, const char *prefix) { return strncmp(str, prefix, strlen(prefix)) == 0; } extern int __bitmap_empty(const unsigned long *bitmap, int bits); extern int __bitmap_full(const unsigned long *bitmap, int bits); extern int __bitmap_equal(const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, int bits); extern void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, int shift, int bits); extern void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, int shift, int bits); extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern int __bitmap_intersects(const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern int __bitmap_subset(const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); extern int __bitmap_weight(const unsigned long *bitmap, int bits); extern void bitmap_set(unsigned long *map, int i, int len); extern void bitmap_clear(unsigned long *map, int start, int nr); extern unsigned long bitmap_find_next_zero_area(unsigned long *map, unsigned long size, unsigned long start, unsigned int nr, unsigned long align_mask); extern int bitmap_scnprintf(char *buf, unsigned int len, const unsigned long *src, int nbits); extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, unsigned long *dst, int nbits); extern int bitmap_parse_user(const char *ubuf, unsigned int ulen, unsigned long *dst, int nbits); extern int bitmap_scnlistprintf(char *buf, unsigned int len, const unsigned long *src, int nbits); extern int bitmap_parselist(const char *buf, unsigned long *maskp, int nmaskbits); extern int bitmap_parselist_user(const char *ubuf, unsigned int ulen, unsigned long *dst, int nbits); extern void bitmap_remap(unsigned long *dst, const unsigned long *src, const unsigned long *old, const unsigned long *new, int bits); extern int bitmap_bitremap(int oldbit, const unsigned long *old, const unsigned long *new, int bits); extern void bitmap_onto(unsigned long *dst, const unsigned long *orig, const unsigned long *relmap, int bits); extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, int sz, int bits); extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); static inline __attribute__((no_instrument_function)) void bitmap_zero(unsigned long *dst, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = 0UL; else { int len = (((nbits) + (8 * sizeof(long)) - 1) / (8 * sizeof(long))) * sizeof(unsigned long); memset(dst, 0, len); } } static inline __attribute__((no_instrument_function)) void bitmap_fill(unsigned long *dst, int nbits) { size_t nlongs = (((nbits) + (8 * sizeof(long)) - 1) / (8 * sizeof(long))); if (!(__builtin_constant_p(nbits) && (nbits) <= 64)) { int len = (nlongs - 1) * sizeof(unsigned long); memset(dst, 0xff, len); } dst[nlongs - 1] = ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL ); } static inline __attribute__((no_instrument_function)) void bitmap_copy(unsigned long *dst, const unsigned long *src, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = *src; else { int len = (((nbits) + (8 * sizeof(long)) - 1) / (8 * sizeof(long))) * sizeof(unsigned long); ({ size_t __len = (len); void *__ret; if (__builtin_constant_p(len) && __len >= 64) __ret = __memcpy((dst), (src), __len); else __ret = __builtin_memcpy((dst), (src), __len); __ret; }); } } static inline __attribute__((no_instrument_function)) int bitmap_and(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return (*dst = *src1 & *src2) != 0; return __bitmap_and(dst, src1, src2, nbits); } static inline __attribute__((no_instrument_function)) void bitmap_or(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = *src1 | *src2; else __bitmap_or(dst, src1, src2, nbits); } static inline __attribute__((no_instrument_function)) void bitmap_xor(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = *src1 ^ *src2; else __bitmap_xor(dst, src1, src2, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_andnot(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return (*dst = *src1 & ~(*src2)) != 0; return __bitmap_andnot(dst, src1, src2, nbits); } static inline __attribute__((no_instrument_function)) void bitmap_complement(unsigned long *dst, const unsigned long *src, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = ~(*src) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL ); else __bitmap_complement(dst, src, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_equal(const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return ! ((*src1 ^ *src2) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )); else return __bitmap_equal(src1, src2, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_intersects(const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return ((*src1 & *src2) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )) != 0; else return __bitmap_intersects(src1, src2, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_subset(const unsigned long *src1, const unsigned long *src2, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return ! ((*src1 & ~(*src2)) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )); else return __bitmap_subset(src1, src2, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_empty(const unsigned long *src, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return ! (*src & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )); else return __bitmap_empty(src, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_full(const unsigned long *src, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return ! (~(*src) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )); else return __bitmap_full(src, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_weight(const unsigned long *src, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) return hweight_long(*src & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL )); return __bitmap_weight(src, nbits); } static inline __attribute__((no_instrument_function)) void bitmap_shift_right(unsigned long *dst, const unsigned long *src, int n, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = *src >> n; else __bitmap_shift_right(dst, src, n, nbits); } static inline __attribute__((no_instrument_function)) void bitmap_shift_left(unsigned long *dst, const unsigned long *src, int n, int nbits) { if ((__builtin_constant_p(nbits) && (nbits) <= 64)) *dst = (*src << n) & ( ((nbits) % 64) ? (1UL<<((nbits) % 64))-1 : ~0UL ); else __bitmap_shift_left(dst, src, n, nbits); } static inline __attribute__((no_instrument_function)) int bitmap_parse(const char *buf, unsigned int buflen, unsigned long *maskp, int nmaskbits) { return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits); } struct bug_entry { signed int bug_addr_disp; signed int file_disp; unsigned short line; unsigned short flags; }; extern __attribute__((format(printf, 3, 4))) void warn_slowpath_fmt(const char *file, const int line, const char *fmt, ...); extern __attribute__((format(printf, 4, 5))) void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, const char *fmt, ...); extern void warn_slowpath_null(const char *file, const int line); extern void show_regs_common(void); enum bug_trap_type { BUG_TRAP_TYPE_NONE = 0, BUG_TRAP_TYPE_WARN = 1, BUG_TRAP_TYPE_BUG = 2, }; struct pt_regs; static inline __attribute__((no_instrument_function)) int is_warning_bug(const struct bug_entry *bug) { return bug->flags & (1 << 0); } const struct bug_entry *find_bug(unsigned long bugaddr); enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); int is_valid_bugaddr(unsigned long addr); typedef struct cpumask { unsigned long bits[(((4096) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; } cpumask_t; extern int nr_cpu_ids; extern const struct cpumask *const cpu_possible_mask; extern const struct cpumask *const cpu_online_mask; extern const struct cpumask *const cpu_present_mask; extern const struct cpumask *const cpu_active_mask; static inline __attribute__((no_instrument_function)) unsigned int cpumask_check(unsigned int cpu) { ({ static bool __attribute__ ((__section__(".data.unlikely"))) __warned; int __ret_warn_once = !!(cpu >= nr_cpu_ids); if (ldv__builtin_expect(!!(__ret_warn_once), 0)) if (({ int __ret_warn_on = !!(!__warned); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/cpumask.h", 108); ldv__builtin_expect(!!(__ret_warn_on), 0); })) __warned = true; ldv__builtin_expect(!!(__ret_warn_once), 0); }); return cpu; } static inline __attribute__((no_instrument_function)) unsigned int cpumask_first(const struct cpumask *srcp) { return find_first_bit(((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) unsigned int cpumask_next(int n, const struct cpumask *srcp) { if (n != -1) cpumask_check(n); return find_next_bit(((srcp)->bits), nr_cpu_ids, n+1); } static inline __attribute__((no_instrument_function)) unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) { if (n != -1) cpumask_check(n); return find_next_zero_bit(((srcp)->bits), nr_cpu_ids, n+1); } int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); static inline __attribute__((no_instrument_function)) void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp) { set_bit(cpumask_check(cpu), ((dstp)->bits)); } static inline __attribute__((no_instrument_function)) void cpumask_clear_cpu(int cpu, struct cpumask *dstp) { clear_bit(cpumask_check(cpu), ((dstp)->bits)); } static inline __attribute__((no_instrument_function)) int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask) { return test_and_set_bit(cpumask_check(cpu), ((cpumask)->bits)); } static inline __attribute__((no_instrument_function)) int cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask) { return test_and_clear_bit(cpumask_check(cpu), ((cpumask)->bits)); } static inline __attribute__((no_instrument_function)) void cpumask_setall(struct cpumask *dstp) { bitmap_fill(((dstp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_clear(struct cpumask *dstp) { bitmap_zero(((dstp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_and(struct cpumask *dstp, const struct cpumask *src1p, const struct cpumask *src2p) { return bitmap_and(((dstp)->bits), ((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p, const struct cpumask *src2p) { bitmap_or(((dstp)->bits), ((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_xor(struct cpumask *dstp, const struct cpumask *src1p, const struct cpumask *src2p) { bitmap_xor(((dstp)->bits), ((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_andnot(struct cpumask *dstp, const struct cpumask *src1p, const struct cpumask *src2p) { return bitmap_andnot(((dstp)->bits), ((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_complement(struct cpumask *dstp, const struct cpumask *srcp) { bitmap_complement(((dstp)->bits), ((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) bool cpumask_equal(const struct cpumask *src1p, const struct cpumask *src2p) { return bitmap_equal(((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) bool cpumask_intersects(const struct cpumask *src1p, const struct cpumask *src2p) { return bitmap_intersects(((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_subset(const struct cpumask *src1p, const struct cpumask *src2p) { return bitmap_subset(((src1p)->bits), ((src2p)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) bool cpumask_empty(const struct cpumask *srcp) { return bitmap_empty(((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) bool cpumask_full(const struct cpumask *srcp) { return bitmap_full(((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) unsigned int cpumask_weight(const struct cpumask *srcp) { return bitmap_weight(((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_shift_right(struct cpumask *dstp, const struct cpumask *srcp, int n) { bitmap_shift_right(((dstp)->bits), ((srcp)->bits), n, nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_shift_left(struct cpumask *dstp, const struct cpumask *srcp, int n) { bitmap_shift_left(((dstp)->bits), ((srcp)->bits), n, nr_cpu_ids); } static inline __attribute__((no_instrument_function)) void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp) { bitmap_copy(((dstp)->bits), ((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_scnprintf(char *buf, int len, const struct cpumask *srcp) { return bitmap_scnprintf(buf, len, ((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_parse_user(const char *buf, int len, struct cpumask *dstp) { return bitmap_parse_user(buf, len, ((dstp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpumask_parselist_user(const char *buf, int len, struct cpumask *dstp) { return bitmap_parselist_user(buf, len, ((dstp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpulist_scnprintf(char *buf, int len, const struct cpumask *srcp) { return bitmap_scnlistprintf(buf, len, ((srcp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int cpulist_parse(const char *buf, struct cpumask *dstp) { return bitmap_parselist(buf, ((dstp)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) size_t cpumask_size(void) { return (((4096) + (8 * sizeof(long)) - 1) / (8 * sizeof(long))) * sizeof(long); } typedef struct cpumask *cpumask_var_t; bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); void alloc_bootmem_cpumask_var(cpumask_var_t *mask); void free_cpumask_var(cpumask_var_t mask); void free_bootmem_cpumask_var(cpumask_var_t mask); extern const unsigned long cpu_all_bits[(((4096) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; void set_cpu_possible(unsigned int cpu, bool possible); void set_cpu_present(unsigned int cpu, bool present); void set_cpu_online(unsigned int cpu, bool online); void set_cpu_active(unsigned int cpu, bool active); void init_cpu_present(const struct cpumask *src); void init_cpu_possible(const struct cpumask *src); void init_cpu_online(const struct cpumask *src); static inline __attribute__((no_instrument_function)) int __check_is_bitmap(const unsigned long *bitmap) { return 1; } extern const unsigned long cpu_bit_bitmap[64 +1][(((4096) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; static inline __attribute__((no_instrument_function)) const struct cpumask *get_cpu_mask(unsigned int cpu) { const unsigned long *p = cpu_bit_bitmap[1 + cpu % 64]; p -= cpu / 64; return ((struct cpumask *)(1 ? (p) : (void *)sizeof(__check_is_bitmap(p)))); } int __first_cpu(const cpumask_t *srcp); int __next_cpu(int n, const cpumask_t *srcp); int __next_cpu_nr(int n, const cpumask_t *srcp); static inline __attribute__((no_instrument_function)) void __cpu_set(int cpu, volatile cpumask_t *dstp) { set_bit(cpu, dstp->bits); } static inline __attribute__((no_instrument_function)) void __cpu_clear(int cpu, volatile cpumask_t *dstp) { clear_bit(cpu, dstp->bits); } static inline __attribute__((no_instrument_function)) void __cpus_setall(cpumask_t *dstp, int nbits) { bitmap_fill(dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __cpus_clear(cpumask_t *dstp, int nbits) { bitmap_zero(dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpu_test_and_set(int cpu, cpumask_t *addr) { return test_and_set_bit(cpu, addr->bits); } static inline __attribute__((no_instrument_function)) int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_equal(const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { return bitmap_equal(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_intersects(const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { return bitmap_intersects(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_subset(const cpumask_t *src1p, const cpumask_t *src2p, int nbits) { return bitmap_subset(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_empty(const cpumask_t *srcp, int nbits) { return bitmap_empty(srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __cpus_weight(const cpumask_t *srcp, int nbits) { return bitmap_weight(srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __cpus_shift_left(cpumask_t *dstp, const cpumask_t *srcp, int n, int nbits) { bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); } extern cpumask_var_t cpu_callin_mask; extern cpumask_var_t cpu_callout_mask; extern cpumask_var_t cpu_initialized_mask; extern cpumask_var_t cpu_sibling_setup_mask; extern void setup_cpu_local_masks(void); struct msr { union { struct { u32 l; u32 h; }; u64 q; }; }; struct msr_info { u32 msr_no; struct msr reg; struct msr *msrs; int err; }; struct msr_regs_info { u32 *regs; int err; }; static inline __attribute__((no_instrument_function)) unsigned long long native_read_tscp(unsigned int *aux) { unsigned long low, high; asm volatile(".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (*aux)); return low | ((u64)high << 32); } static inline __attribute__((no_instrument_function)) unsigned long long native_read_msr(unsigned int msr) { unsigned low, high; asm volatile("rdmsr" : "=a" (low), "=d" (high) : "c" (msr)); return ((low) | ((u64)(high) << 32)); } static inline __attribute__((no_instrument_function)) unsigned long long native_read_msr_safe(unsigned int msr, int *err) { unsigned low, high; asm volatile("2: rdmsr ; xor %[err],%[err]\n" "1:\n\t" ".section .fixup,\"ax\"\n\t" "3: mov %[fault],%[err] ; jmp 1b\n\t" ".previous\n\t" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "2b" "," "3b" "\n" " .previous\n" : [err] "=r" (*err), "=a" (low), "=d" (high) : "c" (msr), [fault] "i" (-5)); return ((low) | ((u64)(high) << 32)); } static inline __attribute__((no_instrument_function)) void native_write_msr(unsigned int msr, unsigned low, unsigned high) { asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory"); } __attribute__((no_instrument_function)) static inline __attribute__((no_instrument_function)) int native_write_msr_safe(unsigned int msr, unsigned low, unsigned high) { int err; asm volatile("2: wrmsr ; xor %[err],%[err]\n" "1:\n\t" ".section .fixup,\"ax\"\n\t" "3: mov %[fault],%[err] ; jmp 1b\n\t" ".previous\n\t" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "2b" "," "3b" "\n" " .previous\n" : [err] "=a" (err) : "c" (msr), "0" (low), "d" (high), [fault] "i" (-5) : "memory"); return err; } extern unsigned long long native_read_tsc(void); extern int native_rdmsr_safe_regs(u32 regs[8]); extern int native_wrmsr_safe_regs(u32 regs[8]); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) unsigned long long __native_read_tsc(void) { unsigned low, high; asm volatile("rdtsc" : "=a" (low), "=d" (high)); return ((low) | ((u64)(high) << 32)); } static inline __attribute__((no_instrument_function)) unsigned long long native_read_pmc(int counter) { unsigned low, high; asm volatile("rdpmc" : "=a" (low), "=d" (high) : "c" (counter)); return ((low) | ((u64)(high) << 32)); } static inline __attribute__((no_instrument_function)) int paravirt_enabled(void) { return pv_info.paravirt_enabled; } static inline __attribute__((no_instrument_function)) void load_sp0(struct tss_struct *tss, struct thread_struct *thread) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_sp0 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (25), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_sp0) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_sp0)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(tss)), "S" ((unsigned long)(thread)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.cpuid == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (32), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.cpuid) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.cpuid)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(eax)), "S" ((unsigned long)(ebx)), "d" ((unsigned long)(ecx)), "c" ((unsigned long)(edx)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long paravirt_get_debugreg(int reg) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.get_debugreg == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (40), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.get_debugreg) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.get_debugreg)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(reg)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.get_debugreg) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.get_debugreg)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(reg)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void set_debugreg(unsigned long val, int reg) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.set_debugreg == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (45), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.set_debugreg) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.set_debugreg)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(reg)), "S" ((unsigned long)(val)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void clts(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.clts == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (50), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.clts) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.clts)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr0(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_cr0 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (55), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr0) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr0)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr0) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr0)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void write_cr0(unsigned long x) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_cr0 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (60), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_cr0) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_cr0)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(x)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr2(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.read_cr2 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (65), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.read_cr2) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.read_cr2)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.read_cr2) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.read_cr2)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void write_cr2(unsigned long x) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.write_cr2 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (70), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.write_cr2) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.write_cr2)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(x)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr3(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.read_cr3 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (75), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.read_cr3) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.read_cr3)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.read_cr3) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.read_cr3)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void write_cr3(unsigned long x) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.write_cr3 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (80), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.write_cr3) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.write_cr3)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(x)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr4(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_cr4 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (85), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr4) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr4)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr4) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr4)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr4_safe(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_cr4_safe == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (89), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr4_safe) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr4_safe)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr4_safe) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr4_safe)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void write_cr4(unsigned long x) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_cr4 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (94), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_cr4) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_cr4)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(x)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long read_cr8(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_cr8 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (100), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr8) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr8)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_cr8) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_cr8)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void write_cr8(unsigned long x) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_cr8 == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (105), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_cr8) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_cr8)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(x)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_safe_halt(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.safe_halt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (111), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.safe_halt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.safe_halt)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void halt(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.halt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (116), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.halt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.halt)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void wbinvd(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.wbinvd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (121), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.wbinvd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.wbinvd)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) u64 paravirt_read_msr(unsigned msr, int *err) { return ({ u64 __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_msr == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (128), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(u64) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_msr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_msr)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(msr)), "S" ((unsigned long)(err)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_msr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_msr)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(msr)), "S" ((unsigned long)(err)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) int paravirt_rdmsr_regs(u32 *regs) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.rdmsr_regs == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (133), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.rdmsr_regs) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.rdmsr_regs)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(regs)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.rdmsr_regs) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.rdmsr_regs)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(regs)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_msr == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (138), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_msr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_msr)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(msr)), "S" ((unsigned long)(low)), "d" ((unsigned long)(high)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_msr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_msr)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(msr)), "S" ((unsigned long)(low)), "d" ((unsigned long)(high)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) int paravirt_wrmsr_regs(u32 *regs) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.wrmsr_regs == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (143), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.wrmsr_regs) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.wrmsr_regs)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(regs)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.wrmsr_regs) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.wrmsr_regs)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(regs)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) int rdmsrl_safe(unsigned msr, unsigned long long *p) { int err; *p = paravirt_read_msr(msr, &err); return err; } static inline __attribute__((no_instrument_function)) int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) { u32 gprs[8] = { 0 }; int err; gprs[1] = msr; gprs[7] = 0x9c5a203a; err = paravirt_rdmsr_regs(gprs); *p = gprs[0] | ((u64)gprs[2] << 32); return err; } static inline __attribute__((no_instrument_function)) int wrmsrl_amd_safe(unsigned msr, unsigned long long val) { u32 gprs[8] = { 0 }; gprs[0] = (u32)val; gprs[1] = msr; gprs[2] = val >> 32; gprs[7] = 0x9c5a203a; return paravirt_wrmsr_regs(gprs); } static inline __attribute__((no_instrument_function)) u64 paravirt_read_tsc(void) { return ({ u64 __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_tsc == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (218), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(u64) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_tsc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_tsc)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_tsc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_tsc)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) unsigned long long paravirt_sched_clock(void) { return ({ unsigned long long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_time_ops.sched_clock == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (231), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_time_ops.sched_clock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_time_ops.sched_clock)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_time_ops.sched_clock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_time_ops.sched_clock)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long long)__eax; } __ret; }); } struct static_key; extern struct static_key paravirt_steal_enabled; extern struct static_key paravirt_steal_rq_enabled; static inline __attribute__((no_instrument_function)) u64 paravirt_steal_clock(int cpu) { return ({ u64 __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_time_ops.steal_clock == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (240), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(u64) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_time_ops.steal_clock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_time_ops.steal_clock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(cpu)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_time_ops.steal_clock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_time_ops.steal_clock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(cpu)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) unsigned long long paravirt_read_pmc(int counter) { return ({ u64 __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_pmc == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (245), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(u64) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_pmc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_pmc)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(counter)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_pmc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_pmc)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(counter)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) unsigned long long paravirt_rdtscp(unsigned int *aux) { return ({ u64 __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.read_tscp == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (257), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(u64) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_tscp) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_tscp)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(aux)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.read_tscp) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.read_tscp)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(aux)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (u64)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.alloc_ldt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (278), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.alloc_ldt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.alloc_ldt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(ldt)), "S" ((unsigned long)(entries)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.free_ldt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (283), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.free_ldt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.free_ldt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(ldt)), "S" ((unsigned long)(entries)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void load_TR_desc(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_tr_desc == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (288), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_tr_desc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_tr_desc)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void load_gdt(const struct desc_ptr *dtr) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_gdt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (292), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_gdt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_gdt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dtr)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void load_idt(const struct desc_ptr *dtr) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_idt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (296), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_idt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_idt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dtr)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void set_ldt(const void *addr, unsigned entries) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.set_ldt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (300), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.set_ldt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.set_ldt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(addr)), "S" ((unsigned long)(entries)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void store_gdt(struct desc_ptr *dtr) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.store_gdt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (304), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.store_gdt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.store_gdt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dtr)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void store_idt(struct desc_ptr *dtr) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.store_idt == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (308), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.store_idt) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.store_idt)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dtr)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) unsigned long paravirt_store_tr(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.store_tr == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (312), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.store_tr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.store_tr)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.store_tr) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.store_tr)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void load_TLS(struct thread_struct *t, unsigned cpu) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_tls == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (317), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_tls) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_tls)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(t)), "S" ((unsigned long)(cpu)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void load_gs_index(unsigned int gs) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.load_gs_index == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (323), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.load_gs_index) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.load_gs_index)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(gs)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void write_ldt_entry(struct desc_struct *dt, int entry, const void *desc) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_ldt_entry == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (330), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_ldt_entry) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_ldt_entry)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dt)), "S" ((unsigned long)(entry)), "d" ((unsigned long)(desc)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void write_gdt_entry(struct desc_struct *dt, int entry, void *desc, int type) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_gdt_entry == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (336), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_gdt_entry) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_gdt_entry)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dt)), "S" ((unsigned long)(entry)), "d" ((unsigned long)(desc)), "c" ((unsigned long)(type)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.write_idt_entry == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (341), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.write_idt_entry) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.write_idt_entry)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(dt)), "S" ((unsigned long)(entry)), "d" ((unsigned long)(g)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void set_iopl_mask(unsigned mask) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.set_iopl_mask == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (345), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.set_iopl_mask) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.set_iopl_mask)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mask)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void slow_down_io(void) { pv_cpu_ops.io_delay(); } static inline __attribute__((no_instrument_function)) void startup_ipi_hook(int phys_apicid, unsigned long start_eip, unsigned long start_esp) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_apic_ops.startup_ipi_hook == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 364 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_apic_ops.startup_ipi_hook) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_apic_ops.startup_ipi_hook)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(phys_apicid)), "S" ((unsigned long)(start_eip)), "d" ((unsigned long)(start_esp)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) void paravirt_activate_mm(struct mm_struct *prev, struct mm_struct *next) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.activate_mm == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (371), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.activate_mm) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.activate_mm)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(prev)), "S" ((unsigned long)(next)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.dup_mmap == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (377), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.dup_mmap) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.dup_mmap)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(oldmm)), "S" ((unsigned long)(mm)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_exit_mmap(struct mm_struct *mm) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.exit_mmap == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (382), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.exit_mmap) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.exit_mmap)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void __flush_tlb(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.flush_tlb_user == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (387), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.flush_tlb_user) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.flush_tlb_user)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void __flush_tlb_global(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.flush_tlb_kernel == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (391), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.flush_tlb_kernel) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.flush_tlb_kernel)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void __flush_tlb_single(unsigned long addr) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.flush_tlb_single == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (395), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.flush_tlb_single) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.flush_tlb_single)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(addr)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, unsigned long va) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.flush_tlb_others == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (402), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.flush_tlb_others) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.flush_tlb_others)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(cpumask)), "S" ((unsigned long)(mm)), "d" ((unsigned long)(va)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) int paravirt_pgd_alloc(struct mm_struct *mm) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pgd_alloc == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (407), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_alloc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_alloc)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_alloc) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_alloc)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pgd_free == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (412), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_free) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_free)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(pgd)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.alloc_pte == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (417), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.alloc_pte) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.alloc_pte)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_release_pte(unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.release_pte == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (421), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.release_pte) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.release_pte)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.alloc_pmd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (426), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.alloc_pmd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.alloc_pmd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_release_pmd(unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.release_pmd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (431), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.release_pmd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.release_pmd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.alloc_pud == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (436), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.alloc_pud) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.alloc_pud)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void paravirt_release_pud(unsigned long pfn) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.release_pud == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (440), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.release_pud) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.release_pud)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pfn)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void pte_update(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pte_update == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (446), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_update) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_update)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void pmd_update(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pmd_update == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (451), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_update) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_update)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(pmdp)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void pte_update_defer(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pte_update_defer == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (457), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_update_defer) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_update_defer)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void pmd_update_defer(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pmd_update_defer == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (463), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_update_defer) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_update_defer)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(pmdp)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) pte_t __pte(pteval_t val) { pteval_t ret; if (sizeof(pteval_t) > sizeof(long)) ret = ({ pteval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pte.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 473 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pteval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pte.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pte.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pteval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pte.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pte.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pteval_t)__eax; } __ret; }) ; else ret = ({ pteval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pte.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 477 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pteval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pte.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pte.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pteval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pte.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pte.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pteval_t)__eax; } __ret; }) ; return (pte_t) { .pte = ret }; } static inline __attribute__((no_instrument_function)) pteval_t pte_val(pte_t pte) { pteval_t ret; if (sizeof(pteval_t) > sizeof(long)) ret = ({ pteval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pte_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 488 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pteval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pte.pte)), "S" ((unsigned long)((u64)pte.pte >> 32)) : "memory", "cc" ); __ret = (pteval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pte.pte)), "S" ((unsigned long)((u64)pte.pte >> 32)) : "memory", "cc" ); __ret = (pteval_t)__eax; } __ret; }) ; else ret = ({ pteval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pte_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 491 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pteval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pte.pte)) : "memory", "cc" ); __ret = (pteval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pte_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pte_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pte.pte)) : "memory", "cc" ); __ret = (pteval_t)__eax; } __ret; }) ; return ret; } static inline __attribute__((no_instrument_function)) pgd_t __pgd(pgdval_t val) { pgdval_t ret; if (sizeof(pgdval_t) > sizeof(long)) ret = ({ pgdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pgd.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 502 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pgdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pgd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pgd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pgdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pgd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pgd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pgdval_t)__eax; } __ret; }) ; else ret = ({ pgdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pgd.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 505 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pgdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pgd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pgd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pgdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pgd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pgd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pgdval_t)__eax; } __ret; }) ; return (pgd_t) { ret }; } static inline __attribute__((no_instrument_function)) pgdval_t pgd_val(pgd_t pgd) { pgdval_t ret; if (sizeof(pgdval_t) > sizeof(long)) ret = ({ pgdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pgd_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 516 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pgdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pgd.pgd)), "S" ((unsigned long)((u64)pgd.pgd >> 32)) : "memory", "cc" ); __ret = (pgdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pgd.pgd)), "S" ((unsigned long)((u64)pgd.pgd >> 32)) : "memory", "cc" ); __ret = (pgdval_t)__eax; } __ret; }) ; else ret = ({ pgdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pgd_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 519 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pgdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pgd.pgd)) : "memory", "cc" ); __ret = (pgdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pgd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pgd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pgd.pgd)) : "memory", "cc" ); __ret = (pgdval_t)__eax; } __ret; }) ; return ret; } static inline __attribute__((no_instrument_function)) pte_t ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pteval_t ret; ret = ({ pteval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.ptep_modify_prot_start == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 531 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pteval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.ptep_modify_prot_start) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.ptep_modify_prot_start)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (pteval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.ptep_modify_prot_start) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.ptep_modify_prot_start)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (pteval_t)__eax; } __ret; }) ; return (pte_t) { .pte = ret }; } static inline __attribute__((no_instrument_function)) void ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) pv_mmu_ops.ptep_modify_prot_commit(mm, addr, ptep, pte); else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.ptep_modify_prot_commit == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 544 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.ptep_modify_prot_commit) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.ptep_modify_prot_commit)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)), "c" ((unsigned long)(pte.pte)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) void set_pte(pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pte == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 551 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pte) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pte)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(ptep)), "S" ((unsigned long)(pte.pte)), "d" ((unsigned long)((u64)pte.pte >> 32)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pte == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 554 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pte) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pte)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(ptep)), "S" ((unsigned long)(pte.pte)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) pv_mmu_ops.set_pte_at(mm, addr, ptep, pte); else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pte_at == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (564), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pte_at) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pte_at)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(ptep)), "c" ((unsigned long)(pte.pte)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { if (sizeof(pmdval_t) > sizeof(long)) pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd); else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pmd_at == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 576 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pmd_at) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pmd_at)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(mm)), "S" ((unsigned long)(addr)), "d" ((unsigned long)(pmdp)), "c" ((unsigned long)(native_pmd_val(pmd))) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) void set_pmd(pmd_t *pmdp, pmd_t pmd) { pmdval_t val = native_pmd_val(pmd); if (sizeof(pmdval_t) > sizeof(long)) ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pmd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (585), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pmd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pmd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pmdp)), "S" ((unsigned long)(val)), "d" ((unsigned long)((u64)val >> 32)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pmd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (587), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pmd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pmd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pmdp)), "S" ((unsigned long)(val)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) pmd_t __pmd(pmdval_t val) { pmdval_t ret; if (sizeof(pmdval_t) > sizeof(long)) ret = ({ pmdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pmd.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 597 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pmdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pmd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pmd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pmdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pmd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pmd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pmdval_t)__eax; } __ret; }) ; else ret = ({ pmdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pmd.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 600 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pmdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pmd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pmd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pmdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pmd.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pmd.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pmdval_t)__eax; } __ret; }) ; return (pmd_t) { ret }; } static inline __attribute__((no_instrument_function)) pmdval_t pmd_val(pmd_t pmd) { pmdval_t ret; if (sizeof(pmdval_t) > sizeof(long)) ret = ({ pmdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pmd_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 611 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pmdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pmd.pmd)), "S" ((unsigned long)((u64)pmd.pmd >> 32)) : "memory", "cc" ); __ret = (pmdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pmd.pmd)), "S" ((unsigned long)((u64)pmd.pmd >> 32)) : "memory", "cc" ); __ret = (pmdval_t)__eax; } __ret; }) ; else ret = ({ pmdval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pmd_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 614 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pmdval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pmd.pmd)) : "memory", "cc" ); __ret = (pmdval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pmd_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pmd_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pmd.pmd)) : "memory", "cc" ); __ret = (pmdval_t)__eax; } __ret; }) ; return ret; } static inline __attribute__((no_instrument_function)) void set_pud(pud_t *pudp, pud_t pud) { pudval_t val = native_pud_val(pud); if (sizeof(pudval_t) > sizeof(long)) ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pud == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 625 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pud) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pud)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pudp)), "S" ((unsigned long)(val)), "d" ((unsigned long)((u64)val >> 32)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pud == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 628 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pud) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pud)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pudp)), "S" ((unsigned long)(val)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) pud_t __pud(pudval_t val) { pudval_t ret; if (sizeof(pudval_t) > sizeof(long)) ret = ({ pudval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pud.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 637 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pudval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pud.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pud.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pudval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pud.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pud.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)), "S" ((unsigned long)((u64)val >> 32)) : "memory", "cc" ); __ret = (pudval_t)__eax; } __ret; }) ; else ret = ({ pudval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.make_pud.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 640 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pudval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pud.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pud.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pudval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.make_pud.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.make_pud.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(val)) : "memory", "cc" ); __ret = (pudval_t)__eax; } __ret; }) ; return (pud_t) { ret }; } static inline __attribute__((no_instrument_function)) pudval_t pud_val(pud_t pud) { pudval_t ret; if (sizeof(pudval_t) > sizeof(long)) ret = ({ pudval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pud_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 651 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pudval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pud_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pud_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pud.pud)), "S" ((unsigned long)((u64)pud.pud >> 32)) : "memory", "cc" ); __ret = (pudval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pud_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pud_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pud.pud)), "S" ((unsigned long)((u64)pud.pud >> 32)) : "memory", "cc" ); __ret = (pudval_t)__eax; } __ret; }) ; else ret = ({ pudval_t __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.pud_val.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 654 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(pudval_t) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pud_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pud_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pud.pud)) : "memory", "cc" ); __ret = (pudval_t)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.pud_val.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.pud_val.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(pud.pud)) : "memory", "cc" ); __ret = (pudval_t)__eax; } __ret; }) ; return ret; } static inline __attribute__((no_instrument_function)) void set_pgd(pgd_t *pgdp, pgd_t pgd) { pgdval_t val = native_pgd_val(pgd); if (sizeof(pgdval_t) > sizeof(long)) ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pgd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 665 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pgd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pgd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pgdp)), "S" ((unsigned long)(val)), "d" ((unsigned long)((u64)val >> 32)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; else ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.set_pgd == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h" ), "i" ( 668 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.set_pgd) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.set_pgd)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(pgdp)), "S" ((unsigned long)(val)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }) ; } static inline __attribute__((no_instrument_function)) void pgd_clear(pgd_t *pgdp) { set_pgd(pgdp, __pgd(0)); } static inline __attribute__((no_instrument_function)) void pud_clear(pud_t *pudp) { set_pud(pudp, __pud(0)); } static inline __attribute__((no_instrument_function)) void set_pte_atomic(pte_t *ptep, pte_t pte) { set_pte(ptep, pte); } static inline __attribute__((no_instrument_function)) void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { set_pte_at(mm, addr, ptep, __pte(0)); } static inline __attribute__((no_instrument_function)) void pmd_clear(pmd_t *pmdp) { set_pmd(pmdp, __pmd(0)); } static inline __attribute__((no_instrument_function)) void arch_start_context_switch(struct task_struct *prev) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.start_context_switch == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (725), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.start_context_switch) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.start_context_switch)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(prev)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_end_context_switch(struct task_struct *next) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_cpu_ops.end_context_switch == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (730), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_cpu_ops.end_context_switch) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_cpu_ops.end_context_switch)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(next)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_enter_lazy_mmu_mode(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.lazy_mode.enter == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (736), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.lazy_mode.enter) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.lazy_mode.enter)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) void arch_leave_lazy_mmu_mode(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_mmu_ops.lazy_mode.leave == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (741), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_mmu_ops.lazy_mode.leave) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_mmu_ops.lazy_mode.leave)), [paravirt_clobber] "i" (((1 << 9) - 1)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } void arch_flush_lazy_mmu_mode(void); static inline __attribute__((no_instrument_function)) void __set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t flags) { pv_mmu_ops.set_fixmap(idx, phys, flags); } static inline __attribute__((no_instrument_function)) int arch_spin_is_locked(struct arch_spinlock *lock) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_is_locked == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (756), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_is_locked) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_is_locked)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_is_locked) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_is_locked)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) int arch_spin_is_contended(struct arch_spinlock *lock) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_is_contended == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (761), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_is_contended) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_is_contended)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_is_contended) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_is_contended)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void arch_spin_lock(struct arch_spinlock *lock) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_lock == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (767), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_lock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_lock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void arch_spin_lock_flags(struct arch_spinlock *lock, unsigned long flags) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_lock_flags == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (773), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_lock_flags) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_lock_flags)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)), "S" ((unsigned long)(flags)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int arch_spin_trylock(struct arch_spinlock *lock) { return ({ int __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_trylock == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (778), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(int) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_trylock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_trylock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx), "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_trylock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_trylock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "r8", "r9", "r10", "r11"); __ret = (int)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void arch_spin_unlock(struct arch_spinlock *lock) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_lock_ops.spin_unlock == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (783), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=D" (__edi), "=S" (__esi), "=d" (__edx), "=c" (__ecx) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_lock_ops.spin_unlock) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_lock_ops.spin_unlock)), [paravirt_clobber] "i" (((1 << 9) - 1)), "D" ((unsigned long)(lock)) : "memory", "cc" , "rax", "r8", "r9", "r10", "r11"); }); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) unsigned long arch_local_save_flags(void) { return ({ unsigned long __ret; unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.save_fl.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (863), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (sizeof(unsigned long) > sizeof(unsigned long)) { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.save_fl.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.save_fl.func)), [paravirt_clobber] "i" (((1 << 0))) : "memory", "cc" ); __ret = (unsigned long)((((u64)__edx) << 32) | __eax); } else { asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.save_fl.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.save_fl.func)), [paravirt_clobber] "i" (((1 << 0))) : "memory", "cc" ); __ret = (unsigned long)__eax; } __ret; }); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) void arch_local_irq_restore(unsigned long f) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.restore_fl.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (868), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.restore_fl.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.restore_fl.func)), [paravirt_clobber] "i" (((1 << 0))), "D" ((unsigned long)(f)) : "memory", "cc" ); }); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) void arch_local_irq_disable(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.irq_disable.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (873), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.irq_disable.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.irq_disable.func)), [paravirt_clobber] "i" (((1 << 0))) : "memory", "cc" ); }); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) void arch_local_irq_enable(void) { ({ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx, __eax = __eax; do { if (ldv__builtin_expect(!!(pv_irq_ops.irq_enable.func == ((void *)0)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/paravirt.h"), "i" (878), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); asm volatile("" "771:\n\t" "call *%c[paravirt_opptr];" "\n" "772:\n" ".pushsection .parainstructions,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " " 771b\n" " .byte " "%c[paravirt_typenum]" "\n" " .byte 772b-771b\n" " .short " "%c[paravirt_clobber]" "\n" ".popsection\n" "" : "=a" (__eax) : [paravirt_typenum] "i" ((__builtin_offsetof(struct paravirt_patch_template,pv_irq_ops.irq_enable.func) / sizeof(void *))), [paravirt_opptr] "i" (&(pv_irq_ops.irq_enable.func)), [paravirt_clobber] "i" (((1 << 0))) : "memory", "cc" ); }); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) unsigned long arch_local_irq_save(void) { unsigned long f; f = arch_local_save_flags(); arch_local_irq_disable(); return f; } extern void default_banner(void); struct msr *msrs_alloc(void); void msrs_free(struct msr *msrs); int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]); int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]); extern const unsigned char * const *ideal_nops; extern void arch_init_ideal_nops(void); static inline __attribute__((no_instrument_function)) void native_clts(void) { asm volatile("clts"); } static unsigned long __force_order; static inline __attribute__((no_instrument_function)) unsigned long native_read_cr0(void) { unsigned long val; asm volatile("mov %%cr0,%0\n\t" : "=r" (val), "=m" (__force_order)); return val; } static inline __attribute__((no_instrument_function)) void native_write_cr0(unsigned long val) { asm volatile("mov %0,%%cr0": : "r" (val), "m" (__force_order)); } static inline __attribute__((no_instrument_function)) unsigned long native_read_cr2(void) { unsigned long val; asm volatile("mov %%cr2,%0\n\t" : "=r" (val), "=m" (__force_order)); return val; } static inline __attribute__((no_instrument_function)) void native_write_cr2(unsigned long val) { asm volatile("mov %0,%%cr2": : "r" (val), "m" (__force_order)); } static inline __attribute__((no_instrument_function)) unsigned long native_read_cr3(void) { unsigned long val; asm volatile("mov %%cr3,%0\n\t" : "=r" (val), "=m" (__force_order)); return val; } static inline __attribute__((no_instrument_function)) void native_write_cr3(unsigned long val) { asm volatile("mov %0,%%cr3": : "r" (val), "m" (__force_order)); } static inline __attribute__((no_instrument_function)) unsigned long native_read_cr4(void) { unsigned long val; asm volatile("mov %%cr4,%0\n\t" : "=r" (val), "=m" (__force_order)); return val; } static inline __attribute__((no_instrument_function)) unsigned long native_read_cr4_safe(void) { unsigned long val; val = native_read_cr4(); return val; } static inline __attribute__((no_instrument_function)) void native_write_cr4(unsigned long val) { asm volatile("mov %0,%%cr4": : "r" (val), "m" (__force_order)); } static inline __attribute__((no_instrument_function)) unsigned long native_read_cr8(void) { unsigned long cr8; asm volatile("movq %%cr8,%0" : "=r" (cr8)); return cr8; } static inline __attribute__((no_instrument_function)) void native_write_cr8(unsigned long val) { asm volatile("movq %0,%%cr8" :: "r" (val) : "memory"); } static inline __attribute__((no_instrument_function)) void native_wbinvd(void) { asm volatile("wbinvd": : :"memory"); } extern void native_load_gs_index(unsigned); static inline __attribute__((no_instrument_function)) void clflush(volatile void *__p) { asm volatile("clflush %0" : "+m" (*(volatile char *)__p)); } struct exec_domain; struct pt_regs; extern int register_exec_domain(struct exec_domain *); extern int unregister_exec_domain(struct exec_domain *); extern int __set_personality(unsigned int); enum { UNAME26 = 0x0020000, ADDR_NO_RANDOMIZE = 0x0040000, FDPIC_FUNCPTRS = 0x0080000, MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000, }; enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; typedef void (*handler_t)(int, struct pt_regs *); struct exec_domain { const char *name; handler_t handler; unsigned char pers_low; unsigned char pers_high; unsigned long *signal_map; unsigned long *signal_invmap; struct map_segment *err_map; struct map_segment *socktype_map; struct map_segment *sockopt_map; struct map_segment *af_map; struct module *module; struct exec_domain *next; }; static inline __attribute__((no_instrument_function)) u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) { *remainder = dividend % divisor; return dividend / divisor; } static inline __attribute__((no_instrument_function)) s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) { *remainder = dividend % divisor; return dividend / divisor; } static inline __attribute__((no_instrument_function)) u64 div64_u64(u64 dividend, u64 divisor) { return dividend / divisor; } static inline __attribute__((no_instrument_function)) s64 div64_s64(s64 dividend, s64 divisor) { return dividend / divisor; } static inline __attribute__((no_instrument_function)) u64 div_u64(u64 dividend, u32 divisor) { u32 remainder; return div_u64_rem(dividend, divisor, &remainder); } static inline __attribute__((no_instrument_function)) s64 div_s64(s64 dividend, s32 divisor) { s32 remainder; return div_s64_rem(dividend, divisor, &remainder); } u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) u32 __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) { u32 ret = 0; while (dividend >= divisor) { asm("" : "+rm"(dividend)); dividend -= divisor; ret++; } *remainder = dividend; return ret; } static inline __attribute__((no_instrument_function)) void * __attribute__((warn_unused_result)) ERR_PTR(long error) { return (void *) error; } static inline __attribute__((no_instrument_function)) long __attribute__((warn_unused_result)) PTR_ERR(const void *ptr) { return (long) ptr; } static inline __attribute__((no_instrument_function)) long __attribute__((warn_unused_result)) IS_ERR(const void *ptr) { return ldv__builtin_expect(!!(((unsigned long)ptr) >= (unsigned long)-4095), 0); } static inline __attribute__((no_instrument_function)) long __attribute__((warn_unused_result)) IS_ERR_OR_NULL(const void *ptr) { return !ptr || ldv__builtin_expect(!!(((unsigned long)ptr) >= (unsigned long)-4095), 0); } static inline __attribute__((no_instrument_function)) void * __attribute__((warn_unused_result)) ERR_CAST(const void *ptr) { return (void *) ptr; } static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) PTR_RET(const void *ptr) { if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; } static inline __attribute__((no_instrument_function)) unsigned long native_save_fl(void) { unsigned long flags; asm volatile("# __raw_save_flags\n\t" "pushf ; pop %0" : "=rm" (flags) : : "memory"); return flags; } static inline __attribute__((no_instrument_function)) void native_restore_fl(unsigned long flags) { asm volatile("push %0 ; popf" : :"g" (flags) :"memory", "cc"); } static inline __attribute__((no_instrument_function)) void native_irq_disable(void) { asm volatile("cli": : :"memory"); } static inline __attribute__((no_instrument_function)) void native_irq_enable(void) { asm volatile("sti": : :"memory"); } static inline __attribute__((no_instrument_function)) void native_safe_halt(void) { asm volatile("sti; hlt": : :"memory"); } static inline __attribute__((no_instrument_function)) void native_halt(void) { asm volatile("hlt": : :"memory"); } static inline __attribute__((no_instrument_function)) int arch_irqs_disabled_flags(unsigned long flags) { return !(flags & 0x00000200); } static inline __attribute__((no_instrument_function)) int arch_irqs_disabled(void) { unsigned long flags = arch_local_save_flags(); return arch_irqs_disabled_flags(flags); } extern void trace_softirqs_on(unsigned long ip); extern void trace_softirqs_off(unsigned long ip); extern void trace_hardirqs_on(void); extern void trace_hardirqs_off(void); static inline __attribute__((no_instrument_function)) void *current_text_addr(void) { void *pc; asm volatile("mov $1f, %0; 1:":"=r" (pc)); return pc; } struct cpuinfo_x86 { __u8 x86; __u8 x86_vendor; __u8 x86_model; __u8 x86_mask; int x86_tlbsize; __u8 x86_virt_bits; __u8 x86_phys_bits; __u8 x86_coreid_bits; __u32 extended_cpuid_level; int cpuid_level; __u32 x86_capability[10]; char x86_vendor_id[16]; char x86_model_id[64]; int x86_cache_size; int x86_cache_alignment; int x86_power; unsigned long loops_per_jiffy; u16 x86_max_cores; u16 apicid; u16 initial_apicid; u16 x86_clflush_size; u16 booted_cores; u16 phys_proc_id; u16 cpu_core_id; u8 compute_unit_id; u16 cpu_index; u32 microcode; } __attribute__((__aligned__((1 << (6))))); extern struct cpuinfo_x86 boot_cpu_data; extern struct cpuinfo_x86 new_cpu_data; extern struct tss_struct doublefault_tss; extern __u32 cpu_caps_cleared[10]; extern __u32 cpu_caps_set[10]; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_info; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct cpuinfo_x86) cpu_info __attribute__((__aligned__((1 << (6))))); extern const struct seq_operations cpuinfo_op; static inline __attribute__((no_instrument_function)) int hlt_works(int cpu) { return 1; } extern void cpu_detect(struct cpuinfo_x86 *c); extern struct pt_regs *idle_regs(struct pt_regs *); extern void early_cpu_init(void); extern void identify_boot_cpu(void); extern void identify_secondary_cpu(struct cpuinfo_x86 *); extern void print_cpu_info(struct cpuinfo_x86 *); void print_cpu_msr(struct cpuinfo_x86 *); extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); extern unsigned short num_cache_leaves; extern void detect_extended_topology(struct cpuinfo_x86 *c); extern void detect_ht(struct cpuinfo_x86 *c); static inline __attribute__((no_instrument_function)) void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { asm volatile("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (*eax), "2" (*ecx) : "memory"); } static inline __attribute__((no_instrument_function)) void load_cr3(pgd_t *pgdir) { write_cr3(__phys_addr((unsigned long)(pgdir))); } struct x86_hw_tss { u32 reserved1; u64 sp0; u64 sp1; u64 sp2; u64 reserved2; u64 ist[7]; u32 reserved3; u32 reserved4; u16 reserved5; u16 io_bitmap_base; } __attribute__((packed)) __attribute__((__aligned__((1 << (6))))); struct tss_struct { struct x86_hw_tss x86_tss; unsigned long io_bitmap[((65536/8)/sizeof(long)) + 1]; unsigned long stack[64]; } __attribute__((__aligned__((1 << (6))))); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_init_tss; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct tss_struct) init_tss __attribute__((__aligned__((1 << (6))))); struct orig_ist { unsigned long ist[7]; }; struct i387_fsave_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20]; u32 status; }; struct i387_fxsave_struct { u16 cwd; u16 swd; u16 twd; u16 fop; union { struct { u64 rip; u64 rdp; }; struct { u32 fip; u32 fcs; u32 foo; u32 fos; }; }; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32]; u32 xmm_space[64]; u32 padding[12]; union { u32 padding1[12]; u32 sw_reserved[12]; }; } __attribute__((aligned(16))); struct i387_soft_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20]; u8 ftop; u8 changed; u8 lookahead; u8 no_update; u8 rm; u8 alimit; struct math_emu_info *info; u32 entry_eip; }; struct ymmh_struct { u32 ymmh_space[64]; }; struct xsave_hdr_struct { u64 xstate_bv; u64 reserved1[2]; u64 reserved2[5]; } __attribute__((packed)); struct xsave_struct { struct i387_fxsave_struct i387; struct xsave_hdr_struct xsave_hdr; struct ymmh_struct ymmh; } __attribute__ ((packed, aligned (64))); union thread_xstate { struct i387_fsave_struct fsave; struct i387_fxsave_struct fxsave; struct i387_soft_struct soft; struct xsave_struct xsave; }; struct fpu { unsigned int last_cpu; unsigned int has_fpu; union thread_xstate *state; }; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_orig_ist; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct orig_ist) orig_ist; union irq_stack_union { char irq_stack[(((1UL) << 12) << 2)]; struct { char gs_base[40]; unsigned long stack_canary; }; }; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_irq_stack_union; extern __attribute__((section(".data..percpu" "..first"))) __typeof__(union irq_stack_union) irq_stack_union; extern typeof(irq_stack_union) init_per_cpu__irq_stack_union; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_irq_stack_ptr; extern __attribute__((section(".data..percpu" ""))) __typeof__(char *) irq_stack_ptr; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_irq_count; extern __attribute__((section(".data..percpu" ""))) __typeof__(unsigned int) irq_count; extern unsigned long kernel_eflags; extern void ignore_sysret(void); extern unsigned int xstate_size; extern void free_thread_xstate(struct task_struct *); extern struct kmem_cache *task_xstate_cachep; struct perf_event; struct thread_struct { struct desc_struct tls_array[3]; unsigned long sp0; unsigned long sp; unsigned long usersp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; unsigned long fs; unsigned long gs; struct perf_event *ptrace_bps[4]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; struct fpu fpu; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned io_bitmap_max; }; static inline __attribute__((no_instrument_function)) void native_set_iopl_mask(unsigned mask) { } static inline __attribute__((no_instrument_function)) void native_load_sp0(struct tss_struct *tss, struct thread_struct *thread) { tss->x86_tss.sp0 = thread->sp0; } static inline __attribute__((no_instrument_function)) void native_swapgs(void) { asm volatile("swapgs" ::: "memory"); } extern unsigned long mmu_cr4_features; static inline __attribute__((no_instrument_function)) void set_in_cr4(unsigned long mask) { unsigned long cr4; mmu_cr4_features |= mask; cr4 = read_cr4(); cr4 |= mask; write_cr4(cr4); } static inline __attribute__((no_instrument_function)) void clear_in_cr4(unsigned long mask) { unsigned long cr4; mmu_cr4_features &= ~mask; cr4 = read_cr4(); cr4 &= ~mask; write_cr4(cr4); } typedef struct { unsigned long seg; } mm_segment_t; extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); extern void release_thread(struct task_struct *); extern void prepare_to_copy(struct task_struct *tsk); unsigned long get_wchan(struct task_struct *p); static inline __attribute__((no_instrument_function)) void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { *eax = op; *ecx = 0; __cpuid(eax, ebx, ecx, edx); } static inline __attribute__((no_instrument_function)) void cpuid_count(unsigned int op, int count, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { *eax = op; *ecx = count; __cpuid(eax, ebx, ecx, edx); } static inline __attribute__((no_instrument_function)) unsigned int cpuid_eax(unsigned int op) { unsigned int eax, ebx, ecx, edx; cpuid(op, &eax, &ebx, &ecx, &edx); return eax; } static inline __attribute__((no_instrument_function)) unsigned int cpuid_ebx(unsigned int op) { unsigned int eax, ebx, ecx, edx; cpuid(op, &eax, &ebx, &ecx, &edx); return ebx; } static inline __attribute__((no_instrument_function)) unsigned int cpuid_ecx(unsigned int op) { unsigned int eax, ebx, ecx, edx; cpuid(op, &eax, &ebx, &ecx, &edx); return ecx; } static inline __attribute__((no_instrument_function)) unsigned int cpuid_edx(unsigned int op) { unsigned int eax, ebx, ecx, edx; cpuid(op, &eax, &ebx, &ecx, &edx); return edx; } static inline __attribute__((no_instrument_function)) void rep_nop(void) { asm volatile("rep; nop" ::: "memory"); } static inline __attribute__((no_instrument_function)) void cpu_relax(void) { rep_nop(); } static inline __attribute__((no_instrument_function)) void sync_core(void) { int tmp; asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx", "ecx", "edx", "memory"); } static inline __attribute__((no_instrument_function)) void __monitor(const void *eax, unsigned long ecx, unsigned long edx) { asm volatile(".byte 0x0f, 0x01, 0xc8;" :: "a" (eax), "c" (ecx), "d"(edx)); } static inline __attribute__((no_instrument_function)) void __mwait(unsigned long eax, unsigned long ecx) { asm volatile(".byte 0x0f, 0x01, 0xc9;" :: "a" (eax), "c" (ecx)); } static inline __attribute__((no_instrument_function)) void __sti_mwait(unsigned long eax, unsigned long ecx) { trace_hardirqs_on(); asm volatile("sti; .byte 0x0f, 0x01, 0xc9;" :: "a" (eax), "c" (ecx)); } extern void select_idle_routine(const struct cpuinfo_x86 *c); extern void init_amd_e400_c1e_mask(void); extern unsigned long boot_option_idle_override; extern bool amd_e400_c1e_detected; enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL, IDLE_FORCE_MWAIT}; extern void enable_sep_cpu(void); extern int sysenter_setup(void); extern void early_trap_init(void); extern struct desc_ptr early_gdt_descr; extern void cpu_set_gdt(int); extern void switch_to_new_gdt(int); extern void load_percpu_segment(int); extern void cpu_init(void); static inline __attribute__((no_instrument_function)) unsigned long get_debugctlmsr(void) { unsigned long debugctlmsr = 0; do { int _err; debugctlmsr = paravirt_read_msr(0x000001d9, &_err); } while (0); return debugctlmsr; } static inline __attribute__((no_instrument_function)) void update_debugctlmsr(unsigned long debugctlmsr) { do { paravirt_write_msr(0x000001d9, (u32)((u64)(debugctlmsr)), ((u64)(debugctlmsr))>>32); } while (0); } extern unsigned int machine_id; extern unsigned int machine_submodel_id; extern unsigned int BIOS_revision; extern int bootloader_type; extern int bootloader_version; extern char ignore_fpu_irq; static inline __attribute__((no_instrument_function)) void prefetch(const void *x) { asm volatile ("661:\n\t" "prefetcht0 (%1)" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(0*32+25)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "prefetchnta (%1)" "\n664:\n" ".previous" : : "i" (0), "r" (x)) ; } static inline __attribute__((no_instrument_function)) void prefetchw(const void *x) { asm volatile ("661:\n\t" "prefetcht0 (%1)" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(1*32+31)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "prefetchw (%1)" "\n664:\n" ".previous" : : "i" (0), "r" (x)) ; } static inline __attribute__((no_instrument_function)) void spin_lock_prefetch(const void *x) { prefetchw(x); } extern unsigned long KSTK_ESP(struct task_struct *task); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_old_rsp; extern __attribute__((section(".data..percpu" ""))) __typeof__(unsigned long) old_rsp; extern void start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp); extern int get_tsc_mode(unsigned long adr); extern int set_tsc_mode(unsigned int val); extern int amd_get_nb_id(int cpu); struct aperfmperf { u64 aperf, mperf; }; static inline __attribute__((no_instrument_function)) void get_aperfmperf(struct aperfmperf *am) { ({ static bool __attribute__ ((__section__(".data.unlikely"))) __warned; int __ret_warn_once = !!(!(__builtin_constant_p((3*32+28)) && ( ((((3*32+28))>>5)==0 && (1UL<<(((3*32+28))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((3*32+28))>>5)==1 && (1UL<<(((3*32+28))&31) & ((1<<((1*32+29) & 31))|0))) || ((((3*32+28))>>5)==2 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==3 && (1UL<<(((3*32+28))&31) & ((1<<((3*32+20) & 31))))) || ((((3*32+28))>>5)==4 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==5 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==6 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==7 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==8 && (1UL<<(((3*32+28))&31) & 0)) || ((((3*32+28))>>5)==9 && (1UL<<(((3*32+28))&31) & 0)) ) ? 1 : (__builtin_constant_p(((3*32+28))) ? constant_test_bit(((3*32+28)), ((unsigned long *)((&boot_cpu_data)->x86_capability))) : variable_test_bit(((3*32+28)), ((unsigned long *)((&boot_cpu_data)->x86_capability)))))); if (ldv__builtin_expect(!!(__ret_warn_once), 0)) if (({ int __ret_warn_on = !!(!__warned); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/processor.h", 934); ldv__builtin_expect(!!(__ret_warn_on), 0); })) __warned = true; ldv__builtin_expect(!!(__ret_warn_once), 0); }); do { int _err; am->aperf = paravirt_read_msr(0x000000e8, &_err); } while (0); do { int _err; am->mperf = paravirt_read_msr(0x000000e7, &_err); } while (0); } static inline __attribute__((no_instrument_function)) unsigned long calc_aperfmperf_ratio(struct aperfmperf *old, struct aperfmperf *new) { u64 aperf = new->aperf - old->aperf; u64 mperf = new->mperf - old->mperf; unsigned long ratio = aperf; mperf >>= 10; if (mperf) ratio = div64_u64(aperf, mperf); return ratio; } extern const int amd_erratum_383[]; extern const int amd_erratum_400[]; extern bool cpu_has_amd_erratum(const int *); void cpu_idle_wait(void); extern unsigned long arch_align_stack(unsigned long sp); extern void free_init_pages(char *what, unsigned long begin, unsigned long end); void default_idle(void); bool set_pm_idle_to_default(void); void stop_this_cpu(void *dummy); extern void __xchg_wrong_size(void) ; extern void __cmpxchg_wrong_size(void) ; extern void __xadd_wrong_size(void) ; extern void __add_wrong_size(void) ; static inline __attribute__((no_instrument_function)) void set_64bit(volatile u64 *ptr, u64 val) { *ptr = val; } static inline __attribute__((no_instrument_function)) int atomic_read(const atomic_t *v) { return (*(volatile int *)&(v)->counter); } static inline __attribute__((no_instrument_function)) void atomic_set(atomic_t *v, int i) { v->counter = i; } static inline __attribute__((no_instrument_function)) void atomic_add(int i, atomic_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "addl %1,%0" : "+m" (v->counter) : "ir" (i)); } static inline __attribute__((no_instrument_function)) void atomic_sub(int i, atomic_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "subl %1,%0" : "+m" (v->counter) : "ir" (i)); } static inline __attribute__((no_instrument_function)) int atomic_sub_and_test(int i, atomic_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "subl %2,%0; sete %1" : "+m" (v->counter), "=qm" (c) : "ir" (i) : "memory"); return c; } static inline __attribute__((no_instrument_function)) void atomic_inc(atomic_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "incl %0" : "+m" (v->counter)); } static inline __attribute__((no_instrument_function)) void atomic_dec(atomic_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "decl %0" : "+m" (v->counter)); } static inline __attribute__((no_instrument_function)) int atomic_dec_and_test(atomic_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "decl %0; sete %1" : "+m" (v->counter), "=qm" (c) : : "memory"); return c != 0; } static inline __attribute__((no_instrument_function)) int atomic_inc_and_test(atomic_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "incl %0; sete %1" : "+m" (v->counter), "=qm" (c) : : "memory"); return c != 0; } static inline __attribute__((no_instrument_function)) int atomic_add_negative(int i, atomic_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "addl %2,%0; sets %1" : "+m" (v->counter), "=qm" (c) : "ir" (i) : "memory"); return c; } static inline __attribute__((no_instrument_function)) int atomic_add_return(int i, atomic_t *v) { return i + ({ __typeof__ (*(((&v->counter)))) __ret = (((i))); switch (sizeof(*(((&v->counter))))) { case 1: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "b %b0, %1\n" : "+q" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 2: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "w %w0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 4: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "l %0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 8: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "q %q0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; default: __xadd_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int atomic_sub_return(int i, atomic_t *v) { return atomic_add_return(-i, v); } static inline __attribute__((no_instrument_function)) int atomic_cmpxchg(atomic_t *v, int old, int new) { return ({ __typeof__(*((&v->counter))) __ret; __typeof__(*((&v->counter))) __old = ((old)); __typeof__(*((&v->counter))) __new = ((new)); switch ((sizeof(*(&v->counter)))) { case 1: { volatile u8 *__ptr = (volatile u8 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgb %2,%1" : "=a" (__ret), "+m" (*__ptr) : "q" (__new), "0" (__old) : "memory"); break; } case 2: { volatile u16 *__ptr = (volatile u16 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgw %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 4: { volatile u32 *__ptr = (volatile u32 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgl %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 8: { volatile u64 *__ptr = (volatile u64 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgq %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } default: __cmpxchg_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int atomic_xchg(atomic_t *v, int new) { return ({ __typeof__ (*((&v->counter))) __ret = ((new)); switch (sizeof(*((&v->counter)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int __atomic_add_unless(atomic_t *v, int a, int u) { int c, old; c = atomic_read(v); for (;;) { if (ldv__builtin_expect(!!(c == (u)), 0)) break; old = atomic_cmpxchg((v), c, c + (a)); if (ldv__builtin_expect(!!(old == c), 1)) break; c = old; } return c; } static inline __attribute__((no_instrument_function)) int atomic_dec_if_positive(atomic_t *v) { int c, old, dec; c = atomic_read(v); for (;;) { dec = c - 1; if (ldv__builtin_expect(!!(dec < 0), 0)) break; old = atomic_cmpxchg((v), c, dec); if (ldv__builtin_expect(!!(old == c), 1)) break; c = old; } return dec; } static inline __attribute__((no_instrument_function)) short int atomic_inc_short(short int *v) { asm(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "addw $1, %0" : "+m" (*v)); return *v; } static inline __attribute__((no_instrument_function)) void atomic_or_long(unsigned long *v1, unsigned long v2) { asm(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "orq %1, %0" : "+m" (*v1) : "r" (v2)); } static inline __attribute__((no_instrument_function)) long atomic64_read(const atomic64_t *v) { return (*(volatile long *)&(v)->counter); } static inline __attribute__((no_instrument_function)) void atomic64_set(atomic64_t *v, long i) { v->counter = i; } static inline __attribute__((no_instrument_function)) void atomic64_add(long i, atomic64_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "addq %1,%0" : "=m" (v->counter) : "er" (i), "m" (v->counter)); } static inline __attribute__((no_instrument_function)) void atomic64_sub(long i, atomic64_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "subq %1,%0" : "=m" (v->counter) : "er" (i), "m" (v->counter)); } static inline __attribute__((no_instrument_function)) int atomic64_sub_and_test(long i, atomic64_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "subq %2,%0; sete %1" : "=m" (v->counter), "=qm" (c) : "er" (i), "m" (v->counter) : "memory"); return c; } static inline __attribute__((no_instrument_function)) void atomic64_inc(atomic64_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "incq %0" : "=m" (v->counter) : "m" (v->counter)); } static inline __attribute__((no_instrument_function)) void atomic64_dec(atomic64_t *v) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "decq %0" : "=m" (v->counter) : "m" (v->counter)); } static inline __attribute__((no_instrument_function)) int atomic64_dec_and_test(atomic64_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "decq %0; sete %1" : "=m" (v->counter), "=qm" (c) : "m" (v->counter) : "memory"); return c != 0; } static inline __attribute__((no_instrument_function)) int atomic64_inc_and_test(atomic64_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "incq %0; sete %1" : "=m" (v->counter), "=qm" (c) : "m" (v->counter) : "memory"); return c != 0; } static inline __attribute__((no_instrument_function)) int atomic64_add_negative(long i, atomic64_t *v) { unsigned char c; asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "addq %2,%0; sets %1" : "=m" (v->counter), "=qm" (c) : "er" (i), "m" (v->counter) : "memory"); return c; } static inline __attribute__((no_instrument_function)) long atomic64_add_return(long i, atomic64_t *v) { return i + ({ __typeof__ (*(((&v->counter)))) __ret = (((i))); switch (sizeof(*(((&v->counter))))) { case 1: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "b %b0, %1\n" : "+q" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 2: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "w %w0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 4: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "l %0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; case 8: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "q %q0, %1\n" : "+r" (__ret), "+m" (*(((&v->counter)))) : : "memory", "cc"); break; default: __xadd_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) long atomic64_sub_return(long i, atomic64_t *v) { return atomic64_add_return(-i, v); } static inline __attribute__((no_instrument_function)) long atomic64_cmpxchg(atomic64_t *v, long old, long new) { return ({ __typeof__(*((&v->counter))) __ret; __typeof__(*((&v->counter))) __old = ((old)); __typeof__(*((&v->counter))) __new = ((new)); switch ((sizeof(*(&v->counter)))) { case 1: { volatile u8 *__ptr = (volatile u8 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgb %2,%1" : "=a" (__ret), "+m" (*__ptr) : "q" (__new), "0" (__old) : "memory"); break; } case 2: { volatile u16 *__ptr = (volatile u16 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgw %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 4: { volatile u32 *__ptr = (volatile u32 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgl %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 8: { volatile u64 *__ptr = (volatile u64 *)((&v->counter)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgq %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } default: __cmpxchg_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) long atomic64_xchg(atomic64_t *v, long new) { return ({ __typeof__ (*((&v->counter))) __ret = ((new)); switch (sizeof(*((&v->counter)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&v->counter))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int atomic64_add_unless(atomic64_t *v, long a, long u) { long c, old; c = atomic64_read(v); for (;;) { if (ldv__builtin_expect(!!(c == (u)), 0)) break; old = atomic64_cmpxchg((v), c, c + (a)); if (ldv__builtin_expect(!!(old == c), 1)) break; c = old; } return c != (u); } static inline __attribute__((no_instrument_function)) long atomic64_dec_if_positive(atomic64_t *v) { long c, old, dec; c = atomic64_read(v); for (;;) { dec = c - 1; if (ldv__builtin_expect(!!(dec < 0), 0)) break; old = atomic64_cmpxchg((v), c, dec); if (ldv__builtin_expect(!!(old == c), 1)) break; c = old; } return dec; } static inline __attribute__((no_instrument_function)) int atomic_add_unless(atomic_t *v, int a, int u) { return __atomic_add_unless(v, a, u) != u; } static inline __attribute__((no_instrument_function)) int atomic_inc_not_zero_hint(atomic_t *v, int hint) { int val, c = hint; if (!hint) return atomic_add_unless((v), 1, 0); do { val = atomic_cmpxchg(v, c, c + 1); if (val == c) return 1; c = val; } while (c); return 0; } static inline __attribute__((no_instrument_function)) int atomic_inc_unless_negative(atomic_t *p) { int v, v1; for (v = 0; v >= 0; v = v1) { v1 = atomic_cmpxchg(p, v, v + 1); if (ldv__builtin_expect(!!(v1 == v), 1)) return 1; } return 0; } static inline __attribute__((no_instrument_function)) int atomic_dec_unless_positive(atomic_t *p) { int v, v1; for (v = 0; v <= 0; v = v1) { v1 = atomic_cmpxchg(p, v, v - 1); if (ldv__builtin_expect(!!(v1 == v), 1)) return 1; } return 0; } static inline __attribute__((no_instrument_function)) void atomic_or(int i, atomic_t *v) { int old; int new; do { old = atomic_read(v); new = old | i; } while (atomic_cmpxchg(v, old, new) != old); } typedef atomic64_t atomic_long_t; static inline __attribute__((no_instrument_function)) long atomic_long_read(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return (long)atomic64_read(v); } static inline __attribute__((no_instrument_function)) void atomic_long_set(atomic_long_t *l, long i) { atomic64_t *v = (atomic64_t *)l; atomic64_set(v, i); } static inline __attribute__((no_instrument_function)) void atomic_long_inc(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; atomic64_inc(v); } static inline __attribute__((no_instrument_function)) void atomic_long_dec(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; atomic64_dec(v); } static inline __attribute__((no_instrument_function)) void atomic_long_add(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; atomic64_add(i, v); } static inline __attribute__((no_instrument_function)) void atomic_long_sub(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; atomic64_sub(i, v); } static inline __attribute__((no_instrument_function)) int atomic_long_sub_and_test(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return atomic64_sub_and_test(i, v); } static inline __attribute__((no_instrument_function)) int atomic_long_dec_and_test(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return atomic64_dec_and_test(v); } static inline __attribute__((no_instrument_function)) int atomic_long_inc_and_test(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return atomic64_inc_and_test(v); } static inline __attribute__((no_instrument_function)) int atomic_long_add_negative(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return atomic64_add_negative(i, v); } static inline __attribute__((no_instrument_function)) long atomic_long_add_return(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return (long)atomic64_add_return(i, v); } static inline __attribute__((no_instrument_function)) long atomic_long_sub_return(long i, atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return (long)atomic64_sub_return(i, v); } static inline __attribute__((no_instrument_function)) long atomic_long_inc_return(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return (long)(atomic64_add_return(1, (v))); } static inline __attribute__((no_instrument_function)) long atomic_long_dec_return(atomic_long_t *l) { atomic64_t *v = (atomic64_t *)l; return (long)(atomic64_sub_return(1, (v))); } static inline __attribute__((no_instrument_function)) long atomic_long_add_unless(atomic_long_t *l, long a, long u) { atomic64_t *v = (atomic64_t *)l; return (long)atomic64_add_unless(v, a, u); } struct thread_info { struct task_struct *task; struct exec_domain *exec_domain; __u32 flags; __u32 status; __u32 cpu; int preempt_count; mm_segment_t addr_limit; struct restart_block restart_block; void *sysenter_return; unsigned int sig_on_uaccess_error:1; unsigned int uaccess_err:1; }; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_kernel_stack; extern __attribute__((section(".data..percpu" ""))) __typeof__(unsigned long) kernel_stack; static inline __attribute__((no_instrument_function)) struct thread_info *current_thread_info(void) { struct thread_info *ti; ti = (void *)(({ typeof(kernel_stack) pfo_ret__; switch (sizeof(kernel_stack)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "p" (&(kernel_stack))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(kernel_stack))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(kernel_stack))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "p" (&(kernel_stack))); break; default: __bad_percpu_size(); } pfo_ret__; }) + (5*8) - (((1UL) << 12) << 1)); return ti; } static inline __attribute__((no_instrument_function)) void set_restore_sigmask(void) { struct thread_info *ti = current_thread_info(); ti->status |= 0x0008; set_bit(2, (unsigned long *)&ti->flags); } static inline __attribute__((no_instrument_function)) bool is_ia32_task(void) { if (current_thread_info()->status & 0x0002) return true; return false; } extern void arch_task_cache_init(void); extern void free_thread_info(struct thread_info *ti); extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); static inline __attribute__((no_instrument_function)) void set_ti_thread_flag(struct thread_info *ti, int flag) { set_bit(flag, (unsigned long *)&ti->flags); } static inline __attribute__((no_instrument_function)) void clear_ti_thread_flag(struct thread_info *ti, int flag) { clear_bit(flag, (unsigned long *)&ti->flags); } static inline __attribute__((no_instrument_function)) int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) { return test_and_set_bit(flag, (unsigned long *)&ti->flags); } static inline __attribute__((no_instrument_function)) int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) { return test_and_clear_bit(flag, (unsigned long *)&ti->flags); } static inline __attribute__((no_instrument_function)) int test_ti_thread_flag(struct thread_info *ti, int flag) { return (__builtin_constant_p((flag)) ? constant_test_bit((flag), ((unsigned long *)&ti->flags)) : variable_test_bit((flag), ((unsigned long *)&ti->flags))); } static inline __attribute__((no_instrument_function)) void INIT_LIST_HEAD(struct list_head *list) { list->next = list; list->prev = list; } extern void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next); static inline __attribute__((no_instrument_function)) void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } static inline __attribute__((no_instrument_function)) void list_add_tail(struct list_head *new, struct list_head *head) { __list_add(new, head->prev, head); } static inline __attribute__((no_instrument_function)) void __list_del(struct list_head * prev, struct list_head * next) { next->prev = prev; prev->next = next; } extern void __list_del_entry(struct list_head *entry); extern void list_del(struct list_head *entry); static inline __attribute__((no_instrument_function)) void list_replace(struct list_head *old, struct list_head *new) { new->next = old->next; new->next->prev = new; new->prev = old->prev; new->prev->next = new; } static inline __attribute__((no_instrument_function)) void list_replace_init(struct list_head *old, struct list_head *new) { list_replace(old, new); INIT_LIST_HEAD(old); } static inline __attribute__((no_instrument_function)) void list_del_init(struct list_head *entry) { __list_del_entry(entry); INIT_LIST_HEAD(entry); } static inline __attribute__((no_instrument_function)) void list_move(struct list_head *list, struct list_head *head) { __list_del_entry(list); list_add(list, head); } static inline __attribute__((no_instrument_function)) void list_move_tail(struct list_head *list, struct list_head *head) { __list_del_entry(list); list_add_tail(list, head); } static inline __attribute__((no_instrument_function)) int list_is_last(const struct list_head *list, const struct list_head *head) { return list->next == head; } static inline __attribute__((no_instrument_function)) int list_empty(const struct list_head *head) { return head->next == head; } static inline __attribute__((no_instrument_function)) int list_empty_careful(const struct list_head *head) { struct list_head *next = head->next; return (next == head) && (next == head->prev); } static inline __attribute__((no_instrument_function)) void list_rotate_left(struct list_head *head) { struct list_head *first; if (!list_empty(head)) { first = head->next; list_move_tail(first, head); } } static inline __attribute__((no_instrument_function)) int list_is_singular(const struct list_head *head) { return !list_empty(head) && (head->next == head->prev); } static inline __attribute__((no_instrument_function)) void __list_cut_position(struct list_head *list, struct list_head *head, struct list_head *entry) { struct list_head *new_first = entry->next; list->next = head->next; list->next->prev = list; list->prev = entry; entry->next = list; head->next = new_first; new_first->prev = head; } static inline __attribute__((no_instrument_function)) void list_cut_position(struct list_head *list, struct list_head *head, struct list_head *entry) { if (list_empty(head)) return; if (list_is_singular(head) && (head->next != entry && head != entry)) return; if (entry == head) INIT_LIST_HEAD(list); else __list_cut_position(list, head, entry); } static inline __attribute__((no_instrument_function)) void __list_splice(const struct list_head *list, struct list_head *prev, struct list_head *next) { struct list_head *first = list->next; struct list_head *last = list->prev; first->prev = prev; prev->next = first; last->next = next; next->prev = last; } static inline __attribute__((no_instrument_function)) void list_splice(const struct list_head *list, struct list_head *head) { if (!list_empty(list)) __list_splice(list, head, head->next); } static inline __attribute__((no_instrument_function)) void list_splice_tail(struct list_head *list, struct list_head *head) { if (!list_empty(list)) __list_splice(list, head->prev, head); } static inline __attribute__((no_instrument_function)) void list_splice_init(struct list_head *list, struct list_head *head) { if (!list_empty(list)) { __list_splice(list, head, head->next); INIT_LIST_HEAD(list); } } static inline __attribute__((no_instrument_function)) void list_splice_tail_init(struct list_head *list, struct list_head *head) { if (!list_empty(list)) { __list_splice(list, head->prev, head); INIT_LIST_HEAD(list); } } static inline __attribute__((no_instrument_function)) void INIT_HLIST_NODE(struct hlist_node *h) { h->next = ((void *)0); h->pprev = ((void *)0); } static inline __attribute__((no_instrument_function)) int hlist_unhashed(const struct hlist_node *h) { return !h->pprev; } static inline __attribute__((no_instrument_function)) int hlist_empty(const struct hlist_head *h) { return !h->first; } static inline __attribute__((no_instrument_function)) void __hlist_del(struct hlist_node *n) { struct hlist_node *next = n->next; struct hlist_node **pprev = n->pprev; *pprev = next; if (next) next->pprev = pprev; } static inline __attribute__((no_instrument_function)) void hlist_del(struct hlist_node *n) { __hlist_del(n); n->next = ((void *) 0x00100100 + (0xdead000000000000UL)); n->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_del_init(struct hlist_node *n) { if (!hlist_unhashed(n)) { __hlist_del(n); INIT_HLIST_NODE(n); } } static inline __attribute__((no_instrument_function)) void hlist_add_head(struct hlist_node *n, struct hlist_head *h) { struct hlist_node *first = h->first; n->next = first; if (first) first->pprev = &n->next; h->first = n; n->pprev = &h->first; } static inline __attribute__((no_instrument_function)) void hlist_add_before(struct hlist_node *n, struct hlist_node *next) { n->pprev = next->pprev; n->next = next; next->pprev = &n->next; *(n->pprev) = n; } static inline __attribute__((no_instrument_function)) void hlist_add_after(struct hlist_node *n, struct hlist_node *next) { next->next = n->next; n->next = next; next->pprev = &n->next; if(next->next) next->next->pprev = &next->next; } static inline __attribute__((no_instrument_function)) void hlist_add_fake(struct hlist_node *n) { n->pprev = &n->next; } static inline __attribute__((no_instrument_function)) void hlist_move_list(struct hlist_head *old, struct hlist_head *new) { new->first = old->first; if (new->first) new->first->pprev = &new->first; old->first = ((void *)0); } struct preempt_notifier; struct preempt_ops { void (*sched_in)(struct preempt_notifier *notifier, int cpu); void (*sched_out)(struct preempt_notifier *notifier, struct task_struct *next); }; struct preempt_notifier { struct hlist_node link; struct preempt_ops *ops; }; void preempt_notifier_register(struct preempt_notifier *notifier); void preempt_notifier_unregister(struct preempt_notifier *notifier); static inline __attribute__((no_instrument_function)) void preempt_notifier_init(struct preempt_notifier *notifier, struct preempt_ops *ops) { INIT_HLIST_NODE(¬ifier->link); notifier->ops = ops; } enum irqreturn { IRQ_NONE = (0 << 0), IRQ_HANDLED = (1 << 0), IRQ_WAKE_THREAD = (1 << 1), }; typedef enum irqreturn irqreturn_t; extern int nr_irqs; extern struct irq_desc *irq_to_desc(unsigned int irq); unsigned int irq_get_next_irq(unsigned int offset); struct task_struct; struct lockdep_map; extern int prove_locking; extern int lock_stat; static inline __attribute__((no_instrument_function)) void lockdep_off(void) { } static inline __attribute__((no_instrument_function)) void lockdep_on(void) { } struct lock_class_key { }; extern void print_irqtrace_events(struct task_struct *curr); static inline __attribute__((no_instrument_function)) void ftrace_nmi_enter(void) { } static inline __attribute__((no_instrument_function)) void ftrace_nmi_exit(void) { } extern void cpu_idle(void); typedef void (*smp_call_func_t)(void *info); struct call_single_data { struct list_head list; smp_call_func_t func; void *info; u16 flags; u16 priv; }; extern unsigned int total_cpus; int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, int wait); struct mpf_intel { char signature[4]; unsigned int physptr; unsigned char length; unsigned char specification; unsigned char checksum; unsigned char feature1; unsigned char feature2; unsigned char feature3; unsigned char feature4; unsigned char feature5; }; struct mpc_table { char signature[4]; unsigned short length; char spec; char checksum; char oem[8]; char productid[12]; unsigned int oemptr; unsigned short oemsize; unsigned short oemcount; unsigned int lapic; unsigned int reserved; }; struct mpc_cpu { unsigned char type; unsigned char apicid; unsigned char apicver; unsigned char cpuflag; unsigned int cpufeature; unsigned int featureflag; unsigned int reserved[2]; }; struct mpc_bus { unsigned char type; unsigned char busid; unsigned char bustype[6]; }; struct mpc_ioapic { unsigned char type; unsigned char apicid; unsigned char apicver; unsigned char flags; unsigned int apicaddr; }; struct mpc_intsrc { unsigned char type; unsigned char irqtype; unsigned short irqflag; unsigned char srcbus; unsigned char srcbusirq; unsigned char dstapic; unsigned char dstirq; }; enum mp_irq_source_types { mp_INT = 0, mp_NMI = 1, mp_SMI = 2, mp_ExtINT = 3 }; struct mpc_lintsrc { unsigned char type; unsigned char irqtype; unsigned short irqflag; unsigned char srcbusid; unsigned char srcbusirq; unsigned char destapic; unsigned char destapiclint; }; struct mpc_oemtable { char signature[4]; unsigned short length; char rev; char checksum; char mpc[8]; }; enum mp_bustype { MP_BUS_ISA = 1, MP_BUS_EISA, MP_BUS_PCI, MP_BUS_MCA, }; struct screen_info { __u8 orig_x; __u8 orig_y; __u16 ext_mem_k; __u16 orig_video_page; __u8 orig_video_mode; __u8 orig_video_cols; __u8 flags; __u8 unused2; __u16 orig_video_ega_bx; __u16 unused3; __u8 orig_video_lines; __u8 orig_video_isVGA; __u16 orig_video_points; __u16 lfb_width; __u16 lfb_height; __u16 lfb_depth; __u32 lfb_base; __u32 lfb_size; __u16 cl_magic, cl_offset; __u16 lfb_linelength; __u8 red_size; __u8 red_pos; __u8 green_size; __u8 green_pos; __u8 blue_size; __u8 blue_pos; __u8 rsvd_size; __u8 rsvd_pos; __u16 vesapm_seg; __u16 vesapm_off; __u16 pages; __u16 vesa_attributes; __u32 capabilities; __u8 _reserved[6]; } __attribute__((packed)); extern struct screen_info screen_info; typedef unsigned short apm_event_t; typedef unsigned short apm_eventinfo_t; struct apm_bios_info { __u16 version; __u16 cseg; __u32 offset; __u16 cseg_16; __u16 dseg; __u16 flags; __u16 cseg_len; __u16 cseg_16_len; __u16 dseg_len; }; struct apm_info { struct apm_bios_info bios; unsigned short connection_version; int get_power_status_broken; int get_power_status_swabinminutes; int allow_ints; int forbid_idle; int realmode_power_off; int disabled; }; extern struct apm_info apm_info; struct edd_device_params { __u16 length; __u16 info_flags; __u32 num_default_cylinders; __u32 num_default_heads; __u32 sectors_per_track; __u64 number_of_sectors; __u16 bytes_per_sector; __u32 dpte_ptr; __u16 key; __u8 device_path_info_length; __u8 reserved2; __u16 reserved3; __u8 host_bus_type[4]; __u8 interface_type[8]; union { struct { __u16 base_address; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) isa; struct { __u8 bus; __u8 slot; __u8 function; __u8 channel; __u32 reserved; } __attribute__ ((packed)) pci; struct { __u64 reserved; } __attribute__ ((packed)) ibnd; struct { __u64 reserved; } __attribute__ ((packed)) xprs; struct { __u64 reserved; } __attribute__ ((packed)) htpt; struct { __u64 reserved; } __attribute__ ((packed)) unknown; } interface_path; union { struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) ata; struct { __u8 device; __u8 lun; __u8 reserved1; __u8 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) atapi; struct { __u16 id; __u64 lun; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) scsi; struct { __u64 serial_number; __u64 reserved; } __attribute__ ((packed)) usb; struct { __u64 eui; __u64 reserved; } __attribute__ ((packed)) i1394; struct { __u64 wwid; __u64 lun; } __attribute__ ((packed)) fibre; struct { __u64 identity_tag; __u64 reserved; } __attribute__ ((packed)) i2o; struct { __u32 array_number; __u32 reserved1; __u64 reserved2; } __attribute__ ((packed)) raid; struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) sata; struct { __u64 reserved1; __u64 reserved2; } __attribute__ ((packed)) unknown; } device_path; __u8 reserved4; __u8 checksum; } __attribute__ ((packed)); struct edd_info { __u8 device; __u8 version; __u16 interface_support; __u16 legacy_max_cylinder; __u8 legacy_max_head; __u8 legacy_sectors_per_track; struct edd_device_params params; } __attribute__ ((packed)); struct edd { unsigned int mbr_signature[16]; struct edd_info edd_info[6]; unsigned char mbr_signature_nr; unsigned char edd_info_nr; }; extern struct edd edd; struct e820entry { __u64 addr; __u64 size; __u32 type; } __attribute__((packed)); struct e820map { __u32 nr_map; struct e820entry map[(128 + 3 * (1 << 10))]; }; extern struct e820map e820; extern struct e820map e820_saved; extern unsigned long pci_mem_start; extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); extern int sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); extern void update_e820(void); extern void e820_setup_gap(void); extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, unsigned long start_addr, unsigned long long end_addr); struct setup_data; extern void parse_e820_ext(struct setup_data *data); extern void e820_mark_nosave_regions(unsigned long limit_pfn); extern void early_memtest(unsigned long start, unsigned long end); extern unsigned long e820_end_of_ram_pfn(void); extern unsigned long e820_end_of_low_ram_pfn(void); extern u64 early_reserve_e820(u64 sizet, u64 align); void memblock_x86_fill(void); void memblock_find_dma_reserve(void); extern void finish_e820_parsing(void); extern void e820_reserve_resources(void); extern void e820_reserve_resources_late(void); extern void setup_memory_map(void); extern char *default_machine_specific_memory_setup(void); static inline __attribute__((no_instrument_function)) bool is_ISA_range(u64 s, u64 e) { return s >= 0xa0000 && e <= 0x100000; } struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; struct resource *parent, *sibling, *child; }; extern struct resource ioport_resource; extern struct resource iomem_resource; extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); extern int request_resource(struct resource *root, struct resource *new); extern int release_resource(struct resource *new); void release_child_resources(struct resource *new); extern void reserve_region_with_split(struct resource *root, resource_size_t start, resource_size_t end, const char *name); extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); extern int insert_resource(struct resource *parent, struct resource *new); extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); extern void arch_remove_reservations(struct resource *avail); extern int allocate_resource(struct resource *root, struct resource *new, resource_size_t size, resource_size_t min, resource_size_t max, resource_size_t align, resource_size_t (*alignf)(void *, const struct resource *, resource_size_t, resource_size_t), void *alignf_data); struct resource *lookup_resource(struct resource *root, resource_size_t start); int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size); resource_size_t resource_alignment(struct resource *res); static inline __attribute__((no_instrument_function)) resource_size_t resource_size(const struct resource *res) { return res->end - res->start + 1; } static inline __attribute__((no_instrument_function)) unsigned long resource_type(const struct resource *res) { return res->flags & 0x00001f00; } extern struct resource * __request_region(struct resource *, resource_size_t start, resource_size_t n, const char *name, int flags); extern int __check_region(struct resource *, resource_size_t, resource_size_t); extern void __release_region(struct resource *, resource_size_t, resource_size_t); static inline __attribute__((no_instrument_function)) int __attribute__((deprecated)) check_region(resource_size_t s, resource_size_t n) { return __check_region(&ioport_resource, s, n); } struct device; extern struct resource * __devm_request_region(struct device *dev, struct resource *parent, resource_size_t start, resource_size_t n, const char *name); extern void __devm_release_region(struct device *dev, struct resource *parent, resource_size_t start, resource_size_t n); extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); extern int iomem_is_exclusive(u64 addr); extern int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, void *arg, int (*func)(unsigned long, unsigned long, void *)); struct ist_info { __u32 signature; __u32 command; __u32 event; __u32 perf_level; }; extern struct ist_info ist_info; struct edid_info { unsigned char dummy[128]; }; extern struct edid_info edid_info; struct setup_data { __u64 next; __u32 type; __u32 len; __u8 data[0]; }; struct setup_header { __u8 setup_sects; __u16 root_flags; __u32 syssize; __u16 ram_size; __u16 vid_mode; __u16 root_dev; __u16 boot_flag; __u16 jump; __u32 header; __u16 version; __u32 realmode_swtch; __u16 start_sys; __u16 kernel_version; __u8 type_of_loader; __u8 loadflags; __u16 setup_move_size; __u32 code32_start; __u32 ramdisk_image; __u32 ramdisk_size; __u32 bootsect_kludge; __u16 heap_end_ptr; __u8 ext_loader_ver; __u8 ext_loader_type; __u32 cmd_line_ptr; __u32 initrd_addr_max; __u32 kernel_alignment; __u8 relocatable_kernel; __u8 _pad2[3]; __u32 cmdline_size; __u32 hardware_subarch; __u64 hardware_subarch_data; __u32 payload_offset; __u32 payload_length; __u64 setup_data; __u64 pref_address; __u32 init_size; } __attribute__((packed)); struct sys_desc_table { __u16 length; __u8 table[14]; }; struct olpc_ofw_header { __u32 ofw_magic; __u32 ofw_version; __u32 cif_handler; __u32 irq_desc_table; } __attribute__((packed)); struct efi_info { __u32 efi_loader_signature; __u32 efi_systab; __u32 efi_memdesc_size; __u32 efi_memdesc_version; __u32 efi_memmap; __u32 efi_memmap_size; __u32 efi_systab_hi; __u32 efi_memmap_hi; }; struct boot_params { struct screen_info screen_info; struct apm_bios_info apm_bios_info; __u8 _pad2[4]; __u64 tboot_addr; struct ist_info ist_info; __u8 _pad3[16]; __u8 hd0_info[16]; __u8 hd1_info[16]; struct sys_desc_table sys_desc_table; struct olpc_ofw_header olpc_ofw_header; __u8 _pad4[128]; struct edid_info edid_info; struct efi_info efi_info; __u32 alt_mem_k; __u32 scratch; __u8 e820_entries; __u8 eddbuf_entries; __u8 edd_mbr_sig_buf_entries; __u8 _pad6[6]; struct setup_header hdr; __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; __u32 edd_mbr_sig_buffer[16]; struct e820entry e820_map[128]; __u8 _pad8[48]; struct edd_info eddbuf[6]; __u8 _pad9[276]; } __attribute__((packed)); enum { X86_SUBARCH_PC = 0, X86_SUBARCH_LGUEST, X86_SUBARCH_XEN, X86_SUBARCH_MRST, X86_SUBARCH_CE4100, X86_NR_SUBARCHS, }; struct mpc_bus; struct mpc_cpu; struct mpc_table; struct cpuinfo_x86; struct x86_init_mpparse { void (*mpc_record)(unsigned int mode); void (*setup_ioapic_ids)(void); int (*mpc_apic_id)(struct mpc_cpu *m); void (*smp_read_mpc_oem)(struct mpc_table *mpc); void (*mpc_oem_pci_bus)(struct mpc_bus *m); void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); void (*find_smp_config)(void); void (*get_smp_config)(unsigned int early); }; struct x86_init_resources { void (*probe_roms)(void); void (*reserve_resources)(void); char *(*memory_setup)(void); }; struct x86_init_irqs { void (*pre_vector_init)(void); void (*intr_init)(void); void (*trap_init)(void); }; struct x86_init_oem { void (*arch_setup)(void); void (*banner)(void); }; struct x86_init_mapping { void (*pagetable_reserve)(u64 start, u64 end); }; struct x86_init_paging { void (*pagetable_setup_start)(pgd_t *base); void (*pagetable_setup_done)(pgd_t *base); }; struct x86_init_timers { void (*setup_percpu_clockev)(void); void (*tsc_pre_init)(void); void (*timer_init)(void); void (*wallclock_init)(void); }; struct x86_init_iommu { int (*iommu_init)(void); }; struct x86_init_pci { int (*arch_init)(void); int (*init)(void); void (*init_irq)(void); void (*fixup_irqs)(void); }; struct x86_init_ops { struct x86_init_resources resources; struct x86_init_mpparse mpparse; struct x86_init_irqs irqs; struct x86_init_oem oem; struct x86_init_mapping mapping; struct x86_init_paging paging; struct x86_init_timers timers; struct x86_init_iommu iommu; struct x86_init_pci pci; }; struct x86_cpuinit_ops { void (*setup_percpu_clockev)(void); void (*early_percpu_clock_init)(void); void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node); }; struct x86_platform_ops { unsigned long (*calibrate_tsc)(void); void (*wallclock_init)(void); unsigned long (*get_wallclock)(void); int (*set_wallclock)(unsigned long nowtime); void (*iommu_shutdown)(void); bool (*is_untracked_pat_range)(u64 start, u64 end); void (*nmi_init)(void); unsigned char (*get_nmi_reason)(void); int (*i8042_detect)(void); void (*save_sched_clock_state)(void); void (*restore_sched_clock_state)(void); }; struct pci_dev; struct x86_msi_ops { int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); void (*teardown_msi_irq)(unsigned int irq); void (*teardown_msi_irqs)(struct pci_dev *dev); void (*restore_msi_irqs)(struct pci_dev *dev, int irq); }; extern struct x86_init_ops x86_init; extern struct x86_cpuinit_ops x86_cpuinit; extern struct x86_platform_ops x86_platform; extern struct x86_msi_ops x86_msi; extern void x86_init_noop(void); extern void x86_init_uint_noop(unsigned int unused); struct local_apic { struct { unsigned int __reserved[4]; } __reserved_01; struct { unsigned int __reserved[4]; } __reserved_02; struct { unsigned int __reserved_1 : 24, phys_apic_id : 4, __reserved_2 : 4; unsigned int __reserved[3]; } id; const struct { unsigned int version : 8, __reserved_1 : 8, max_lvt : 8, __reserved_2 : 8; unsigned int __reserved[3]; } version; struct { unsigned int __reserved[4]; } __reserved_03; struct { unsigned int __reserved[4]; } __reserved_04; struct { unsigned int __reserved[4]; } __reserved_05; struct { unsigned int __reserved[4]; } __reserved_06; struct { unsigned int priority : 8, __reserved_1 : 24; unsigned int __reserved_2[3]; } tpr; const struct { unsigned int priority : 8, __reserved_1 : 24; unsigned int __reserved_2[3]; } apr; const struct { unsigned int priority : 8, __reserved_1 : 24; unsigned int __reserved_2[3]; } ppr; struct { unsigned int eoi; unsigned int __reserved[3]; } eoi; struct { unsigned int __reserved[4]; } __reserved_07; struct { unsigned int __reserved_1 : 24, logical_dest : 8; unsigned int __reserved_2[3]; } ldr; struct { unsigned int __reserved_1 : 28, model : 4; unsigned int __reserved_2[3]; } dfr; struct { unsigned int spurious_vector : 8, apic_enabled : 1, focus_cpu : 1, __reserved_2 : 22; unsigned int __reserved_3[3]; } svr; struct { unsigned int bitfield; unsigned int __reserved[3]; } isr [8]; struct { unsigned int bitfield; unsigned int __reserved[3]; } tmr [8]; struct { unsigned int bitfield; unsigned int __reserved[3]; } irr [8]; union { struct { unsigned int send_cs_error : 1, receive_cs_error : 1, send_accept_error : 1, receive_accept_error : 1, __reserved_1 : 1, send_illegal_vector : 1, receive_illegal_vector : 1, illegal_register_address : 1, __reserved_2 : 24; unsigned int __reserved_3[3]; } error_bits; struct { unsigned int errors; unsigned int __reserved_3[3]; } all_errors; } esr; struct { unsigned int __reserved[4]; } __reserved_08; struct { unsigned int __reserved[4]; } __reserved_09; struct { unsigned int __reserved[4]; } __reserved_10; struct { unsigned int __reserved[4]; } __reserved_11; struct { unsigned int __reserved[4]; } __reserved_12; struct { unsigned int __reserved[4]; } __reserved_13; struct { unsigned int __reserved[4]; } __reserved_14; struct { unsigned int vector : 8, delivery_mode : 3, destination_mode : 1, delivery_status : 1, __reserved_1 : 1, level : 1, trigger : 1, __reserved_2 : 2, shorthand : 2, __reserved_3 : 12; unsigned int __reserved_4[3]; } icr1; struct { union { unsigned int __reserved_1 : 24, phys_dest : 4, __reserved_2 : 4; unsigned int __reserved_3 : 24, logical_dest : 8; } dest; unsigned int __reserved_4[3]; } icr2; struct { unsigned int vector : 8, __reserved_1 : 4, delivery_status : 1, __reserved_2 : 3, mask : 1, timer_mode : 1, __reserved_3 : 14; unsigned int __reserved_4[3]; } lvt_timer; struct { unsigned int vector : 8, delivery_mode : 3, __reserved_1 : 1, delivery_status : 1, __reserved_2 : 3, mask : 1, __reserved_3 : 15; unsigned int __reserved_4[3]; } lvt_thermal; struct { unsigned int vector : 8, delivery_mode : 3, __reserved_1 : 1, delivery_status : 1, __reserved_2 : 3, mask : 1, __reserved_3 : 15; unsigned int __reserved_4[3]; } lvt_pc; struct { unsigned int vector : 8, delivery_mode : 3, __reserved_1 : 1, delivery_status : 1, polarity : 1, remote_irr : 1, trigger : 1, mask : 1, __reserved_2 : 15; unsigned int __reserved_3[3]; } lvt_lint0; struct { unsigned int vector : 8, delivery_mode : 3, __reserved_1 : 1, delivery_status : 1, polarity : 1, remote_irr : 1, trigger : 1, mask : 1, __reserved_2 : 15; unsigned int __reserved_3[3]; } lvt_lint1; struct { unsigned int vector : 8, __reserved_1 : 4, delivery_status : 1, __reserved_2 : 3, mask : 1, __reserved_3 : 15; unsigned int __reserved_4[3]; } lvt_error; struct { unsigned int initial_count; unsigned int __reserved_2[3]; } timer_icr; const struct { unsigned int curr_count; unsigned int __reserved_2[3]; } timer_ccr; struct { unsigned int __reserved[4]; } __reserved_16; struct { unsigned int __reserved[4]; } __reserved_17; struct { unsigned int __reserved[4]; } __reserved_18; struct { unsigned int __reserved[4]; } __reserved_19; struct { unsigned int divisor : 4, __reserved_1 : 28; unsigned int __reserved_2[3]; } timer_dcr; struct { unsigned int __reserved[4]; } __reserved_20; } __attribute__ ((packed)); enum ioapic_irq_destination_types { dest_Fixed = 0, dest_LowestPrio = 1, dest_SMI = 2, dest__reserved_1 = 3, dest_NMI = 4, dest_INIT = 5, dest__reserved_2 = 6, dest_ExtINT = 7 }; extern int apic_version[]; extern int pic_mode; extern unsigned long mp_bus_not_pci[(((256) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; extern unsigned int boot_cpu_physical_apicid; extern unsigned int max_physical_apicid; extern int mpc_default_type; extern unsigned long mp_lapic_addr; extern int smp_found_config; static inline __attribute__((no_instrument_function)) void get_smp_config(void) { x86_init.mpparse.get_smp_config(0); } static inline __attribute__((no_instrument_function)) void early_get_smp_config(void) { x86_init.mpparse.get_smp_config(1); } static inline __attribute__((no_instrument_function)) void find_smp_config(void) { x86_init.mpparse.find_smp_config(); } extern void early_reserve_e820_mpc_new(void); extern int enable_update_mptable; extern int default_mpc_apic_id(struct mpc_cpu *m); extern void default_smp_read_mpc_oem(struct mpc_table *mpc); extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str); extern void default_find_smp_config(void); extern void default_get_smp_config(unsigned int early); void __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) generic_processor_info(int apicid, int version); extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs(void); struct device; extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level, int active_high_low); struct physid_mask { unsigned long mask[(((32768) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; }; typedef struct physid_mask physid_mask_t; static inline __attribute__((no_instrument_function)) unsigned long physids_coerce(physid_mask_t *map) { return map->mask[0]; } static inline __attribute__((no_instrument_function)) void physids_promote(unsigned long physids, physid_mask_t *map) { bitmap_zero((*map).mask, 32768); map->mask[0] = physids; } static inline __attribute__((no_instrument_function)) void physid_set_mask_of_physid(int physid, physid_mask_t *map) { bitmap_zero((*map).mask, 32768); set_bit(physid, (*map).mask); } extern physid_mask_t phys_cpu_present_map; extern int generic_mps_oem_check(struct mpc_table *, char *, char *); extern int default_acpi_madt_oem_check(char *, char *); extern void local_bh_disable(void); extern void _local_bh_enable(void); extern void local_bh_enable(void); extern void local_bh_enable_ip(unsigned long ip); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void rdtsc_barrier(void) { asm volatile ("661:\n\t" ".byte " "0x66,0x66,0x90" "\n" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(3*32+17)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "mfence" "\n664:\n" ".previous" : : : "memory"); asm volatile ("661:\n\t" ".byte " "0x66,0x66,0x90" "\n" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(3*32+18)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "lfence" "\n664:\n" ".previous" : : : "memory"); } typedef u16 __ticket_t; typedef u32 __ticketpair_t; typedef struct arch_spinlock { union { __ticketpair_t head_tail; struct __raw_tickets { __ticket_t head, tail; } tickets; }; } arch_spinlock_t; typedef union { s64 lock; struct { u32 read; s32 write; }; } arch_rwlock_t; typedef struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic, owner_cpu; void *owner; } raw_spinlock_t; typedef struct spinlock { union { struct raw_spinlock rlock; }; } spinlock_t; typedef struct { arch_rwlock_t raw_lock; unsigned int magic, owner_cpu; void *owner; } rwlock_t; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void __ticket_spin_lock(arch_spinlock_t *lock) { register struct __raw_tickets inc = { .tail = 1 }; inc = ({ __typeof__ (*(((&lock->tickets)))) __ret = (((inc))); switch (sizeof(*(((&lock->tickets))))) { case 1: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "b %b0, %1\n" : "+q" (__ret), "+m" (*(((&lock->tickets)))) : : "memory", "cc"); break; case 2: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "w %w0, %1\n" : "+r" (__ret), "+m" (*(((&lock->tickets)))) : : "memory", "cc"); break; case 4: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "l %0, %1\n" : "+r" (__ret), "+m" (*(((&lock->tickets)))) : : "memory", "cc"); break; case 8: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "q %q0, %1\n" : "+r" (__ret), "+m" (*(((&lock->tickets)))) : : "memory", "cc"); break; default: __xadd_wrong_size(); } __ret; }); for (;;) { if (inc.head == inc.tail) break; cpu_relax(); inc.head = (*(volatile typeof(lock->tickets.head) *)&(lock->tickets.head)); } __asm__ __volatile__("": : :"memory"); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int __ticket_spin_trylock(arch_spinlock_t *lock) { arch_spinlock_t old, new; old.tickets = (*(volatile typeof(lock->tickets) *)&(lock->tickets)); if (old.tickets.head != old.tickets.tail) return 0; new.head_tail = old.head_tail + (1 << (sizeof(__ticket_t) * 8)); return ({ __typeof__(*((&lock->head_tail))) __ret; __typeof__(*((&lock->head_tail))) __old = ((old.head_tail)); __typeof__(*((&lock->head_tail))) __new = ((new.head_tail)); switch ((sizeof(*(&lock->head_tail)))) { case 1: { volatile u8 *__ptr = (volatile u8 *)((&lock->head_tail)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgb %2,%1" : "=a" (__ret), "+m" (*__ptr) : "q" (__new), "0" (__old) : "memory"); break; } case 2: { volatile u16 *__ptr = (volatile u16 *)((&lock->head_tail)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgw %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 4: { volatile u32 *__ptr = (volatile u32 *)((&lock->head_tail)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgl %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 8: { volatile u64 *__ptr = (volatile u64 *)((&lock->head_tail)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgq %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } default: __cmpxchg_wrong_size(); } __ret; }) == old.head_tail; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void __ticket_spin_unlock(arch_spinlock_t *lock) { ({ __typeof__ (*(&lock->tickets.head)) __ret = (1); switch (sizeof(*(&lock->tickets.head))) { case 1: asm volatile ( "addb %b1, %0\n" : "+m" (*(&lock->tickets.head)) : "qi" (1) : "memory", "cc"); break; case 2: asm volatile ( "addw %w1, %0\n" : "+m" (*(&lock->tickets.head)) : "ri" (1) : "memory", "cc"); break; case 4: asm volatile ( "addl %1, %0\n" : "+m" (*(&lock->tickets.head)) : "ri" (1) : "memory", "cc"); break; case 8: asm volatile ( "addq %1, %0\n" : "+m" (*(&lock->tickets.head)) : "ri" (1) : "memory", "cc"); break; default: __add_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int __ticket_spin_is_locked(arch_spinlock_t *lock) { struct __raw_tickets tmp = (*(volatile typeof(lock->tickets) *)&(lock->tickets)); return tmp.tail != tmp.head; } static inline __attribute__((no_instrument_function)) int __ticket_spin_is_contended(arch_spinlock_t *lock) { struct __raw_tickets tmp = (*(volatile typeof(lock->tickets) *)&(lock->tickets)); return (__ticket_t)(tmp.tail - tmp.head) > 1; } static inline __attribute__((no_instrument_function)) void arch_spin_unlock_wait(arch_spinlock_t *lock) { while (arch_spin_is_locked(lock)) cpu_relax(); } static inline __attribute__((no_instrument_function)) int arch_read_can_lock(arch_rwlock_t *lock) { return lock->lock > 0; } static inline __attribute__((no_instrument_function)) int arch_write_can_lock(arch_rwlock_t *lock) { return lock->write == 1; } static inline __attribute__((no_instrument_function)) void arch_read_lock(arch_rwlock_t *rw) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "decq" " " " (%0)\n\t" "jns 1f\n" "call __read_lock_failed\n\t" "1:\n" ::"D" (rw) : "memory"); } static inline __attribute__((no_instrument_function)) void arch_write_lock(arch_rwlock_t *rw) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "decl" " " "(%0)\n\t" "jz 1f\n" "call __write_lock_failed\n\t" "1:\n" ::"D" (&rw->write), "i" (((1L) << 32)) : "memory"); } static inline __attribute__((no_instrument_function)) int arch_read_trylock(arch_rwlock_t *lock) { atomic64_t *count = (atomic64_t *)lock; if ((atomic64_sub_return(1, (count))) >= 0) return 1; atomic64_inc(count); return 0; } static inline __attribute__((no_instrument_function)) int arch_write_trylock(arch_rwlock_t *lock) { atomic_t *count = (atomic_t *)&lock->write; if (atomic_sub_and_test(1, count)) return 1; atomic_add(1, count); return 0; } static inline __attribute__((no_instrument_function)) void arch_read_unlock(arch_rwlock_t *rw) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "incq" " " " %0" :"+m" (rw->lock) : : "memory"); } static inline __attribute__((no_instrument_function)) void arch_write_unlock(arch_rwlock_t *rw) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "incl" " " "%0" : "+m" (rw->write) : "i" (((1L) << 32)) : "memory"); } static inline __attribute__((no_instrument_function)) void smp_mb__after_lock(void) { } extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, struct lock_class_key *key); extern void do_raw_spin_lock(raw_spinlock_t *lock) ; extern int do_raw_spin_trylock(raw_spinlock_t *lock); extern void do_raw_spin_unlock(raw_spinlock_t *lock) ; extern void __rwlock_init(rwlock_t *lock, const char *name, struct lock_class_key *key); extern void do_raw_read_lock(rwlock_t *lock) ; extern int do_raw_read_trylock(rwlock_t *lock); extern void do_raw_read_unlock(rwlock_t *lock) ; extern void do_raw_write_lock(rwlock_t *lock) ; extern int do_raw_write_trylock(rwlock_t *lock); extern void do_raw_write_unlock(rwlock_t *lock) ; int in_lock_functions(unsigned long addr); void __attribute__((section(".spinlock.text"))) _raw_spin_lock(raw_spinlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) ; void __attribute__((section(".spinlock.text"))) _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) ; void __attribute__((section(".spinlock.text"))) _raw_spin_lock_bh(raw_spinlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_spin_lock_irq(raw_spinlock_t *lock) ; unsigned long __attribute__((section(".spinlock.text"))) _raw_spin_lock_irqsave(raw_spinlock_t *lock) ; unsigned long __attribute__((section(".spinlock.text"))) _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, int subclass) ; int __attribute__((section(".spinlock.text"))) _raw_spin_trylock(raw_spinlock_t *lock); int __attribute__((section(".spinlock.text"))) _raw_spin_trylock_bh(raw_spinlock_t *lock); void __attribute__((section(".spinlock.text"))) _raw_spin_unlock(raw_spinlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_spin_unlock_bh(raw_spinlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_spin_unlock_irq(raw_spinlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) ; static inline __attribute__((no_instrument_function)) int __raw_spin_trylock(raw_spinlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); if (do_raw_spin_trylock(lock)) { do { } while (0); return 1; } do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); return 0; } static inline __attribute__((no_instrument_function)) unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_spin_lock(lock); return flags; } static inline __attribute__((no_instrument_function)) void __raw_spin_lock_irq(raw_spinlock_t *lock) { do { arch_local_irq_disable(); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_spin_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_spin_lock_bh(raw_spinlock_t *lock) { local_bh_disable(); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_spin_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_spin_lock(raw_spinlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_spin_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_spin_unlock(raw_spinlock_t *lock) { do { } while (0); do_raw_spin_unlock(lock); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) { do { } while (0); do_raw_spin_unlock(lock); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_spin_unlock_irq(raw_spinlock_t *lock) { do { } while (0); do_raw_spin_unlock(lock); do { trace_hardirqs_on(); arch_local_irq_enable(); } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_spin_unlock_bh(raw_spinlock_t *lock) { do { } while (0); do_raw_spin_unlock(lock); do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); local_bh_enable_ip((unsigned long)__builtin_return_address(0)); } static inline __attribute__((no_instrument_function)) int __raw_spin_trylock_bh(raw_spinlock_t *lock) { local_bh_disable(); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); if (do_raw_spin_trylock(lock)) { do { } while (0); return 1; } do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); local_bh_enable_ip((unsigned long)__builtin_return_address(0)); return 0; } void __attribute__((section(".spinlock.text"))) _raw_read_lock(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_lock(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_read_lock_bh(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_lock_bh(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_read_lock_irq(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_lock_irq(rwlock_t *lock) ; unsigned long __attribute__((section(".spinlock.text"))) _raw_read_lock_irqsave(rwlock_t *lock) ; unsigned long __attribute__((section(".spinlock.text"))) _raw_write_lock_irqsave(rwlock_t *lock) ; int __attribute__((section(".spinlock.text"))) _raw_read_trylock(rwlock_t *lock); int __attribute__((section(".spinlock.text"))) _raw_write_trylock(rwlock_t *lock); void __attribute__((section(".spinlock.text"))) _raw_read_unlock(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_unlock(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_read_unlock_bh(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_unlock_bh(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_read_unlock_irq(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_write_unlock_irq(rwlock_t *lock) ; void __attribute__((section(".spinlock.text"))) _raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) ; void __attribute__((section(".spinlock.text"))) _raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) ; static inline __attribute__((no_instrument_function)) int __raw_read_trylock(rwlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); if (do_raw_read_trylock(lock)) { do { } while (0); return 1; } do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); return 0; } static inline __attribute__((no_instrument_function)) int __raw_write_trylock(rwlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); if (do_raw_write_trylock(lock)) { do { } while (0); return 1; } do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); return 0; } static inline __attribute__((no_instrument_function)) void __raw_read_lock(rwlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_read_lock(lock); } static inline __attribute__((no_instrument_function)) unsigned long __raw_read_lock_irqsave(rwlock_t *lock) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_read_lock((lock)) ; return flags; } static inline __attribute__((no_instrument_function)) void __raw_read_lock_irq(rwlock_t *lock) { do { arch_local_irq_disable(); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_read_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_read_lock_bh(rwlock_t *lock) { local_bh_disable(); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_read_lock(lock); } static inline __attribute__((no_instrument_function)) unsigned long __raw_write_lock_irqsave(rwlock_t *lock) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_write_lock((lock)) ; return flags; } static inline __attribute__((no_instrument_function)) void __raw_write_lock_irq(rwlock_t *lock) { do { arch_local_irq_disable(); trace_hardirqs_off(); } while (0); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_write_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_write_lock_bh(rwlock_t *lock) { local_bh_disable(); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_write_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_write_lock(rwlock_t *lock) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); do { } while (0); do_raw_write_lock(lock); } static inline __attribute__((no_instrument_function)) void __raw_write_unlock(rwlock_t *lock) { do { } while (0); do_raw_write_unlock(lock); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_read_unlock(rwlock_t *lock) { do { } while (0); do_raw_read_unlock(lock); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) { do { } while (0); do_raw_read_unlock(lock); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_read_unlock_irq(rwlock_t *lock) { do { } while (0); do_raw_read_unlock(lock); do { trace_hardirqs_on(); arch_local_irq_enable(); } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_read_unlock_bh(rwlock_t *lock) { do { } while (0); do_raw_read_unlock(lock); do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); local_bh_enable_ip((unsigned long)__builtin_return_address(0)); } static inline __attribute__((no_instrument_function)) void __raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) { do { } while (0); do_raw_write_unlock(lock); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_write_unlock_irq(rwlock_t *lock) { do { } while (0); do_raw_write_unlock(lock); do { trace_hardirqs_on(); arch_local_irq_enable(); } while (0); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void __raw_write_unlock_bh(rwlock_t *lock) { do { } while (0); do_raw_write_unlock(lock); do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); local_bh_enable_ip((unsigned long)__builtin_return_address(0)); } static inline __attribute__((no_instrument_function)) raw_spinlock_t *spinlock_check(spinlock_t *lock) { return &lock->rlock; } static inline __attribute__((no_instrument_function)) void spin_lock(spinlock_t *lock) { _raw_spin_lock(&lock->rlock); } static inline __attribute__((no_instrument_function)) void spin_lock_bh(spinlock_t *lock) { _raw_spin_lock_bh(&lock->rlock); } static inline __attribute__((no_instrument_function)) int spin_trylock(spinlock_t *lock) { return (_raw_spin_trylock(&lock->rlock)); } static inline __attribute__((no_instrument_function)) void spin_lock_irq(spinlock_t *lock) { _raw_spin_lock_irq(&lock->rlock); } static inline __attribute__((no_instrument_function)) void spin_unlock(spinlock_t *lock) { _raw_spin_unlock(&lock->rlock); } static inline __attribute__((no_instrument_function)) void spin_unlock_bh(spinlock_t *lock) { _raw_spin_unlock_bh(&lock->rlock); } static inline __attribute__((no_instrument_function)) void spin_unlock_irq(spinlock_t *lock) { _raw_spin_unlock_irq(&lock->rlock); } static inline __attribute__((no_instrument_function)) void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); _raw_spin_unlock_irqrestore(&lock->rlock, flags); } while (0); } static inline __attribute__((no_instrument_function)) int spin_trylock_bh(spinlock_t *lock) { return (_raw_spin_trylock_bh(&lock->rlock)); } static inline __attribute__((no_instrument_function)) int spin_trylock_irq(spinlock_t *lock) { return ({ do { arch_local_irq_disable(); trace_hardirqs_off(); } while (0); (_raw_spin_trylock(&lock->rlock)) ? 1 : ({ do { trace_hardirqs_on(); arch_local_irq_enable(); } while (0); 0; }); }); } static inline __attribute__((no_instrument_function)) void spin_unlock_wait(spinlock_t *lock) { arch_spin_unlock_wait(&(&lock->rlock)->raw_lock); } static inline __attribute__((no_instrument_function)) int spin_is_locked(spinlock_t *lock) { return arch_spin_is_locked(&(&lock->rlock)->raw_lock); } static inline __attribute__((no_instrument_function)) int spin_is_contended(spinlock_t *lock) { return arch_spin_is_contended(&(&lock->rlock)->raw_lock); } static inline __attribute__((no_instrument_function)) int spin_can_lock(spinlock_t *lock) { return (!arch_spin_is_locked(&(&lock->rlock)->raw_lock)); } extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); typedef struct { unsigned sequence; spinlock_t lock; } seqlock_t; static inline __attribute__((no_instrument_function)) void write_seqlock(seqlock_t *sl) { spin_lock(&sl->lock); ++sl->sequence; __asm__ __volatile__("": : :"memory"); } static inline __attribute__((no_instrument_function)) void write_sequnlock(seqlock_t *sl) { __asm__ __volatile__("": : :"memory"); sl->sequence++; spin_unlock(&sl->lock); } static inline __attribute__((no_instrument_function)) int write_tryseqlock(seqlock_t *sl) { int ret = spin_trylock(&sl->lock); if (ret) { ++sl->sequence; __asm__ __volatile__("": : :"memory"); } return ret; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) unsigned read_seqbegin(const seqlock_t *sl) { unsigned ret; repeat: ret = (*(volatile typeof(sl->sequence) *)&(sl->sequence)); if (ldv__builtin_expect(!!(ret & 1), 0)) { cpu_relax(); goto repeat; } __asm__ __volatile__("": : :"memory"); return ret; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int read_seqretry(const seqlock_t *sl, unsigned start) { __asm__ __volatile__("": : :"memory"); return ldv__builtin_expect(!!(sl->sequence != start), 0); } typedef struct seqcount { unsigned sequence; } seqcount_t; static inline __attribute__((no_instrument_function)) unsigned __read_seqcount_begin(const seqcount_t *s) { unsigned ret; repeat: ret = (*(volatile typeof(s->sequence) *)&(s->sequence)); if (ldv__builtin_expect(!!(ret & 1), 0)) { cpu_relax(); goto repeat; } return ret; } static inline __attribute__((no_instrument_function)) unsigned read_seqcount_begin(const seqcount_t *s) { unsigned ret = __read_seqcount_begin(s); __asm__ __volatile__("": : :"memory"); return ret; } static inline __attribute__((no_instrument_function)) unsigned raw_seqcount_begin(const seqcount_t *s) { unsigned ret = (*(volatile typeof(s->sequence) *)&(s->sequence)); __asm__ __volatile__("": : :"memory"); return ret & ~1; } static inline __attribute__((no_instrument_function)) int __read_seqcount_retry(const seqcount_t *s, unsigned start) { return ldv__builtin_expect(!!(s->sequence != start), 0); } static inline __attribute__((no_instrument_function)) int read_seqcount_retry(const seqcount_t *s, unsigned start) { __asm__ __volatile__("": : :"memory"); return __read_seqcount_retry(s, start); } static inline __attribute__((no_instrument_function)) void write_seqcount_begin(seqcount_t *s) { s->sequence++; __asm__ __volatile__("": : :"memory"); } static inline __attribute__((no_instrument_function)) void write_seqcount_end(seqcount_t *s) { __asm__ __volatile__("": : :"memory"); s->sequence++; } static inline __attribute__((no_instrument_function)) void write_seqcount_barrier(seqcount_t *s) { __asm__ __volatile__("": : :"memory"); s->sequence+=2; } struct timespec { __kernel_time_t tv_sec; long tv_nsec; }; struct timeval { __kernel_time_t tv_sec; __kernel_suseconds_t tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; extern struct timezone sys_tz; static inline __attribute__((no_instrument_function)) int timespec_equal(const struct timespec *a, const struct timespec *b) { return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); } static inline __attribute__((no_instrument_function)) int timespec_compare(const struct timespec *lhs, const struct timespec *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; if (lhs->tv_sec > rhs->tv_sec) return 1; return lhs->tv_nsec - rhs->tv_nsec; } static inline __attribute__((no_instrument_function)) int timeval_compare(const struct timeval *lhs, const struct timeval *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; if (lhs->tv_sec > rhs->tv_sec) return 1; return lhs->tv_usec - rhs->tv_usec; } extern unsigned long mktime(const unsigned int year, const unsigned int mon, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec); extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); extern struct timespec timespec_add_safe(const struct timespec lhs, const struct timespec rhs); static inline __attribute__((no_instrument_function)) struct timespec timespec_add(struct timespec lhs, struct timespec rhs) { struct timespec ts_delta; set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec); return ts_delta; } static inline __attribute__((no_instrument_function)) struct timespec timespec_sub(struct timespec lhs, struct timespec rhs) { struct timespec ts_delta; set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec); return ts_delta; } extern void read_persistent_clock(struct timespec *ts); extern void read_boot_clock(struct timespec *ts); extern int update_persistent_clock(struct timespec now); void timekeeping_init(void); extern int timekeeping_suspended; unsigned long get_seconds(void); struct timespec current_kernel_time(void); struct timespec __current_kernel_time(void); struct timespec get_monotonic_coarse(void); void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, struct timespec *wtom, struct timespec *sleep); void timekeeping_inject_sleeptime(struct timespec *delta); static inline __attribute__((no_instrument_function)) u32 arch_gettimeoffset(void) { return 0; } extern void do_gettimeofday(struct timeval *tv); extern int do_settimeofday(const struct timespec *tv); extern int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz); extern long do_utimes(int dfd, const char *filename, struct timespec *times, int flags); struct itimerval; extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); extern unsigned int alarm_setitimer(unsigned int seconds); extern int do_getitimer(int which, struct itimerval *value); extern void getnstimeofday(struct timespec *tv); extern void getrawmonotonic(struct timespec *ts); extern void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real); extern void getboottime(struct timespec *ts); extern void monotonic_to_bootbased(struct timespec *ts); extern void get_monotonic_boottime(struct timespec *ts); extern struct timespec timespec_trunc(struct timespec t, unsigned gran); extern int timekeeping_valid_for_hres(void); extern u64 timekeeping_max_deferment(void); extern void timekeeping_leap_insert(int leapsecond); extern int timekeeping_inject_offset(struct timespec *ts); struct tms; extern void do_sys_times(struct tms *); struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; long tm_year; int tm_wday; int tm_yday; }; void time_to_tm(time_t totalsecs, int offset, struct tm *result); static inline __attribute__((no_instrument_function)) s64 timespec_to_ns(const struct timespec *ts) { return ((s64) ts->tv_sec * 1000000000L) + ts->tv_nsec; } static inline __attribute__((no_instrument_function)) s64 timeval_to_ns(const struct timeval *tv) { return ((s64) tv->tv_sec * 1000000000L) + tv->tv_usec * 1000L; } extern struct timespec ns_to_timespec(const s64 nsec); extern struct timeval ns_to_timeval(const s64 nsec); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void timespec_add_ns(struct timespec *a, u64 ns) { a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, 1000000000L, &ns); a->tv_nsec = ns; } struct itimerspec { struct timespec it_interval; struct timespec it_value; }; struct itimerval { struct timeval it_interval; struct timeval it_value; }; struct timex { unsigned int modes; long offset; long freq; long maxerror; long esterror; int status; long constant; long precision; long tolerance; struct timeval time; long tick; long ppsfreq; long jitter; int shift; long stabil; long jitcnt; long calcnt; long errcnt; long stbcnt; int tai; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; typedef unsigned long long cycles_t; extern unsigned int cpu_khz; extern unsigned int tsc_khz; extern void disable_TSC(void); static inline __attribute__((no_instrument_function)) cycles_t get_cycles(void) { unsigned long long ret = 0; (ret = paravirt_read_tsc()); return ret; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) cycles_t vget_cycles(void) { return (cycles_t)__native_read_tsc(); } extern void tsc_init(void); extern void mark_tsc_unstable(char *reason); extern int unsynchronized_tsc(void); extern int check_tsc_unstable(void); extern unsigned long native_calibrate_tsc(void); extern int tsc_clocksource_reliable; extern void check_tsc_sync_source(int cpu); extern void check_tsc_sync_target(void); extern int notsc_setup(char *); extern void tsc_save_sched_clock_state(void); extern void tsc_restore_sched_clock_state(void); extern unsigned long tick_usec; extern unsigned long tick_nsec; extern void ntp_init(void); extern void ntp_clear(void); extern u64 ntp_tick_length(void); extern int second_overflow(unsigned long secs); extern int do_adjtimex(struct timex *); extern void hardpps(const struct timespec *, const struct timespec *); int read_current_timer(unsigned long *timer_val); extern u64 __attribute__((section(".data"))) jiffies_64; extern unsigned long volatile __attribute__((section(".data"))) jiffies; static inline __attribute__((no_instrument_function)) u64 get_jiffies_64(void) { return (u64)jiffies; } extern unsigned long preset_lpj; extern unsigned int jiffies_to_msecs(const unsigned long j); extern unsigned int jiffies_to_usecs(const unsigned long j); extern unsigned long msecs_to_jiffies(const unsigned int m); extern unsigned long usecs_to_jiffies(const unsigned int u); extern unsigned long timespec_to_jiffies(const struct timespec *value); extern void jiffies_to_timespec(const unsigned long jiffies, struct timespec *value); extern unsigned long timeval_to_jiffies(const struct timeval *value); extern void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value); extern clock_t jiffies_to_clock_t(unsigned long x); extern unsigned long clock_t_to_jiffies(unsigned long x); extern u64 jiffies_64_to_clock_t(u64 x); extern u64 nsec_to_clock_t(u64 x); extern u64 nsecs_to_jiffies64(u64 n); extern unsigned long nsecs_to_jiffies(u64 n); union ktime { s64 tv64; }; typedef union ktime ktime_t; static inline __attribute__((no_instrument_function)) ktime_t ktime_set(const long secs, const unsigned long nsecs) { if (ldv__builtin_expect(!!(secs >= (((s64)~((u64)1 << 63)) / 1000000000L)), 0)) return (ktime_t){ .tv64 = ((s64)~((u64)1 << 63)) }; return (ktime_t) { .tv64 = (s64)secs * 1000000000L + (s64)nsecs }; } static inline __attribute__((no_instrument_function)) ktime_t timespec_to_ktime(struct timespec ts) { return ktime_set(ts.tv_sec, ts.tv_nsec); } static inline __attribute__((no_instrument_function)) ktime_t timeval_to_ktime(struct timeval tv) { return ktime_set(tv.tv_sec, tv.tv_usec * 1000L); } static inline __attribute__((no_instrument_function)) int ktime_equal(const ktime_t cmp1, const ktime_t cmp2) { return cmp1.tv64 == cmp2.tv64; } static inline __attribute__((no_instrument_function)) s64 ktime_to_us(const ktime_t kt) { struct timeval tv = ns_to_timeval((kt).tv64); return (s64) tv.tv_sec * 1000000L + tv.tv_usec; } static inline __attribute__((no_instrument_function)) s64 ktime_to_ms(const ktime_t kt) { struct timeval tv = ns_to_timeval((kt).tv64); return (s64) tv.tv_sec * 1000L + tv.tv_usec / 1000L; } static inline __attribute__((no_instrument_function)) s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) { return ktime_to_us(({ (ktime_t){ .tv64 = (later).tv64 - (earlier).tv64 }; })); } static inline __attribute__((no_instrument_function)) ktime_t ktime_add_us(const ktime_t kt, const u64 usec) { return ({ (ktime_t){ .tv64 = (kt).tv64 + (usec * 1000) }; }); } static inline __attribute__((no_instrument_function)) ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) { return ({ (ktime_t){ .tv64 = (kt).tv64 - (usec * 1000) }; }); } extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); extern void ktime_get_ts(struct timespec *ts); static inline __attribute__((no_instrument_function)) ktime_t ns_to_ktime(u64 ns) { static const ktime_t ktime_zero = { .tv64 = 0 }; return ({ (ktime_t){ .tv64 = (ktime_zero).tv64 + (ns) }; }); } enum debug_obj_state { ODEBUG_STATE_NONE, ODEBUG_STATE_INIT, ODEBUG_STATE_INACTIVE, ODEBUG_STATE_ACTIVE, ODEBUG_STATE_DESTROYED, ODEBUG_STATE_NOTAVAILABLE, ODEBUG_STATE_MAX, }; struct debug_obj_descr; struct debug_obj { struct hlist_node node; enum debug_obj_state state; unsigned int astate; void *object; struct debug_obj_descr *descr; }; struct debug_obj_descr { const char *name; void *(*debug_hint) (void *addr); int (*fixup_init) (void *addr, enum debug_obj_state state); int (*fixup_activate) (void *addr, enum debug_obj_state state); int (*fixup_destroy) (void *addr, enum debug_obj_state state); int (*fixup_free) (void *addr, enum debug_obj_state state); int (*fixup_assert_init)(void *addr, enum debug_obj_state state); }; extern void debug_object_init (void *addr, struct debug_obj_descr *descr); extern void debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); extern void debug_object_free (void *addr, struct debug_obj_descr *descr); extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr); extern void debug_object_active_state(void *addr, struct debug_obj_descr *descr, unsigned int expect, unsigned int next); extern void debug_objects_early_init(void); extern void debug_objects_mem_init(void); extern void debug_check_no_obj_freed(const void *address, unsigned long size); struct tvec_base; struct timer_list { struct list_head entry; unsigned long expires; struct tvec_base *base; void (*function)(unsigned long); unsigned long data; int slack; int start_pid; void *start_site; char start_comm[16]; }; extern struct tvec_base boot_tvec_bases; void init_timer_key(struct timer_list *timer, const char *name, struct lock_class_key *key); void init_timer_deferrable_key(struct timer_list *timer, const char *name, struct lock_class_key *key); extern void init_timer_on_stack_key(struct timer_list *timer, const char *name, struct lock_class_key *key); extern void destroy_timer_on_stack(struct timer_list *timer); static inline __attribute__((no_instrument_function)) void setup_timer_key(struct timer_list * timer, const char *name, struct lock_class_key *key, void (*function)(unsigned long), unsigned long data) { timer->function = function; timer->data = data; init_timer_key(timer, name, key); } static inline __attribute__((no_instrument_function)) void setup_timer_on_stack_key(struct timer_list *timer, const char *name, struct lock_class_key *key, void (*function)(unsigned long), unsigned long data) { timer->function = function; timer->data = data; init_timer_on_stack_key(timer, name, key); } extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer, const char *name, struct lock_class_key *key, void (*function)(unsigned long), unsigned long data); static inline __attribute__((no_instrument_function)) int timer_pending(const struct timer_list * timer) { return timer->entry.next != ((void *)0); } extern void add_timer_on(struct timer_list *timer, int cpu); extern int del_timer(struct timer_list * timer); extern int mod_timer(struct timer_list *timer, unsigned long expires); extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires); extern void set_timer_slack(struct timer_list *time, int slack_hz); extern unsigned long get_next_timer_interrupt(unsigned long now); extern int timer_stats_active; extern void init_timer_stats(void); extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, void *timerf, char *comm, unsigned int timer_flag); extern void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr); static inline __attribute__((no_instrument_function)) void timer_stats_timer_set_start_info(struct timer_list *timer) { if (ldv__builtin_expect(!!(!timer_stats_active), 1)) return; __timer_stats_timer_set_start_info(timer, __builtin_return_address(0)); } static inline __attribute__((no_instrument_function)) void timer_stats_timer_clear_start_info(struct timer_list *timer) { timer->start_site = ((void *)0); } extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); extern int del_timer_sync(struct timer_list *timer); extern void init_timers(void); extern void run_local_timers(void); struct hrtimer; extern enum hrtimer_restart it_real_fn(struct hrtimer *); unsigned long __round_jiffies(unsigned long j, int cpu); unsigned long __round_jiffies_relative(unsigned long j, int cpu); unsigned long round_jiffies(unsigned long j); unsigned long round_jiffies_relative(unsigned long j); unsigned long __round_jiffies_up(unsigned long j, int cpu); unsigned long __round_jiffies_up_relative(unsigned long j, int cpu); unsigned long round_jiffies_up(unsigned long j); unsigned long round_jiffies_up_relative(unsigned long j); struct workqueue_struct; struct work_struct; typedef void (*work_func_t)(struct work_struct *work); enum { WORK_STRUCT_PENDING_BIT = 0, WORK_STRUCT_DELAYED_BIT = 1, WORK_STRUCT_CWQ_BIT = 2, WORK_STRUCT_LINKED_BIT = 3, WORK_STRUCT_STATIC_BIT = 4, WORK_STRUCT_COLOR_SHIFT = 5, WORK_STRUCT_COLOR_BITS = 4, WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT, WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT, WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT, WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT, WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT, WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1, WORK_NO_COLOR = WORK_NR_COLORS, WORK_CPU_UNBOUND = 4096, WORK_CPU_NONE = 4096 + 1, WORK_CPU_LAST = WORK_CPU_NONE, WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + WORK_STRUCT_COLOR_BITS, WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, WORK_STRUCT_NO_CPU = WORK_CPU_NONE << WORK_STRUCT_FLAG_BITS, WORK_BUSY_PENDING = 1 << 0, WORK_BUSY_RUNNING = 1 << 1, }; struct work_struct { atomic_long_t data; struct list_head entry; work_func_t func; }; struct delayed_work { struct work_struct work; struct timer_list timer; }; static inline __attribute__((no_instrument_function)) struct delayed_work *to_delayed_work(struct work_struct *work) { return ({ const typeof( ((struct delayed_work *)0)->work ) *__mptr = (work); (struct delayed_work *)( (char *)__mptr - __builtin_offsetof(struct delayed_work,work) );}); } struct execute_work { struct work_struct work; }; extern void __init_work(struct work_struct *work, int onstack); extern void destroy_work_on_stack(struct work_struct *work); static inline __attribute__((no_instrument_function)) unsigned int work_static(struct work_struct *work) { return *((unsigned long *)(&(work)->data)) & WORK_STRUCT_STATIC; } enum { WQ_NON_REENTRANT = 1 << 0, WQ_UNBOUND = 1 << 1, WQ_FREEZABLE = 1 << 2, WQ_MEM_RECLAIM = 1 << 3, WQ_HIGHPRI = 1 << 4, WQ_CPU_INTENSIVE = 1 << 5, WQ_DRAINING = 1 << 6, WQ_RESCUER = 1 << 7, WQ_MAX_ACTIVE = 512, WQ_MAX_UNBOUND_PER_CPU = 4, WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2, }; extern struct workqueue_struct *system_wq; extern struct workqueue_struct *system_long_wq; extern struct workqueue_struct *system_nrt_wq; extern struct workqueue_struct *system_unbound_wq; extern struct workqueue_struct *system_freezable_wq; extern struct workqueue_struct *system_nrt_freezable_wq; extern struct workqueue_struct * __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, struct lock_class_key *key, const char *lock_name, ...) __attribute__((format(printf, 1, 6))); extern void destroy_workqueue(struct workqueue_struct *wq); extern int queue_work(struct workqueue_struct *wq, struct work_struct *work); extern int queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work); extern int queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay); extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay); extern void flush_workqueue(struct workqueue_struct *wq); extern void drain_workqueue(struct workqueue_struct *wq); extern void flush_scheduled_work(void); extern int schedule_work(struct work_struct *work); extern int schedule_work_on(int cpu, struct work_struct *work); extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay); extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay); extern int schedule_on_each_cpu(work_func_t func); extern int keventd_up(void); int execute_in_process_context(work_func_t fn, struct execute_work *); extern bool flush_work(struct work_struct *work); extern bool flush_work_sync(struct work_struct *work); extern bool cancel_work_sync(struct work_struct *work); extern bool flush_delayed_work(struct delayed_work *dwork); extern bool flush_delayed_work_sync(struct delayed_work *work); extern bool cancel_delayed_work_sync(struct delayed_work *dwork); extern void workqueue_set_max_active(struct workqueue_struct *wq, int max_active); extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); extern unsigned int work_cpu(struct work_struct *work); extern unsigned int work_busy(struct work_struct *work); static inline __attribute__((no_instrument_function)) bool cancel_delayed_work(struct delayed_work *work) { bool ret; ret = del_timer_sync(&work->timer); if (ret) clear_bit(WORK_STRUCT_PENDING_BIT, ((unsigned long *)(&(&work->work)->data))); return ret; } static inline __attribute__((no_instrument_function)) bool __cancel_delayed_work(struct delayed_work *work) { bool ret; ret = del_timer(&work->timer); if (ret) clear_bit(WORK_STRUCT_PENDING_BIT, ((unsigned long *)(&(&work->work)->data))); return ret; } long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); extern void freeze_workqueues_begin(void); extern bool freeze_workqueues_busy(void); extern void thaw_workqueues(void); typedef struct __wait_queue wait_queue_t; typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key); int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); struct __wait_queue { unsigned int flags; void *private; wait_queue_func_t func; struct list_head task_list; }; struct wait_bit_key { void *flags; int bit_nr; }; struct wait_bit_queue { struct wait_bit_key key; wait_queue_t wait; }; struct __wait_queue_head { spinlock_t lock; struct list_head task_list; }; typedef struct __wait_queue_head wait_queue_head_t; struct task_struct; extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *); static inline __attribute__((no_instrument_function)) void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) { q->flags = 0; q->private = p; q->func = default_wake_function; } static inline __attribute__((no_instrument_function)) void init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func) { q->flags = 0; q->private = ((void *)0); q->func = func; } static inline __attribute__((no_instrument_function)) int waitqueue_active(wait_queue_head_t *q) { return !list_empty(&q->task_list); } extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); static inline __attribute__((no_instrument_function)) void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) { list_add(&new->task_list, &head->task_list); } static inline __attribute__((no_instrument_function)) void __add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait) { wait->flags |= 0x01; __add_wait_queue(q, wait); } static inline __attribute__((no_instrument_function)) void __add_wait_queue_tail(wait_queue_head_t *head, wait_queue_t *new) { list_add_tail(&new->task_list, &head->task_list); } static inline __attribute__((no_instrument_function)) void __add_wait_queue_tail_exclusive(wait_queue_head_t *q, wait_queue_t *wait) { wait->flags |= 0x01; __add_wait_queue_tail(q, wait); } static inline __attribute__((no_instrument_function)) void __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) { list_del(&old->task_list); } void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); void __wake_up_bit(wait_queue_head_t *, void *, int); int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); void wake_up_bit(void *, int); int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); wait_queue_head_t *bit_waitqueue(void *, int); extern void sleep_on(wait_queue_head_t *q); extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout); extern void interruptible_sleep_on(wait_queue_head_t *q); extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout); void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key); int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); static inline __attribute__((no_instrument_function)) int wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) { if (!(__builtin_constant_p((bit)) ? constant_test_bit((bit), (word)) : variable_test_bit((bit), (word)))) return 0; return out_of_line_wait_on_bit(word, bit, action, mode); } static inline __attribute__((no_instrument_function)) int wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) { if (!test_and_set_bit(bit, word)) return 0; return out_of_line_wait_on_bit_lock(word, bit, action, mode); } struct completion { unsigned int done; wait_queue_head_t wait; }; static inline __attribute__((no_instrument_function)) void init_completion(struct completion *x) { x->done = 0; do { static struct lock_class_key __key; __init_waitqueue_head((&x->wait), "&x->wait", &__key); } while (0); } extern void wait_for_completion(struct completion *); extern int wait_for_completion_interruptible(struct completion *x); extern int wait_for_completion_killable(struct completion *x); extern unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); extern long wait_for_completion_interruptible_timeout( struct completion *x, unsigned long timeout); extern long wait_for_completion_killable_timeout( struct completion *x, unsigned long timeout); extern bool try_wait_for_completion(struct completion *x); extern bool completion_done(struct completion *x); extern void complete(struct completion *); extern void complete_all(struct completion *); extern void (*pm_idle)(void); extern void (*pm_power_off)(void); extern void (*pm_power_off_prepare)(void); struct device; extern const char power_group_name[]; typedef struct pm_message { int event; } pm_message_t; struct dev_pm_ops { int (*prepare)(struct device *dev); void (*complete)(struct device *dev); int (*suspend)(struct device *dev); int (*resume)(struct device *dev); int (*freeze)(struct device *dev); int (*thaw)(struct device *dev); int (*poweroff)(struct device *dev); int (*restore)(struct device *dev); int (*suspend_late)(struct device *dev); int (*resume_early)(struct device *dev); int (*freeze_late)(struct device *dev); int (*thaw_early)(struct device *dev); int (*poweroff_late)(struct device *dev); int (*restore_early)(struct device *dev); int (*suspend_noirq)(struct device *dev); int (*resume_noirq)(struct device *dev); int (*freeze_noirq)(struct device *dev); int (*thaw_noirq)(struct device *dev); int (*poweroff_noirq)(struct device *dev); int (*restore_noirq)(struct device *dev); int (*runtime_suspend)(struct device *dev); int (*runtime_resume)(struct device *dev); int (*runtime_idle)(struct device *dev); }; enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING, RPM_SUSPENDED, RPM_SUSPENDING, }; enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE, RPM_REQ_SUSPEND, RPM_REQ_AUTOSUSPEND, RPM_REQ_RESUME, }; struct wakeup_source; struct pm_domain_data { struct list_head list_node; struct device *dev; }; struct pm_subsys_data { spinlock_t lock; unsigned int refcount; }; struct dev_pm_info { pm_message_t power_state; unsigned int can_wakeup:1; unsigned int async_suspend:1; bool is_prepared:1; bool is_suspended:1; bool ignore_children:1; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path:1; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; atomic_t usage_count; atomic_t child_count; unsigned int disable_depth:3; unsigned int idle_notification:1; unsigned int request_pending:1; unsigned int deferred_resume:1; unsigned int run_wake:1; unsigned int runtime_auto:1; unsigned int no_callbacks:1; unsigned int irq_safe:1; unsigned int use_autosuspend:1; unsigned int timer_autosuspends:1; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; ktime_t suspend_time; s64 max_time_suspended_ns; struct dev_pm_qos_request *pq_req; struct pm_subsys_data *subsys_data; struct pm_qos_constraints *constraints; }; extern void update_pm_runtime_accounting(struct device *dev); extern int dev_pm_get_subsys_data(struct device *dev); extern int dev_pm_put_subsys_data(struct device *dev); struct dev_pm_domain { struct dev_pm_ops ops; }; extern void device_pm_lock(void); extern void dpm_resume_start(pm_message_t state); extern void dpm_resume_end(pm_message_t state); extern void dpm_resume(pm_message_t state); extern void dpm_complete(pm_message_t state); extern void device_pm_unlock(void); extern int dpm_suspend_end(pm_message_t state); extern int dpm_suspend_start(pm_message_t state); extern int dpm_suspend(pm_message_t state); extern int dpm_prepare(pm_message_t state); extern void __suspend_report_result(const char *function, void *fn, int ret); extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); extern int pm_generic_prepare(struct device *dev); extern int pm_generic_suspend_late(struct device *dev); extern int pm_generic_suspend_noirq(struct device *dev); extern int pm_generic_suspend(struct device *dev); extern int pm_generic_resume_early(struct device *dev); extern int pm_generic_resume_noirq(struct device *dev); extern int pm_generic_resume(struct device *dev); extern int pm_generic_freeze_noirq(struct device *dev); extern int pm_generic_freeze_late(struct device *dev); extern int pm_generic_freeze(struct device *dev); extern int pm_generic_thaw_noirq(struct device *dev); extern int pm_generic_thaw_early(struct device *dev); extern int pm_generic_thaw(struct device *dev); extern int pm_generic_restore_noirq(struct device *dev); extern int pm_generic_restore_early(struct device *dev); extern int pm_generic_restore(struct device *dev); extern int pm_generic_poweroff_noirq(struct device *dev); extern int pm_generic_poweroff_late(struct device *dev); extern int pm_generic_poweroff(struct device *dev); extern void pm_generic_complete(struct device *dev); enum dpm_order { DPM_ORDER_NONE, DPM_ORDER_DEV_AFTER_PARENT, DPM_ORDER_PARENT_BEFORE_DEV, DPM_ORDER_DEV_LAST, }; typedef struct { unsigned long bits[((((1 << 10)) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; } nodemask_t; extern nodemask_t _unused_nodemask_arg_; static inline __attribute__((no_instrument_function)) void __node_set(int node, volatile nodemask_t *dstp) { set_bit(node, dstp->bits); } static inline __attribute__((no_instrument_function)) void __node_clear(int node, volatile nodemask_t *dstp) { clear_bit(node, dstp->bits); } static inline __attribute__((no_instrument_function)) void __nodes_setall(nodemask_t *dstp, int nbits) { bitmap_fill(dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_clear(nodemask_t *dstp, int nbits) { bitmap_zero(dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __node_test_and_set(int node, nodemask_t *addr) { return test_and_set_bit(node, addr->bits); } static inline __attribute__((no_instrument_function)) void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_complement(nodemask_t *dstp, const nodemask_t *srcp, int nbits) { bitmap_complement(dstp->bits, srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_equal(const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { return bitmap_equal(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_intersects(const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { return bitmap_intersects(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_subset(const nodemask_t *src1p, const nodemask_t *src2p, int nbits) { return bitmap_subset(src1p->bits, src2p->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_empty(const nodemask_t *srcp, int nbits) { return bitmap_empty(srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_full(const nodemask_t *srcp, int nbits) { return bitmap_full(srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodes_weight(const nodemask_t *srcp, int nbits) { return bitmap_weight(srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_shift_right(nodemask_t *dstp, const nodemask_t *srcp, int n, int nbits) { bitmap_shift_right(dstp->bits, srcp->bits, n, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_shift_left(nodemask_t *dstp, const nodemask_t *srcp, int n, int nbits) { bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); } static inline __attribute__((no_instrument_function)) int __first_node(const nodemask_t *srcp) { return ({ int __min1 = ((1 << 10)); int __min2 = (find_first_bit(srcp->bits, (1 << 10))); __min1 < __min2 ? __min1: __min2; }); } static inline __attribute__((no_instrument_function)) int __next_node(int n, const nodemask_t *srcp) { return ({ int __min1 = ((1 << 10)); int __min2 = (find_next_bit(srcp->bits, (1 << 10), n+1)); __min1 < __min2 ? __min1: __min2; }); } static inline __attribute__((no_instrument_function)) void init_nodemask_of_node(nodemask_t *mask, int node) { __nodes_clear(&(*mask), (1 << 10)); __node_set((node), &(*mask)); } static inline __attribute__((no_instrument_function)) int __first_unset_node(const nodemask_t *maskp) { return ({ int __min1 = ((1 << 10)); int __min2 = (find_first_zero_bit(maskp->bits, (1 << 10))); __min1 < __min2 ? __min1: __min2; }) ; } static inline __attribute__((no_instrument_function)) int __nodemask_scnprintf(char *buf, int len, const nodemask_t *srcp, int nbits) { return bitmap_scnprintf(buf, len, srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodemask_parse_user(const char *buf, int len, nodemask_t *dstp, int nbits) { return bitmap_parse_user(buf, len, dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodelist_scnprintf(char *buf, int len, const nodemask_t *srcp, int nbits) { return bitmap_scnlistprintf(buf, len, srcp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) { return bitmap_parselist(buf, dstp->bits, nbits); } static inline __attribute__((no_instrument_function)) int __node_remap(int oldbit, const nodemask_t *oldp, const nodemask_t *newp, int nbits) { return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, const nodemask_t *oldp, const nodemask_t *newp, int nbits) { bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp, const nodemask_t *relmapp, int nbits) { bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits); } static inline __attribute__((no_instrument_function)) void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp, int sz, int nbits) { bitmap_fold(dstp->bits, origp->bits, sz, nbits); } enum node_states { N_POSSIBLE, N_ONLINE, N_NORMAL_MEMORY, N_HIGH_MEMORY = N_NORMAL_MEMORY, N_CPU, NR_NODE_STATES }; extern nodemask_t node_states[NR_NODE_STATES]; static inline __attribute__((no_instrument_function)) int node_state(int node, enum node_states state) { return (__builtin_constant_p(((node))) ? constant_test_bit(((node)), ((node_states[state]).bits)) : variable_test_bit(((node)), ((node_states[state]).bits))); } static inline __attribute__((no_instrument_function)) void node_set_state(int node, enum node_states state) { __node_set(node, &node_states[state]); } static inline __attribute__((no_instrument_function)) void node_clear_state(int node, enum node_states state) { __node_clear(node, &node_states[state]); } static inline __attribute__((no_instrument_function)) int num_node_state(enum node_states state) { return __nodes_weight(&(node_states[state]), (1 << 10)); } extern int nr_node_ids; extern int nr_online_nodes; static inline __attribute__((no_instrument_function)) void node_set_online(int nid) { node_set_state(nid, N_ONLINE); nr_online_nodes = num_node_state(N_ONLINE); } static inline __attribute__((no_instrument_function)) void node_set_offline(int nid) { node_clear_state(nid, N_ONLINE); nr_online_nodes = num_node_state(N_ONLINE); } extern int node_random(const nodemask_t *maskp); struct nodemask_scratch { nodemask_t mask1; nodemask_t mask2; }; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_x86_cpu_to_node_map; extern __attribute__((section(".data..percpu" ""))) __typeof__(int) x86_cpu_to_node_map; extern __typeof__(int) *x86_cpu_to_node_map_early_ptr; extern __typeof__(int) x86_cpu_to_node_map_early_map[]; extern int __cpu_to_node(int cpu); extern int early_cpu_to_node(int cpu); extern cpumask_var_t node_to_cpumask_map[(1 << 10)]; extern const struct cpumask *cpumask_of_node(int node); extern void setup_node_to_cpumask_map(void); extern int __node_distance(int, int); extern const struct cpumask *cpu_coregroup_mask(int cpu); static inline __attribute__((no_instrument_function)) void arch_fix_phys_package_id(int num, u32 slot) { } struct pci_bus; void x86_pci_root_bus_resources(int bus, struct list_head *resources); extern int get_mp_bus_to_node(int busnum); extern void set_mp_bus_to_node(int busnum, int node); extern int numa_off; extern s16 __apicid_to_node[32768]; extern nodemask_t numa_nodes_parsed __attribute__ ((__section__(".init.data"))); extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) numa_add_memblk(int nodeid, u64 start, u64 end); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) numa_set_distance(int from, int to, int distance); static inline __attribute__((no_instrument_function)) void set_apicid_to_node(int apicid, s16 node) { __apicid_to_node[apicid] = node; } extern int __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) numa_cpu_node(int cpu); extern unsigned long numa_free_all_bootmem(void); extern void __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) numa_set_node(int cpu, int node); extern void __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) numa_clear_node(int cpu); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) init_cpu_to_node(void); extern void __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) numa_add_cpu(int cpu); extern void __attribute__ ((__section__(".cpuinit.text"))) __attribute__((no_instrument_function)) numa_remove_cpu(int cpu); void debug_cpumask_set_cpu(int cpu, int node, bool enable); void numa_emu_cmdline(char *); struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; const char *name; void *magic; }; struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; }; extern void mutex_destroy(struct mutex *lock); extern void __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key); static inline __attribute__((no_instrument_function)) int mutex_is_locked(struct mutex *lock) { return atomic_read(&lock->count) != 1; } extern void mutex_lock(struct mutex *lock); extern int __attribute__((warn_unused_result)) mutex_lock_interruptible(struct mutex *lock); extern int __attribute__((warn_unused_result)) mutex_lock_killable(struct mutex *lock); extern int mutex_trylock(struct mutex *lock); extern void mutex_unlock(struct mutex *lock); extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); typedef struct { void *ldt; int size; unsigned short ia32_compat; struct mutex lock; void *vdso; } mm_context_t; void leave_mm(int cpu); static inline __attribute__((no_instrument_function)) unsigned char readb(const volatile void *addr) { unsigned char ret; asm volatile("mov" "b" " %1,%0":"=q" (ret) :"m" (*(volatile unsigned char *)addr) :"memory"); return ret; } static inline __attribute__((no_instrument_function)) unsigned short readw(const volatile void *addr) { unsigned short ret; asm volatile("mov" "w" " %1,%0":"=r" (ret) :"m" (*(volatile unsigned short *)addr) :"memory"); return ret; } static inline __attribute__((no_instrument_function)) unsigned int readl(const volatile void *addr) { unsigned int ret; asm volatile("mov" "l" " %1,%0":"=r" (ret) :"m" (*(volatile unsigned int *)addr) :"memory"); return ret; } static inline __attribute__((no_instrument_function)) unsigned char __readb(const volatile void *addr) { unsigned char ret; asm volatile("mov" "b" " %1,%0":"=q" (ret) :"m" (*(volatile unsigned char *)addr) ); return ret; } static inline __attribute__((no_instrument_function)) unsigned short __readw(const volatile void *addr) { unsigned short ret; asm volatile("mov" "w" " %1,%0":"=r" (ret) :"m" (*(volatile unsigned short *)addr) ); return ret; } static inline __attribute__((no_instrument_function)) unsigned int __readl(const volatile void *addr) { unsigned int ret; asm volatile("mov" "l" " %1,%0":"=r" (ret) :"m" (*(volatile unsigned int *)addr) ); return ret; } static inline __attribute__((no_instrument_function)) void writeb(unsigned char val, volatile void *addr) { asm volatile("mov" "b" " %0,%1": :"q" (val), "m" (*(volatile unsigned char *)addr) :"memory"); } static inline __attribute__((no_instrument_function)) void writew(unsigned short val, volatile void *addr) { asm volatile("mov" "w" " %0,%1": :"r" (val), "m" (*(volatile unsigned short *)addr) :"memory"); } static inline __attribute__((no_instrument_function)) void writel(unsigned int val, volatile void *addr) { asm volatile("mov" "l" " %0,%1": :"r" (val), "m" (*(volatile unsigned int *)addr) :"memory"); } static inline __attribute__((no_instrument_function)) void __writeb(unsigned char val, volatile void *addr) { asm volatile("mov" "b" " %0,%1": :"q" (val), "m" (*(volatile unsigned char *)addr) ); } static inline __attribute__((no_instrument_function)) void __writew(unsigned short val, volatile void *addr) { asm volatile("mov" "w" " %0,%1": :"r" (val), "m" (*(volatile unsigned short *)addr) ); } static inline __attribute__((no_instrument_function)) void __writel(unsigned int val, volatile void *addr) { asm volatile("mov" "l" " %0,%1": :"r" (val), "m" (*(volatile unsigned int *)addr) ); } static inline __attribute__((no_instrument_function)) unsigned long readq(const volatile void *addr) { unsigned long ret; asm volatile("mov" "q" " %1,%0":"=r" (ret) :"m" (*(volatile unsigned long *)addr) :"memory"); return ret; } static inline __attribute__((no_instrument_function)) void writeq(unsigned long val, volatile void *addr) { asm volatile("mov" "q" " %0,%1": :"r" (val), "m" (*(volatile unsigned long *)addr) :"memory"); } static inline __attribute__((no_instrument_function)) phys_addr_t virt_to_phys(volatile void *address) { return __phys_addr((unsigned long)(address)); } static inline __attribute__((no_instrument_function)) void *phys_to_virt(phys_addr_t address) { return ((void *)((unsigned long)(address)+((unsigned long)(0xffff880000000000UL)))); } static inline __attribute__((no_instrument_function)) unsigned int isa_virt_to_bus(volatile void *address) { return (unsigned int)virt_to_phys(address); } extern void *ioremap_nocache(resource_size_t offset, unsigned long size); extern void *ioremap_cache(resource_size_t offset, unsigned long size); extern void *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val); static inline __attribute__((no_instrument_function)) void *ioremap(resource_size_t offset, unsigned long size) { return ioremap_nocache(offset, size); } extern void iounmap(volatile void *addr); extern void set_iounmap_nonlazy(void); extern unsigned int ioread8(void *); extern unsigned int ioread16(void *); extern unsigned int ioread16be(void *); extern unsigned int ioread32(void *); extern unsigned int ioread32be(void *); extern void iowrite8(u8, void *); extern void iowrite16(u16, void *); extern void iowrite16be(u16, void *); extern void iowrite32(u32, void *); extern void iowrite32be(u32, void *); extern void ioread8_rep(void *port, void *buf, unsigned long count); extern void ioread16_rep(void *port, void *buf, unsigned long count); extern void ioread32_rep(void *port, void *buf, unsigned long count); extern void iowrite8_rep(void *port, const void *buf, unsigned long count); extern void iowrite16_rep(void *port, const void *buf, unsigned long count); extern void iowrite32_rep(void *port, const void *buf, unsigned long count); extern void *ioport_map(unsigned long port, unsigned int nr); extern void ioport_unmap(void *); struct pci_dev; extern void pci_iounmap(struct pci_dev *dev, void *); struct pci_dev; extern void *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); struct vm_area_struct; struct vm_struct { struct vm_struct *next; void *addr; unsigned long size; unsigned long flags; struct page **pages; unsigned int nr_pages; phys_addr_t phys_addr; void *caller; }; extern void vm_unmap_ram(const void *mem, unsigned int count); extern void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot); extern void vm_unmap_aliases(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) vmalloc_init(void); extern void *vmalloc(unsigned long size); extern void *vzalloc(unsigned long size); extern void *vmalloc_user(unsigned long size); extern void *vmalloc_node(unsigned long size, int node); extern void *vzalloc_node(unsigned long size, int node); extern void *vmalloc_exec(unsigned long size); extern void *vmalloc_32(unsigned long size); extern void *vmalloc_32_user(unsigned long size); extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); extern void *__vmalloc_node_range(unsigned long size, unsigned long align, unsigned long start, unsigned long end, gfp_t gfp_mask, pgprot_t prot, int node, void *caller); extern void vfree(const void *addr); extern void *vmap(struct page **pages, unsigned int count, unsigned long flags, pgprot_t prot); extern void vunmap(const void *addr); extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, unsigned long pgoff); void vmalloc_sync_all(void); static inline __attribute__((no_instrument_function)) size_t get_vm_area_size(const struct vm_struct *area) { return area->size - ((1UL) << 12); } extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); extern struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, void *caller); extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end); extern struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, unsigned long start, unsigned long end, void *caller); extern struct vm_struct *remove_vm_area(const void *addr); extern int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages); extern int map_kernel_range_noflush(unsigned long start, unsigned long size, pgprot_t prot, struct page **pages); extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); extern void unmap_kernel_range(unsigned long addr, unsigned long size); extern struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes); extern void free_vm_area(struct vm_struct *area); extern long vread(char *buf, char *addr, unsigned long count); extern long vwrite(char *buf, char *addr, unsigned long count); extern rwlock_t vmlist_lock; extern struct vm_struct *vmlist; extern __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) void vm_area_add_early(struct vm_struct *vm); extern __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) void vm_area_register_early(struct vm_struct *vm, size_t align); struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, const size_t *sizes, int nr_vms, size_t align); void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); static inline __attribute__((no_instrument_function)) void memset_io(volatile void *addr, unsigned char val, size_t count) { memset((void *)addr, val, count); } static inline __attribute__((no_instrument_function)) void memcpy_fromio(void *dst, const volatile void *src, size_t count) { ({ size_t __len = (count); void *__ret; if (__builtin_constant_p(count) && __len >= 64) __ret = __memcpy((dst), ((const void *)src), __len); else __ret = __builtin_memcpy((dst), ((const void *)src), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void memcpy_toio(volatile void *dst, const void *src, size_t count) { ({ size_t __len = (count); void *__ret; if (__builtin_constant_p(count) && __len >= 64) __ret = __memcpy(((void *)dst), (src), __len); else __ret = __builtin_memcpy(((void *)dst), (src), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void flush_write_buffers(void) { } extern void native_io_delay(void); extern int io_delay_type; extern void io_delay_init(void); static inline __attribute__((no_instrument_function)) void outb(unsigned char value, int port) { asm volatile("out" "b" " %" "b" "0, %w1" : : "a"(value), "Nd"(port)); } static inline __attribute__((no_instrument_function)) unsigned char inb(int port) { unsigned char value; asm volatile("in" "b" " %w1, %" "b" "0" : "=a"(value) : "Nd"(port)); return value; } static inline __attribute__((no_instrument_function)) void outb_p(unsigned char value, int port) { outb(value, port); slow_down_io(); } static inline __attribute__((no_instrument_function)) unsigned char inb_p(int port) { unsigned char value = inb(port); slow_down_io(); return value; } static inline __attribute__((no_instrument_function)) void outsb(int port, const void *addr, unsigned long count) { asm volatile("rep; outs" "b" : "+S"(addr), "+c"(count) : "d"(port)); } static inline __attribute__((no_instrument_function)) void insb(int port, void *addr, unsigned long count) { asm volatile("rep; ins" "b" : "+D"(addr), "+c"(count) : "d"(port)); } static inline __attribute__((no_instrument_function)) void outw(unsigned short value, int port) { asm volatile("out" "w" " %" "w" "0, %w1" : : "a"(value), "Nd"(port)); } static inline __attribute__((no_instrument_function)) unsigned short inw(int port) { unsigned short value; asm volatile("in" "w" " %w1, %" "w" "0" : "=a"(value) : "Nd"(port)); return value; } static inline __attribute__((no_instrument_function)) void outw_p(unsigned short value, int port) { outw(value, port); slow_down_io(); } static inline __attribute__((no_instrument_function)) unsigned short inw_p(int port) { unsigned short value = inw(port); slow_down_io(); return value; } static inline __attribute__((no_instrument_function)) void outsw(int port, const void *addr, unsigned long count) { asm volatile("rep; outs" "w" : "+S"(addr), "+c"(count) : "d"(port)); } static inline __attribute__((no_instrument_function)) void insw(int port, void *addr, unsigned long count) { asm volatile("rep; ins" "w" : "+D"(addr), "+c"(count) : "d"(port)); } static inline __attribute__((no_instrument_function)) void outl(unsigned int value, int port) { asm volatile("out" "l" " %" "" "0, %w1" : : "a"(value), "Nd"(port)); } static inline __attribute__((no_instrument_function)) unsigned int inl(int port) { unsigned int value; asm volatile("in" "l" " %w1, %" "" "0" : "=a"(value) : "Nd"(port)); return value; } static inline __attribute__((no_instrument_function)) void outl_p(unsigned int value, int port) { outl(value, port); slow_down_io(); } static inline __attribute__((no_instrument_function)) unsigned int inl_p(int port) { unsigned int value = inl(port); slow_down_io(); return value; } static inline __attribute__((no_instrument_function)) void outsl(int port, const void *addr, unsigned long count) { asm volatile("rep; outs" "l" : "+S"(addr), "+c"(count) : "d"(port)); } static inline __attribute__((no_instrument_function)) void insl(int port, void *addr, unsigned long count) { asm volatile("rep; ins" "l" : "+D"(addr), "+c"(count) : "d"(port)); } extern void *xlate_dev_mem_ptr(unsigned long phys); extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, unsigned long prot_val); extern void *ioremap_wc(resource_size_t offset, unsigned long size); extern void early_ioremap_init(void); extern void early_ioremap_reset(void); extern void *early_ioremap(resource_size_t phys_addr, unsigned long size); extern void *early_memremap(resource_size_t phys_addr, unsigned long size); extern void early_iounmap(void *addr, unsigned long size); extern void fixup_early_ioremap(void); extern bool is_early_ioremap_ptep(pte_t *ptep); enum xen_domain_type { XEN_NATIVE, XEN_PV_DOMAIN, XEN_HVM_DOMAIN, }; extern enum xen_domain_type xen_domain_type; typedef unsigned char * __guest_handle_uchar; typedef unsigned int * __guest_handle_uint; typedef unsigned long * __guest_handle_ulong; typedef char * __guest_handle_char; typedef int * __guest_handle_int; typedef long * __guest_handle_long; typedef void * __guest_handle_void; typedef uint64_t * __guest_handle_uint64_t; typedef uint32_t * __guest_handle_uint32_t; struct trap_info { uint8_t vector; uint8_t flags; uint16_t cs; unsigned long address; }; typedef struct trap_info * __guest_handle_trap_info; struct arch_shared_info { unsigned long max_pfn; unsigned long pfn_to_mfn_frame_list_list; unsigned long nmi_reason; }; struct iret_context { uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss; }; struct cpu_user_regs { uint64_t r15; uint64_t r14; uint64_t r13; uint64_t r12; union { uint64_t rbp, ebp; uint32_t _ebp; }; union { uint64_t rbx, ebx; uint32_t _ebx; }; uint64_t r11; uint64_t r10; uint64_t r9; uint64_t r8; union { uint64_t rax, eax; uint32_t _eax; }; union { uint64_t rcx, ecx; uint32_t _ecx; }; union { uint64_t rdx, edx; uint32_t _edx; }; union { uint64_t rsi, esi; uint32_t _esi; }; union { uint64_t rdi, edi; uint32_t _edi; }; uint32_t error_code; uint32_t entry_vector; union { uint64_t rip, eip; uint32_t _eip; }; uint16_t cs, _pad0[1]; uint8_t saved_upcall_mask; uint8_t _pad1[3]; union { uint64_t rflags, eflags; uint32_t _eflags; }; union { uint64_t rsp, esp; uint32_t _esp; }; uint16_t ss, _pad2[3]; uint16_t es, _pad3[3]; uint16_t ds, _pad4[3]; uint16_t fs, _pad5[3]; uint16_t gs, _pad6[3]; }; typedef struct cpu_user_regs * __guest_handle_cpu_user_regs; struct arch_vcpu_info { unsigned long cr2; unsigned long pad; }; typedef unsigned long xen_callback_t; struct vcpu_guest_context { struct { char x[512]; } fpu_ctxt; unsigned long flags; struct cpu_user_regs user_regs; struct trap_info trap_ctxt[256]; unsigned long ldt_base, ldt_ents; unsigned long gdt_frames[16], gdt_ents; unsigned long kernel_ss, kernel_sp; unsigned long ctrlreg[8]; unsigned long debugreg[8]; unsigned long event_callback_eip; unsigned long failsafe_callback_eip; unsigned long syscall_callback_eip; unsigned long vm_assist; uint64_t fs_base; uint64_t gs_base_kernel; uint64_t gs_base_user; }; typedef struct vcpu_guest_context * __guest_handle_vcpu_guest_context; struct pvclock_vcpu_time_info { u32 version; u32 pad0; u64 tsc_timestamp; u64 system_time; u32 tsc_to_system_mul; s8 tsc_shift; u8 flags; u8 pad[2]; } __attribute__((__packed__)); struct pvclock_wall_clock { u32 version; u32 sec; u32 nsec; } __attribute__((__packed__)); struct mmuext_op { unsigned int cmd; union { unsigned long mfn; unsigned long linear_addr; } arg1; union { unsigned int nr_ents; void *vcpumask; } arg2; }; typedef struct mmuext_op * __guest_handle_mmuext_op; typedef uint16_t domid_t; struct mmu_update { uint64_t ptr; uint64_t val; }; typedef struct mmu_update * __guest_handle_mmu_update; struct multicall_entry { unsigned long op; long result; unsigned long args[6]; }; typedef struct multicall_entry * __guest_handle_multicall_entry; struct vcpu_time_info { uint32_t version; uint32_t pad0; uint64_t tsc_timestamp; uint64_t system_time; uint32_t tsc_to_system_mul; int8_t tsc_shift; int8_t pad1[3]; }; struct vcpu_info { uint8_t evtchn_upcall_pending; uint8_t evtchn_upcall_mask; unsigned long evtchn_pending_sel; struct arch_vcpu_info arch; struct pvclock_vcpu_time_info time; }; struct shared_info { struct vcpu_info vcpu_info[32]; unsigned long evtchn_pending[sizeof(unsigned long) * 8]; unsigned long evtchn_mask[sizeof(unsigned long) * 8]; struct pvclock_wall_clock wc; struct arch_shared_info arch; }; struct start_info { char magic[32]; unsigned long nr_pages; unsigned long shared_info; uint32_t flags; unsigned long store_mfn; uint32_t store_evtchn; union { struct { unsigned long mfn; uint32_t evtchn; } domU; struct { uint32_t info_off; uint32_t info_size; } dom0; } console; unsigned long pt_base; unsigned long nr_pt_frames; unsigned long mfn_list; unsigned long mod_start; unsigned long mod_len; int8_t cmd_line[1024]; }; struct dom0_vga_console_info { uint8_t video_type; union { struct { uint16_t font_height; uint16_t cursor_x, cursor_y; uint16_t rows, columns; } text_mode_3; struct { uint16_t width, height; uint16_t bytes_per_line; uint16_t bits_per_pixel; uint32_t lfb_base; uint32_t lfb_size; uint8_t red_pos, red_size; uint8_t green_pos, green_size; uint8_t blue_pos, blue_size; uint8_t rsvd_pos, rsvd_size; uint32_t gbl_caps; uint16_t mode_attrs; } vesa_lfb; } u; }; typedef uint64_t cpumap_t; typedef uint8_t xen_domain_handle_t[16]; struct tmem_op { uint32_t cmd; int32_t pool_id; union { struct { uint64_t uuid[2]; uint32_t flags; } new; struct { uint64_t oid[3]; uint32_t index; uint32_t tmem_offset; uint32_t pfn_offset; uint32_t len; __guest_handle_void gmfn; } gen; } u; }; typedef u64 * __guest_handle_u64; extern struct shared_info *HYPERVISOR_shared_info; extern struct start_info *xen_start_info; static inline __attribute__((no_instrument_function)) uint32_t xen_cpuid_base(void) { uint32_t base, eax, ebx, ecx, edx; char signature[13]; for (base = 0x40000000; base < 0x40010000; base += 0x100) { cpuid(base, &eax, &ebx, &ecx, &edx); *(uint32_t *)(signature + 0) = ebx; *(uint32_t *)(signature + 4) = ecx; *(uint32_t *)(signature + 8) = edx; signature[12] = 0; if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2)) return base; } return 0; } extern bool xen_hvm_need_lapic(void); static inline __attribute__((no_instrument_function)) bool xen_x2apic_para_available(void) { return xen_hvm_need_lapic(); } struct bio_vec; extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, const struct bio_vec *vec2); extern const unsigned char x86_trampoline_start []; extern const unsigned char x86_trampoline_end []; extern unsigned char *x86_trampoline_base; extern unsigned long init_rsp; extern unsigned long initial_code; extern unsigned long initial_gs; extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) setup_trampolines(void); extern const unsigned char trampoline_data[]; extern const unsigned char trampoline_status[]; static inline __attribute__((no_instrument_function)) unsigned long trampoline_address(void) { return virt_to_phys(((void *)(x86_trampoline_base + ((const unsigned char *)(trampoline_data) - x86_trampoline_start)))); } int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock); extern int acpi_lapic; extern int acpi_ioapic; extern int acpi_noirq; extern int acpi_strict; extern int acpi_disabled; extern int acpi_pci_disabled; extern int acpi_skip_timer_override; extern int acpi_use_timer_override; extern int acpi_fix_pin2_polarity; extern u8 acpi_sci_flags; extern int acpi_sci_override_gsi; void acpi_pic_sci_set_trigger(unsigned int, u16); extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi, int trigger, int polarity); static inline __attribute__((no_instrument_function)) void disable_acpi(void) { acpi_disabled = 1; acpi_pci_disabled = 1; acpi_noirq = 1; } extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); static inline __attribute__((no_instrument_function)) void acpi_noirq_set(void) { acpi_noirq = 1; } static inline __attribute__((no_instrument_function)) void acpi_disable_pci(void) { acpi_pci_disabled = 1; acpi_noirq_set(); } extern int acpi_suspend_lowlevel(void); extern const unsigned char acpi_wakeup_code[]; extern void acpi_reserve_wakeup_memory(void); static inline __attribute__((no_instrument_function)) unsigned int acpi_processor_cstate_check(unsigned int max_cstate) { if (boot_cpu_data.x86 == 0x0F && boot_cpu_data.x86_vendor == 2 && boot_cpu_data.x86_model <= 0x05 && boot_cpu_data.x86_mask < 0x0A) return 1; else if (amd_e400_c1e_detected) return 1; else return max_cstate; } static inline __attribute__((no_instrument_function)) bool arch_has_acpi_pdc(void) { struct cpuinfo_x86 *c = &(*({ do { const void *__vpp_verify = (typeof((&(cpu_info))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(cpu_info))) *)(&(cpu_info)))); (typeof((typeof(*(&(cpu_info))) *)(&(cpu_info)))) (__ptr + (((__per_cpu_offset[0])))); }); })); return (c->x86_vendor == 0 || c->x86_vendor == 5); } static inline __attribute__((no_instrument_function)) void arch_acpi_set_pdc_bits(u32 *buf) { struct cpuinfo_x86 *c = &(*({ do { const void *__vpp_verify = (typeof((&(cpu_info))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(cpu_info))) *)(&(cpu_info)))); (typeof((typeof(*(&(cpu_info))) *)(&(cpu_info)))) (__ptr + (((__per_cpu_offset[0])))); }); })); buf[2] |= ((0x0010) | (0x0008) | (0x0002) | (0x0100) | (0x0200)); if ((__builtin_constant_p((4*32+ 7)) && ( ((((4*32+ 7))>>5)==0 && (1UL<<(((4*32+ 7))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((4*32+ 7))>>5)==1 && (1UL<<(((4*32+ 7))&31) & ((1<<((1*32+29) & 31))|0))) || ((((4*32+ 7))>>5)==2 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==3 && (1UL<<(((4*32+ 7))&31) & ((1<<((3*32+20) & 31))))) || ((((4*32+ 7))>>5)==4 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==5 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==6 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==7 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==8 && (1UL<<(((4*32+ 7))&31) & 0)) || ((((4*32+ 7))>>5)==9 && (1UL<<(((4*32+ 7))&31) & 0)) ) ? 1 : (__builtin_constant_p(((4*32+ 7))) ? constant_test_bit(((4*32+ 7)), ((unsigned long *)((c)->x86_capability))) : variable_test_bit(((4*32+ 7)), ((unsigned long *)((c)->x86_capability)))))) buf[2] |= ((0x0008) | (0x0002) | (0x0020) | (0x0800) | (0x0001)); if ((__builtin_constant_p((0*32+22)) && ( ((((0*32+22))>>5)==0 && (1UL<<(((0*32+22))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((0*32+22))>>5)==1 && (1UL<<(((0*32+22))&31) & ((1<<((1*32+29) & 31))|0))) || ((((0*32+22))>>5)==2 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==3 && (1UL<<(((0*32+22))&31) & ((1<<((3*32+20) & 31))))) || ((((0*32+22))>>5)==4 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==5 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==6 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==7 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==8 && (1UL<<(((0*32+22))&31) & 0)) || ((((0*32+22))>>5)==9 && (1UL<<(((0*32+22))&31) & 0)) ) ? 1 : (__builtin_constant_p(((0*32+22))) ? constant_test_bit(((0*32+22)), ((unsigned long *)((c)->x86_capability))) : variable_test_bit(((0*32+22)), ((unsigned long *)((c)->x86_capability)))))) buf[2] |= (0x0004); if (!(__builtin_constant_p((4*32+ 3)) && ( ((((4*32+ 3))>>5)==0 && (1UL<<(((4*32+ 3))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((4*32+ 3))>>5)==1 && (1UL<<(((4*32+ 3))&31) & ((1<<((1*32+29) & 31))|0))) || ((((4*32+ 3))>>5)==2 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==3 && (1UL<<(((4*32+ 3))&31) & ((1<<((3*32+20) & 31))))) || ((((4*32+ 3))>>5)==4 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==5 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==6 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==7 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==8 && (1UL<<(((4*32+ 3))&31) & 0)) || ((((4*32+ 3))>>5)==9 && (1UL<<(((4*32+ 3))&31) & 0)) ) ? 1 : (__builtin_constant_p(((4*32+ 3))) ? constant_test_bit(((4*32+ 3)), ((unsigned long *)((c)->x86_capability))) : variable_test_bit(((4*32+ 3)), ((unsigned long *)((c)->x86_capability)))))) buf[2] &= ~((0x0200)); } extern int acpi_numa; extern int x86_acpi_numa_init(void); enum vsyscall_num { __NR_vgettimeofday, __NR_vtime, __NR_vgetcpu, }; extern int vgetcpu_mode; extern struct timezone sys_tz; static volatile unsigned long const * const vvaraddr_jiffies = (void *)((-10*1024*1024 - 4096) + (0)); static int const * const vvaraddr_vgetcpu_mode = (void *)((-10*1024*1024 - 4096) + (16)); static struct vsyscall_gtod_data const * const vvaraddr_vsyscall_gtod_data = (void *)((-10*1024*1024 - 4096) + (128)); extern void map_vsyscall(void); extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address); enum fixed_addresses { VSYSCALL_LAST_PAGE, VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + (((-2UL << 20)-(-10UL << 20)) >> 12) - 1, VVAR_PAGE, VSYSCALL_HPET, FIX_DBGP_BASE, FIX_EARLYCON_MEM_BASE, FIX_OHCI1394_BASE, FIX_APIC_BASE, FIX_IO_APIC_BASE_0, FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + 128 - 1, FIX_PARAVIRT_BOOTMAP, FIX_TEXT_POKE1, FIX_TEXT_POKE0, __end_of_permanent_fixed_addresses, FIX_BTMAP_END = (__end_of_permanent_fixed_addresses ^ (__end_of_permanent_fixed_addresses + (64 * 4) - 1)) & -512 ? __end_of_permanent_fixed_addresses + (64 * 4) - (__end_of_permanent_fixed_addresses & ((64 * 4) - 1)) : __end_of_permanent_fixed_addresses, FIX_BTMAP_BEGIN = FIX_BTMAP_END + (64 * 4) - 1, FIX_TBOOT_BASE, __end_of_fixed_addresses }; extern void reserve_top_address(unsigned long reserve); extern int fixmaps_set; extern pte_t *kmap_pte; extern pgprot_t kmap_prot; extern pte_t *pkmap_page_table; void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags); extern void __this_fixmap_does_not_exist(void); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) unsigned long fix_to_virt(const unsigned int idx) { if (idx >= __end_of_fixed_addresses) __this_fixmap_does_not_exist(); return (((-2UL << 20)-((1UL) << 12)) - ((idx) << 12)); } static inline __attribute__((no_instrument_function)) unsigned long virt_to_fix(const unsigned long vaddr) { do { if (ldv__builtin_expect(!!(vaddr >= ((-2UL << 20)-((1UL) << 12)) || vaddr < (((-2UL << 20)-((1UL) << 12)) - (__end_of_permanent_fixed_addresses << 12))), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/fixmap.h"), "i" (219), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return ((((-2UL << 20)-((1UL) << 12)) - ((vaddr)&(~(((1UL) << 12)-1)))) >> 12); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) unsigned long __set_fixmap_offset(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) { __set_fixmap(idx, phys, flags); return fix_to_virt(idx) + (phys & (((1UL) << 12) - 1)); } static inline __attribute__((no_instrument_function)) void generic_apic_probe(void) { } extern unsigned int apic_verbosity; extern int local_apic_timer_c2_ok; extern int disable_apic; extern unsigned int lapic_timer_frequency; extern void __inquire_remote_apic(int apicid); static inline __attribute__((no_instrument_function)) void default_inquire_remote_apic(int apicid) { if (apic_verbosity >= 2) __inquire_remote_apic(apicid); } static inline __attribute__((no_instrument_function)) bool apic_from_smp_config(void) { return smp_found_config && !disable_apic; } extern int is_vsmp_box(void); extern void xapic_wait_icr_idle(void); extern u32 safe_xapic_wait_icr_idle(void); extern void xapic_icr_write(u32, u32); extern int setup_profiling_timer(unsigned int); static inline __attribute__((no_instrument_function)) void native_apic_mem_write(u32 reg, u32 v) { volatile u32 *addr = (volatile u32 *)((fix_to_virt(FIX_APIC_BASE)) + reg); asm volatile ("661:\n\t" "movl %0, %1" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(3*32+19)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "xchgl %0, %1" "\n664:\n" ".previous" : "=r" (v), "=m" (*addr) : "i" (0), "0" (v), "m" (*addr)) ; } static inline __attribute__((no_instrument_function)) u32 native_apic_mem_read(u32 reg) { return *((volatile u32 *)((fix_to_virt(FIX_APIC_BASE)) + reg)); } extern void native_apic_wait_icr_idle(void); extern u32 native_safe_apic_wait_icr_idle(void); extern void native_apic_icr_write(u32 low, u32 id); extern u64 native_apic_icr_read(void); extern int x2apic_mode; static inline __attribute__((no_instrument_function)) void x2apic_wrmsr_fence(void) { asm volatile("mfence" : : : "memory"); } static inline __attribute__((no_instrument_function)) void native_apic_msr_write(u32 reg, u32 v) { if (reg == 0xE0 || reg == 0x20 || reg == 0xD0 || reg == 0x30) return; do { paravirt_write_msr(0x800 + (reg >> 4), v, 0); } while (0); } static inline __attribute__((no_instrument_function)) u32 native_apic_msr_read(u32 reg) { u64 msr; if (reg == 0xE0) return -1; do { int _err; msr = paravirt_read_msr(0x800 + (reg >> 4), &_err); } while (0); return (u32)msr; } static inline __attribute__((no_instrument_function)) void native_x2apic_wait_icr_idle(void) { return; } static inline __attribute__((no_instrument_function)) u32 native_safe_x2apic_wait_icr_idle(void) { return 0; } static inline __attribute__((no_instrument_function)) void native_x2apic_icr_write(u32 low, u32 id) { do { paravirt_write_msr(0x800 + (0x300 >> 4), (u32)((u64)(((__u64) id) << 32 | low)), ((u64)(((__u64) id) << 32 | low))>>32); } while (0); } static inline __attribute__((no_instrument_function)) u64 native_x2apic_icr_read(void) { unsigned long val; do { int _err; val = paravirt_read_msr(0x800 + (0x300 >> 4), &_err); } while (0); return val; } extern int x2apic_phys; extern int x2apic_preenabled; extern void check_x2apic(void); extern void enable_x2apic(void); extern void x2apic_icr_write(u32 low, u32 id); static inline __attribute__((no_instrument_function)) int x2apic_enabled(void) { u64 msr; if (!(__builtin_constant_p((4*32+21)) && ( ((((4*32+21))>>5)==0 && (1UL<<(((4*32+21))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((4*32+21))>>5)==1 && (1UL<<(((4*32+21))&31) & ((1<<((1*32+29) & 31))|0))) || ((((4*32+21))>>5)==2 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==3 && (1UL<<(((4*32+21))&31) & ((1<<((3*32+20) & 31))))) || ((((4*32+21))>>5)==4 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==5 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==6 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==7 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==8 && (1UL<<(((4*32+21))&31) & 0)) || ((((4*32+21))>>5)==9 && (1UL<<(((4*32+21))&31) & 0)) ) ? 1 : (__builtin_constant_p(((4*32+21))) ? constant_test_bit(((4*32+21)), ((unsigned long *)((&boot_cpu_data)->x86_capability))) : variable_test_bit(((4*32+21)), ((unsigned long *)((&boot_cpu_data)->x86_capability)))))) return 0; do { int _err; msr = paravirt_read_msr(0x0000001b, &_err); } while (0); if (msr & (1UL << 10)) return 1; return 0; } static inline __attribute__((no_instrument_function)) void x2apic_force_phys(void) { x2apic_phys = 1; } extern void enable_IR_x2apic(void); extern int get_physical_broadcast(void); extern int lapic_get_maxlvt(void); extern void clear_local_APIC(void); extern void connect_bsp_APIC(void); extern void disconnect_bsp_APIC(int virt_wire_setup); extern void disable_local_APIC(void); extern void lapic_shutdown(void); extern int verify_local_APIC(void); extern void sync_Arb_IDs(void); extern void init_bsp_APIC(void); extern void setup_local_APIC(void); extern void end_local_APIC_setup(void); extern void bsp_end_local_APIC_setup(void); extern void init_apic_mappings(void); void register_lapic_address(unsigned long address); extern void setup_boot_APIC_clock(void); extern void setup_secondary_APIC_clock(void); extern int APIC_init_uniprocessor(void); extern int apic_force_enable(unsigned long addr); extern int apic_is_clustered_box(void); extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask); struct apic { char *name; int (*probe)(void); int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); int (*apic_id_valid)(int apicid); int (*apic_id_registered)(void); u32 irq_delivery_mode; u32 irq_dest_mode; const struct cpumask *(*target_cpus)(void); int disable_esr; int dest_logical; unsigned long (*check_apicid_used)(physid_mask_t *map, int apicid); unsigned long (*check_apicid_present)(int apicid); void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); void (*init_apic_ldr)(void); void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap); void (*setup_apic_routing)(void); int (*multi_timer_check)(int apic, int irq); int (*cpu_present_to_apicid)(int mps_cpu); void (*apicid_to_cpu_present)(int phys_apicid, physid_mask_t *retmap); void (*setup_portio_remap)(void); int (*check_phys_apicid_present)(int phys_apicid); void (*enable_apic_mode)(void); int (*phys_pkg_id)(int cpuid_apic, int index_msb); int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid); unsigned int (*get_apic_id)(unsigned long x); unsigned long (*set_apic_id)(unsigned int id); unsigned long apic_id_mask; unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, const struct cpumask *andmask); void (*send_IPI_mask)(const struct cpumask *mask, int vector); void (*send_IPI_mask_allbutself)(const struct cpumask *mask, int vector); void (*send_IPI_allbutself)(int vector); void (*send_IPI_all)(int vector); void (*send_IPI_self)(int vector); int (*wakeup_secondary_cpu)(int apicid, unsigned long start_eip); int trampoline_phys_low; int trampoline_phys_high; void (*wait_for_init_deassert)(atomic_t *deassert); void (*smp_callin_clear_local_apic)(void); void (*inquire_remote_apic)(int apicid); u32 (*read)(u32 reg); void (*write)(u32 reg, u32 v); u64 (*icr_read)(void); void (*icr_write)(u32 low, u32 high); void (*wait_icr_idle)(void); u32 (*safe_wait_icr_idle)(void); }; extern struct apic *apic; extern struct apic *__apicdrivers[], *__apicdrivers_end[]; extern atomic_t init_deasserted; extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip); static inline __attribute__((no_instrument_function)) u32 apic_read(u32 reg) { return apic->read(reg); } static inline __attribute__((no_instrument_function)) void apic_write(u32 reg, u32 val) { apic->write(reg, val); } static inline __attribute__((no_instrument_function)) u64 apic_icr_read(void) { return apic->icr_read(); } static inline __attribute__((no_instrument_function)) void apic_icr_write(u32 low, u32 high) { apic->icr_write(low, high); } static inline __attribute__((no_instrument_function)) void apic_wait_icr_idle(void) { apic->wait_icr_idle(); } static inline __attribute__((no_instrument_function)) u32 safe_apic_wait_icr_idle(void) { return apic->safe_wait_icr_idle(); } static inline __attribute__((no_instrument_function)) void ack_APIC_irq(void) { apic_write(0xB0, 0); } static inline __attribute__((no_instrument_function)) unsigned default_get_apic_id(unsigned long x) { unsigned int ver = ((apic_read(0x30)) & 0xFFu); if (((ver) >= 0x14) || (__builtin_constant_p((3*32+26)) && ( ((((3*32+26))>>5)==0 && (1UL<<(((3*32+26))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((3*32+26))>>5)==1 && (1UL<<(((3*32+26))&31) & ((1<<((1*32+29) & 31))|0))) || ((((3*32+26))>>5)==2 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==3 && (1UL<<(((3*32+26))&31) & ((1<<((3*32+20) & 31))))) || ((((3*32+26))>>5)==4 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==5 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==6 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==7 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==8 && (1UL<<(((3*32+26))&31) & 0)) || ((((3*32+26))>>5)==9 && (1UL<<(((3*32+26))&31) & 0)) ) ? 1 : (__builtin_constant_p(((3*32+26))) ? constant_test_bit(((3*32+26)), ((unsigned long *)((&boot_cpu_data)->x86_capability))) : variable_test_bit(((3*32+26)), ((unsigned long *)((&boot_cpu_data)->x86_capability)))))) return (x >> 24) & 0xFF; else return (x >> 24) & 0x0F; } extern int default_acpi_madt_oem_check(char *, char *); extern void apic_send_IPI_self(int vector); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_x2apic_extra_bits; extern __attribute__((section(".data..percpu" ""))) __typeof__(int) x2apic_extra_bits; extern int default_cpu_present_to_apicid(int mps_cpu); extern int default_check_phys_apicid_present(int phys_apicid); static inline __attribute__((no_instrument_function)) void default_wait_for_init_deassert(atomic_t *deassert) { while (!atomic_read(deassert)) cpu_relax(); return; } extern void generic_bigsmp_probe(void); static inline __attribute__((no_instrument_function)) const struct cpumask *default_target_cpus(void) { return cpu_online_mask; } extern __attribute__((section(".discard"), unused)) char __pcpu_scope_x86_bios_cpu_apicid; extern __attribute__((section(".data..percpu" ""))) __typeof__(u16) x86_bios_cpu_apicid; extern __typeof__(u16) *x86_bios_cpu_apicid_early_ptr; extern __typeof__(u16) x86_bios_cpu_apicid_early_map[]; static inline __attribute__((no_instrument_function)) unsigned int read_apic_id(void) { unsigned int reg; reg = apic_read(0x20); return apic->get_apic_id(reg); } static inline __attribute__((no_instrument_function)) int default_apic_id_valid(int apicid) { return (apicid < 255); } extern void default_setup_apic_routing(void); extern struct apic apic_noop; static inline __attribute__((no_instrument_function)) unsigned int default_cpu_mask_to_apicid(const struct cpumask *cpumask) { return ((cpumask)->bits)[0] & 0xFFu; } static inline __attribute__((no_instrument_function)) unsigned int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, const struct cpumask *andmask) { unsigned long mask1 = ((cpumask)->bits)[0]; unsigned long mask2 = ((andmask)->bits)[0]; unsigned long mask3 = ((cpu_online_mask)->bits)[0]; return (unsigned int)(mask1 & mask2 & mask3); } static inline __attribute__((no_instrument_function)) unsigned long default_check_apicid_used(physid_mask_t *map, int apicid) { return (__builtin_constant_p((apicid)) ? constant_test_bit((apicid), ((*map).mask)) : variable_test_bit((apicid), ((*map).mask))); } static inline __attribute__((no_instrument_function)) unsigned long default_check_apicid_present(int bit) { return (__builtin_constant_p((bit)) ? constant_test_bit((bit), ((phys_cpu_present_map).mask)) : variable_test_bit((bit), ((phys_cpu_present_map).mask))); } static inline __attribute__((no_instrument_function)) void default_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap) { *retmap = *phys_map; } static inline __attribute__((no_instrument_function)) int __default_cpu_present_to_apicid(int mps_cpu) { if (mps_cpu < nr_cpu_ids && (__builtin_constant_p((cpumask_check((mps_cpu)))) ? constant_test_bit((cpumask_check((mps_cpu))), ((((cpu_present_mask))->bits))) : variable_test_bit((cpumask_check((mps_cpu))), ((((cpu_present_mask))->bits))))) return (int)(*({ do { const void *__vpp_verify = (typeof((&(x86_bios_cpu_apicid))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(x86_bios_cpu_apicid))) *)(&(x86_bios_cpu_apicid)))); (typeof((typeof(*(&(x86_bios_cpu_apicid))) *)(&(x86_bios_cpu_apicid)))) (__ptr + (((__per_cpu_offset[mps_cpu])))); }); })); else return 0xFFFFu; } static inline __attribute__((no_instrument_function)) int __default_check_phys_apicid_present(int phys_apicid) { return (__builtin_constant_p((phys_apicid)) ? constant_test_bit((phys_apicid), ((phys_cpu_present_map).mask)) : variable_test_bit((phys_apicid), ((phys_cpu_present_map).mask))); } extern int default_cpu_present_to_apicid(int mps_cpu); extern int default_check_phys_apicid_present(int phys_apicid); static inline __attribute__((no_instrument_function)) int invalid_vm86_irq(int irq) { return irq < 3 || irq > 15; } struct io_apic_ops { void (*init) (void); unsigned int (*read) (unsigned int apic, unsigned int reg); void (*write) (unsigned int apic, unsigned int reg, unsigned int value); void (*modify)(unsigned int apic, unsigned int reg, unsigned int value); }; void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) set_io_apic_ops(const struct io_apic_ops *); union IO_APIC_reg_00 { u32 raw; struct { u32 __reserved_2 : 14, LTS : 1, delivery_type : 1, __reserved_1 : 8, ID : 8; } __attribute__ ((packed)) bits; }; union IO_APIC_reg_01 { u32 raw; struct { u32 version : 8, __reserved_2 : 7, PRQ : 1, entries : 8, __reserved_1 : 8; } __attribute__ ((packed)) bits; }; union IO_APIC_reg_02 { u32 raw; struct { u32 __reserved_2 : 24, arbitration : 4, __reserved_1 : 4; } __attribute__ ((packed)) bits; }; union IO_APIC_reg_03 { u32 raw; struct { u32 boot_DT : 1, __reserved_1 : 31; } __attribute__ ((packed)) bits; }; struct IO_APIC_route_entry { __u32 vector : 8, delivery_mode : 3, dest_mode : 1, delivery_status : 1, polarity : 1, irr : 1, trigger : 1, mask : 1, __reserved_2 : 15; __u32 __reserved_3 : 24, dest : 8; } __attribute__ ((packed)); struct IR_IO_APIC_route_entry { __u64 vector : 8, zero : 3, index2 : 1, delivery_status : 1, polarity : 1, irr : 1, trigger : 1, mask : 1, reserved : 31, format : 1, index : 15; } __attribute__ ((packed)); extern int nr_ioapics; extern int mpc_ioapic_id(int ioapic); extern unsigned int mpc_ioapic_addr(int ioapic); extern struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic); extern int mp_irq_entries; extern struct mpc_intsrc mp_irqs[(256 * 4)]; extern int mpc_default_type; extern int sis_apic_bug; extern int skip_ioapic_setup; extern int noioapicquirk; extern int noioapicreroute; extern int timer_through_8259; struct io_apic_irq_attr; extern int io_apic_set_pci_routing(struct device *dev, int irq, struct io_apic_irq_attr *irq_attr); void setup_IO_APIC_irq_extra(u32 gsi); extern void ioapic_and_gsi_init(void); extern void ioapic_insert_resources(void); int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr); extern int save_ioapic_entries(void); extern void mask_ioapic_entries(void); extern int restore_ioapic_entries(void); extern int get_nr_irqs_gsi(void); extern void setup_ioapic_ids_from_mpc(void); extern void setup_ioapic_ids_from_mpc_nocheck(void); struct mp_ioapic_gsi{ u32 gsi_base; u32 gsi_end; }; extern struct mp_ioapic_gsi mp_gsi_routing[]; extern u32 gsi_top; int mp_find_ioapic(u32 gsi); int mp_find_ioapic_pin(int ioapic, u32 gsi); void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) mp_register_ioapic(int id, u32 address, u32 gsi_base); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pre_init_apic_IRQ0(void); extern void mp_save_irq(struct mpc_intsrc *m); extern void disable_ioapic_support(void); extern int smp_num_siblings; extern unsigned int num_processors; static inline __attribute__((no_instrument_function)) bool cpu_has_ht_siblings(void) { bool has_siblings = false; has_siblings = (__builtin_constant_p((0*32+28)) && ( ((((0*32+28))>>5)==0 && (1UL<<(((0*32+28))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((0*32+28))>>5)==1 && (1UL<<(((0*32+28))&31) & ((1<<((1*32+29) & 31))|0))) || ((((0*32+28))>>5)==2 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==3 && (1UL<<(((0*32+28))&31) & ((1<<((3*32+20) & 31))))) || ((((0*32+28))>>5)==4 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==5 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==6 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==7 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==8 && (1UL<<(((0*32+28))&31) & 0)) || ((((0*32+28))>>5)==9 && (1UL<<(((0*32+28))&31) & 0)) ) ? 1 : (__builtin_constant_p(((0*32+28))) ? constant_test_bit(((0*32+28)), ((unsigned long *)((&boot_cpu_data)->x86_capability))) : variable_test_bit(((0*32+28)), ((unsigned long *)((&boot_cpu_data)->x86_capability))))) && smp_num_siblings > 1; return has_siblings; } extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_sibling_map; extern __attribute__((section(".data..percpu" ""))) __typeof__(cpumask_var_t) cpu_sibling_map; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_core_map; extern __attribute__((section(".data..percpu" ""))) __typeof__(cpumask_var_t) cpu_core_map; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_llc_shared_map; extern __attribute__((section(".data..percpu" ""))) __typeof__(cpumask_var_t) cpu_llc_shared_map; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_llc_id; extern __attribute__((section(".data..percpu" ""))) __typeof__(u16) cpu_llc_id; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_cpu_number; extern __attribute__((section(".data..percpu" ""))) __typeof__(int) cpu_number; static inline __attribute__((no_instrument_function)) struct cpumask *cpu_sibling_mask(int cpu) { return (*({ do { const void *__vpp_verify = (typeof((&(cpu_sibling_map))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(cpu_sibling_map))) *)(&(cpu_sibling_map)))); (typeof((typeof(*(&(cpu_sibling_map))) *)(&(cpu_sibling_map)))) (__ptr + (((__per_cpu_offset[cpu])))); }); })); } static inline __attribute__((no_instrument_function)) struct cpumask *cpu_core_mask(int cpu) { return (*({ do { const void *__vpp_verify = (typeof((&(cpu_core_map))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(cpu_core_map))) *)(&(cpu_core_map)))); (typeof((typeof(*(&(cpu_core_map))) *)(&(cpu_core_map)))) (__ptr + (((__per_cpu_offset[cpu])))); }); })); } static inline __attribute__((no_instrument_function)) struct cpumask *cpu_llc_shared_mask(int cpu) { return (*({ do { const void *__vpp_verify = (typeof((&(cpu_llc_shared_map))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(cpu_llc_shared_map))) *)(&(cpu_llc_shared_map)))); (typeof((typeof(*(&(cpu_llc_shared_map))) *)(&(cpu_llc_shared_map)))) (__ptr + (((__per_cpu_offset[cpu])))); }); })); } extern __attribute__((section(".discard"), unused)) char __pcpu_scope_x86_cpu_to_apicid; extern __attribute__((section(".data..percpu" ""))) __typeof__(u16) x86_cpu_to_apicid; extern __typeof__(u16) *x86_cpu_to_apicid_early_ptr; extern __typeof__(u16) x86_cpu_to_apicid_early_map[]; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_x86_bios_cpu_apicid; extern __attribute__((section(".data..percpu" ""))) __typeof__(u16) x86_bios_cpu_apicid; extern __typeof__(u16) *x86_bios_cpu_apicid_early_ptr; extern __typeof__(u16) x86_bios_cpu_apicid_early_map[]; extern unsigned long stack_start; struct smp_ops { void (*smp_prepare_boot_cpu)(void); void (*smp_prepare_cpus)(unsigned max_cpus); void (*smp_cpus_done)(unsigned max_cpus); void (*stop_other_cpus)(int wait); void (*smp_send_reschedule)(int cpu); int (*cpu_up)(unsigned cpu); int (*cpu_disable)(void); void (*cpu_die)(unsigned int cpu); void (*play_dead)(void); void (*send_call_func_ipi)(const struct cpumask *mask); void (*send_call_func_single_ipi)(int cpu); }; extern void set_cpu_sibling_map(int cpu); extern struct smp_ops smp_ops; static inline __attribute__((no_instrument_function)) void smp_send_stop(void) { smp_ops.stop_other_cpus(0); } static inline __attribute__((no_instrument_function)) void stop_other_cpus(void) { smp_ops.stop_other_cpus(1); } static inline __attribute__((no_instrument_function)) void smp_prepare_boot_cpu(void) { smp_ops.smp_prepare_boot_cpu(); } static inline __attribute__((no_instrument_function)) void smp_prepare_cpus(unsigned int max_cpus) { smp_ops.smp_prepare_cpus(max_cpus); } static inline __attribute__((no_instrument_function)) void smp_cpus_done(unsigned int max_cpus) { smp_ops.smp_cpus_done(max_cpus); } static inline __attribute__((no_instrument_function)) int __cpu_up(unsigned int cpu) { return smp_ops.cpu_up(cpu); } static inline __attribute__((no_instrument_function)) int __cpu_disable(void) { return smp_ops.cpu_disable(); } static inline __attribute__((no_instrument_function)) void __cpu_die(unsigned int cpu) { smp_ops.cpu_die(cpu); } static inline __attribute__((no_instrument_function)) void play_dead(void) { smp_ops.play_dead(); } static inline __attribute__((no_instrument_function)) void smp_send_reschedule(int cpu) { smp_ops.smp_send_reschedule(cpu); } static inline __attribute__((no_instrument_function)) void arch_send_call_function_single_ipi(int cpu) { smp_ops.send_call_func_single_ipi(cpu); } static inline __attribute__((no_instrument_function)) void arch_send_call_function_ipi_mask(const struct cpumask *mask) { smp_ops.send_call_func_ipi(mask); } void cpu_disable_common(void); void native_smp_prepare_boot_cpu(void); void native_smp_prepare_cpus(unsigned int max_cpus); void native_smp_cpus_done(unsigned int max_cpus); int native_cpu_up(unsigned int cpunum); int native_cpu_disable(void); void native_cpu_die(unsigned int cpu); void native_play_dead(void); void play_dead_common(void); void wbinvd_on_cpu(int cpu); int wbinvd_on_all_cpus(void); void native_send_call_func_ipi(const struct cpumask *mask); void native_send_call_func_single_ipi(int cpu); void smp_store_cpu_info(int id); static inline __attribute__((no_instrument_function)) int num_booting_cpus(void) { return cpumask_weight(cpu_callout_mask); } extern unsigned disabled_cpus __attribute__ ((__section__(".cpuinit.data"))); extern int hard_smp_processor_id(void); extern void nmi_selftest(void); extern void smp_send_stop(void); extern void smp_send_reschedule(int cpu); extern void smp_prepare_cpus(unsigned int max_cpus); extern int __cpu_up(unsigned int cpunum); extern void smp_cpus_done(unsigned int max_cpus); int smp_call_function(smp_call_func_t func, void *info, int wait); void smp_call_function_many(const struct cpumask *mask, smp_call_func_t func, void *info, bool wait); void __smp_call_function_single(int cpuid, struct call_single_data *data, int wait); int smp_call_function_any(const struct cpumask *mask, smp_call_func_t func, void *info, int wait); void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) call_function_init(void); void generic_smp_call_function_single_interrupt(void); void generic_smp_call_function_interrupt(void); void ipi_call_lock(void); void ipi_call_unlock(void); void ipi_call_lock_irq(void); void ipi_call_unlock_irq(void); int on_each_cpu(smp_call_func_t func, void *info, int wait); void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, void *info, bool wait); void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), smp_call_func_t func, void *info, bool wait, gfp_t gfp_flags); void smp_prepare_boot_cpu(void); extern unsigned int setup_max_cpus; extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) setup_nr_cpu_ids(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) smp_init(void); extern void arch_disable_smp_support(void); void smp_setup_processor_id(void); enum pageblock_bits { PB_migrate, PB_migrate_end = PB_migrate + 3 - 1, NR_PAGEBLOCK_BITS }; struct page; unsigned long get_pageblock_flags_group(struct page *page, int start_bitidx, int end_bitidx); void set_pageblock_flags_group(struct page *page, unsigned long flags, int start_bitidx, int end_bitidx); extern int page_group_by_mobility_disabled; static inline __attribute__((no_instrument_function)) int get_pageblock_migratetype(struct page *page) { return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); } struct free_area { struct list_head free_list[5]; unsigned long nr_free; }; struct pglist_data; struct zone_padding { char x[0]; } __attribute__((__aligned__(1 << (12)))); enum zone_stat_item { NR_FREE_PAGES, NR_LRU_BASE, NR_INACTIVE_ANON = NR_LRU_BASE, NR_ACTIVE_ANON, NR_INACTIVE_FILE, NR_ACTIVE_FILE, NR_UNEVICTABLE, NR_MLOCK, NR_ANON_PAGES, NR_FILE_MAPPED, NR_FILE_PAGES, NR_FILE_DIRTY, NR_WRITEBACK, NR_SLAB_RECLAIMABLE, NR_SLAB_UNRECLAIMABLE, NR_PAGETABLE, NR_KERNEL_STACK, NR_UNSTABLE_NFS, NR_BOUNCE, NR_VMSCAN_WRITE, NR_VMSCAN_IMMEDIATE, NR_WRITEBACK_TEMP, NR_ISOLATED_ANON, NR_ISOLATED_FILE, NR_SHMEM, NR_DIRTIED, NR_WRITTEN, NUMA_HIT, NUMA_MISS, NUMA_FOREIGN, NUMA_INTERLEAVE_HIT, NUMA_LOCAL, NUMA_OTHER, NR_ANON_TRANSPARENT_HUGEPAGES, NR_VM_ZONE_STAT_ITEMS }; enum lru_list { LRU_INACTIVE_ANON = 0, LRU_ACTIVE_ANON = 0 + 1, LRU_INACTIVE_FILE = 0 + 2, LRU_ACTIVE_FILE = 0 + 2 + 1, LRU_UNEVICTABLE, NR_LRU_LISTS }; static inline __attribute__((no_instrument_function)) int is_file_lru(enum lru_list lru) { return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE); } static inline __attribute__((no_instrument_function)) int is_active_lru(enum lru_list lru) { return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); } static inline __attribute__((no_instrument_function)) int is_unevictable_lru(enum lru_list lru) { return (lru == LRU_UNEVICTABLE); } struct lruvec { struct list_head lists[NR_LRU_LISTS]; }; typedef unsigned isolate_mode_t; enum zone_watermarks { WMARK_MIN, WMARK_LOW, WMARK_HIGH, NR_WMARK }; struct per_cpu_pages { int count; int high; int batch; struct list_head lists[3]; }; struct per_cpu_pageset { struct per_cpu_pages pcp; s8 expire; s8 stat_threshold; s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; }; enum zone_type { ZONE_DMA, ZONE_DMA32, ZONE_NORMAL, ZONE_MOVABLE, __MAX_NR_ZONES }; struct zone_reclaim_stat { unsigned long recent_rotated[2]; unsigned long recent_scanned[2]; }; struct zone { unsigned long watermark[NR_WMARK]; unsigned long percpu_drift_mark; unsigned long lowmem_reserve[4]; unsigned long dirty_balance_reserve; int node; unsigned long min_unmapped_pages; unsigned long min_slab_pages; struct per_cpu_pageset *pageset; spinlock_t lock; int all_unreclaimable; seqlock_t span_seqlock; struct free_area free_area[11]; unsigned int compact_considered; unsigned int compact_defer_shift; int compact_order_failed; struct zone_padding _pad1_; spinlock_t lru_lock; struct lruvec lruvec; struct zone_reclaim_stat reclaim_stat; unsigned long pages_scanned; unsigned long flags; atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; unsigned int inactive_ratio; struct zone_padding _pad2_; wait_queue_head_t * wait_table; unsigned long wait_table_hash_nr_entries; unsigned long wait_table_bits; struct pglist_data *zone_pgdat; unsigned long zone_start_pfn; unsigned long spanned_pages; unsigned long present_pages; const char *name; } __attribute__((__aligned__(1 << (12)))); typedef enum { ZONE_RECLAIM_LOCKED, ZONE_OOM_LOCKED, ZONE_CONGESTED, } zone_flags_t; static inline __attribute__((no_instrument_function)) void zone_set_flag(struct zone *zone, zone_flags_t flag) { set_bit(flag, &zone->flags); } static inline __attribute__((no_instrument_function)) int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag) { return test_and_set_bit(flag, &zone->flags); } static inline __attribute__((no_instrument_function)) void zone_clear_flag(struct zone *zone, zone_flags_t flag) { clear_bit(flag, &zone->flags); } static inline __attribute__((no_instrument_function)) int zone_is_reclaim_congested(const struct zone *zone) { return (__builtin_constant_p((ZONE_CONGESTED)) ? constant_test_bit((ZONE_CONGESTED), (&zone->flags)) : variable_test_bit((ZONE_CONGESTED), (&zone->flags))); } static inline __attribute__((no_instrument_function)) int zone_is_reclaim_locked(const struct zone *zone) { return (__builtin_constant_p((ZONE_RECLAIM_LOCKED)) ? constant_test_bit((ZONE_RECLAIM_LOCKED), (&zone->flags)) : variable_test_bit((ZONE_RECLAIM_LOCKED), (&zone->flags))); } static inline __attribute__((no_instrument_function)) int zone_is_oom_locked(const struct zone *zone) { return (__builtin_constant_p((ZONE_OOM_LOCKED)) ? constant_test_bit((ZONE_OOM_LOCKED), (&zone->flags)) : variable_test_bit((ZONE_OOM_LOCKED), (&zone->flags))); } struct zonelist_cache { unsigned short z_to_n[((1 << 10) * 4)]; unsigned long fullzones[(((((1 << 10) * 4)) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; unsigned long last_full_zap; }; struct zoneref { struct zone *zone; int zone_idx; }; struct zonelist { struct zonelist_cache *zlcache_ptr; struct zoneref _zonerefs[((1 << 10) * 4) + 1]; struct zonelist_cache zlcache; }; struct node_active_region { unsigned long start_pfn; unsigned long end_pfn; int nid; }; extern struct page *mem_map; struct bootmem_data; typedef struct pglist_data { struct zone node_zones[4]; struct zonelist node_zonelists[2]; int nr_zones; spinlock_t node_size_lock; unsigned long node_start_pfn; unsigned long node_present_pages; unsigned long node_spanned_pages; int node_id; wait_queue_head_t kswapd_wait; struct task_struct *kswapd; int kswapd_max_order; enum zone_type classzone_idx; } pg_data_t; struct rw_semaphore; struct rw_semaphore { long count; raw_spinlock_t wait_lock; struct list_head wait_list; }; extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); static inline __attribute__((no_instrument_function)) void __down_read(struct rw_semaphore *sem) { asm volatile("# beginning down_read\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "incq" " " "(%1)\n\t" " jns 1f\n" " call call_rwsem_down_read_failed\n" "1:\n\t" "# ending down_read\n\t" : "+m" (sem->count) : "a" (sem) : "memory", "cc"); } static inline __attribute__((no_instrument_function)) int __down_read_trylock(struct rw_semaphore *sem) { long result, tmp; asm volatile("# beginning __down_read_trylock\n\t" " mov %0,%1\n\t" "1:\n\t" " mov %1,%2\n\t" " add %3,%2\n\t" " jle 2f\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " cmpxchg %2,%0\n\t" " jnz 1b\n\t" "2:\n\t" "# ending __down_read_trylock\n\t" : "+m" (sem->count), "=&a" (result), "=&r" (tmp) : "i" (0x00000001L) : "memory", "cc"); return result >= 0 ? 1 : 0; } static inline __attribute__((no_instrument_function)) void __down_write_nested(struct rw_semaphore *sem, int subclass) { long tmp; asm volatile("# beginning down_write\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " xadd %1,(%2)\n\t" " test %1,%1\n\t" " jz 1f\n" " call call_rwsem_down_write_failed\n" "1:\n" "# ending down_write" : "+m" (sem->count), "=d" (tmp) : "a" (sem), "1" (((-0xffffffffL -1) + 0x00000001L)) : "memory", "cc"); } static inline __attribute__((no_instrument_function)) void __down_write(struct rw_semaphore *sem) { __down_write_nested(sem, 0); } static inline __attribute__((no_instrument_function)) int __down_write_trylock(struct rw_semaphore *sem) { long ret = ({ __typeof__(*((&sem->count))) __ret; __typeof__(*((&sem->count))) __old = ((0x00000000L)); __typeof__(*((&sem->count))) __new = ((((-0xffffffffL -1) + 0x00000001L))); switch ((sizeof(*(&sem->count)))) { case 1: { volatile u8 *__ptr = (volatile u8 *)((&sem->count)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgb %2,%1" : "=a" (__ret), "+m" (*__ptr) : "q" (__new), "0" (__old) : "memory"); break; } case 2: { volatile u16 *__ptr = (volatile u16 *)((&sem->count)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgw %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 4: { volatile u32 *__ptr = (volatile u32 *)((&sem->count)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgl %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 8: { volatile u64 *__ptr = (volatile u64 *)((&sem->count)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgq %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } default: __cmpxchg_wrong_size(); } __ret; }) ; if (ret == 0x00000000L) return 1; return 0; } static inline __attribute__((no_instrument_function)) void __up_read(struct rw_semaphore *sem) { long tmp; asm volatile("# beginning __up_read\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " xadd %1,(%2)\n\t" " jns 1f\n\t" " call call_rwsem_wake\n" "1:\n" "# ending __up_read\n" : "+m" (sem->count), "=d" (tmp) : "a" (sem), "1" (-0x00000001L) : "memory", "cc"); } static inline __attribute__((no_instrument_function)) void __up_write(struct rw_semaphore *sem) { long tmp; asm volatile("# beginning __up_write\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " xadd %1,(%2)\n\t" " jns 1f\n\t" " call call_rwsem_wake\n" "1:\n\t" "# ending __up_write\n" : "+m" (sem->count), "=d" (tmp) : "a" (sem), "1" (-((-0xffffffffL -1) + 0x00000001L)) : "memory", "cc"); } static inline __attribute__((no_instrument_function)) void __downgrade_write(struct rw_semaphore *sem) { asm volatile("# beginning __downgrade_write\n\t" ".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "addq" " " "%2,(%1)\n\t" " jns 1f\n\t" " call call_rwsem_downgrade_wake\n" "1:\n\t" "# ending __downgrade_write\n" : "+m" (sem->count) : "a" (sem), "er" (-(-0xffffffffL -1)) : "memory", "cc"); } static inline __attribute__((no_instrument_function)) void rwsem_atomic_add(long delta, struct rw_semaphore *sem) { asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " " " "addq" " " "%1,%0" : "+m" (sem->count) : "er" (delta)); } static inline __attribute__((no_instrument_function)) long rwsem_atomic_update(long delta, struct rw_semaphore *sem) { return delta + ({ __typeof__ (*(((&sem->count)))) __ret = (((delta))); switch (sizeof(*(((&sem->count))))) { case 1: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "b %b0, %1\n" : "+q" (__ret), "+m" (*(((&sem->count)))) : : "memory", "cc"); break; case 2: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "w %w0, %1\n" : "+r" (__ret), "+m" (*(((&sem->count)))) : : "memory", "cc"); break; case 4: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "l %0, %1\n" : "+r" (__ret), "+m" (*(((&sem->count)))) : : "memory", "cc"); break; case 8: asm volatile (".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "xadd" "q %q0, %1\n" : "+r" (__ret), "+m" (*(((&sem->count)))) : : "memory", "cc"); break; default: __xadd_wrong_size(); } __ret; }); } static inline __attribute__((no_instrument_function)) int rwsem_is_locked(struct rw_semaphore *sem) { return sem->count != 0; } extern void __init_rwsem(struct rw_semaphore *sem, const char *name, struct lock_class_key *key); extern void down_read(struct rw_semaphore *sem); extern int down_read_trylock(struct rw_semaphore *sem); extern void down_write(struct rw_semaphore *sem); extern int down_write_trylock(struct rw_semaphore *sem); extern void up_read(struct rw_semaphore *sem); extern void up_write(struct rw_semaphore *sem); extern void downgrade_write(struct rw_semaphore *sem); extern void rcutorture_record_test_transition(void); extern void rcutorture_record_progress(unsigned long vernum); extern void do_trace_rcu_torture_read(char *rcutorturename, struct rcu_head *rhp); extern void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *head)); extern void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); extern void synchronize_sched(void); static inline __attribute__((no_instrument_function)) void __rcu_read_lock(void) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); } static inline __attribute__((no_instrument_function)) void __rcu_read_unlock(void) { do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void synchronize_rcu(void) { synchronize_sched(); } static inline __attribute__((no_instrument_function)) int rcu_preempt_depth(void) { return 0; } extern void rcu_sched_qs(int cpu); extern void rcu_bh_qs(int cpu); extern void rcu_check_callbacks(int cpu, int user); struct notifier_block; extern void rcu_idle_enter(void); extern void rcu_idle_exit(void); extern void rcu_irq_enter(void); extern void rcu_irq_exit(void); typedef void call_rcu_func_t(struct rcu_head *head, void (*func)(struct rcu_head *head)); void wait_rcu_gp(call_rcu_func_t crf); extern void rcu_init(void); extern void rcu_note_context_switch(int cpu); extern int rcu_needs_cpu(int cpu); extern void rcu_cpu_stall_reset(void); static inline __attribute__((no_instrument_function)) void rcu_virt_note_context_switch(int cpu) { rcu_note_context_switch(cpu); } static inline __attribute__((no_instrument_function)) void exit_rcu(void) { } extern void synchronize_rcu_bh(void); extern void synchronize_sched_expedited(void); extern void synchronize_rcu_expedited(void); void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); static inline __attribute__((no_instrument_function)) void synchronize_rcu_bh_expedited(void) { synchronize_sched_expedited(); } extern void rcu_barrier(void); extern void rcu_barrier_bh(void); extern void rcu_barrier_sched(void); extern unsigned long rcutorture_testseq; extern unsigned long rcutorture_vernum; extern long rcu_batches_completed(void); extern long rcu_batches_completed_bh(void); extern long rcu_batches_completed_sched(void); extern void rcu_force_quiescent_state(void); extern void rcu_bh_force_quiescent_state(void); extern void rcu_sched_force_quiescent_state(void); static inline __attribute__((no_instrument_function)) int rcu_blocking_is_gp(void) { do { __might_sleep("include/linux/rcutree.h", 104, 0); do { } while (0); } while (0); return cpumask_weight(cpu_online_mask) == 1; } extern void rcu_scheduler_starting(void); extern int rcu_scheduler_active __attribute__((__section__(".data..read_mostly"))); extern void init_rcu_head_on_stack(struct rcu_head *head); extern void destroy_rcu_head_on_stack(struct rcu_head *head); static inline __attribute__((no_instrument_function)) bool rcu_lockdep_current_cpu_online(void) { return 1; } static inline __attribute__((no_instrument_function)) int rcu_read_lock_held(void) { return 1; } static inline __attribute__((no_instrument_function)) int rcu_read_lock_bh_held(void) { return 1; } static inline __attribute__((no_instrument_function)) int rcu_read_lock_sched_held(void) { return (current_thread_info()->preempt_count) != 0 || ({ unsigned long _flags; do { ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); _flags = arch_local_save_flags(); } while (0); ({ ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(_flags); }); }); } static inline __attribute__((no_instrument_function)) void rcu_read_lock(void) { __rcu_read_lock(); (void)0; do { } while (0); do { } while (0) ; } static inline __attribute__((no_instrument_function)) void rcu_read_unlock(void) { do { } while (0) ; do { } while (0); (void)0; __rcu_read_unlock(); } static inline __attribute__((no_instrument_function)) void rcu_read_lock_bh(void) { local_bh_disable(); (void)0; do { } while (0); do { } while (0) ; } static inline __attribute__((no_instrument_function)) void rcu_read_unlock_bh(void) { do { } while (0) ; do { } while (0); (void)0; local_bh_enable(); } static inline __attribute__((no_instrument_function)) void rcu_read_lock_sched(void) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); (void)0; do { } while (0); do { } while (0) ; } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) void rcu_read_lock_sched_notrace(void) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); (void)0; } static inline __attribute__((no_instrument_function)) void rcu_read_unlock_sched(void) { do { } while (0) ; do { } while (0); (void)0; do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) __attribute__((no_instrument_function)) void rcu_read_unlock_sched_notrace(void) { (void)0; do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) bool __is_kfree_rcu_offset(unsigned long offset) { return offset < 4096; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void __kfree_rcu(struct rcu_head *head, unsigned long offset) { typedef void (*rcu_callback)(struct rcu_head *); ; ; kfree_call_rcu(head, (rcu_callback)offset); } struct srcu_struct_array { int c[2]; }; struct srcu_struct { int completed; struct srcu_struct_array *per_cpu_ref; struct mutex mutex; }; int init_srcu_struct(struct srcu_struct *sp); void cleanup_srcu_struct(struct srcu_struct *sp); int __srcu_read_lock(struct srcu_struct *sp) ; void __srcu_read_unlock(struct srcu_struct *sp, int idx) ; void synchronize_srcu(struct srcu_struct *sp); void synchronize_srcu_expedited(struct srcu_struct *sp); long srcu_batches_completed(struct srcu_struct *sp); static inline __attribute__((no_instrument_function)) int srcu_read_lock_held(struct srcu_struct *sp) { return 1; } static inline __attribute__((no_instrument_function)) int srcu_read_lock(struct srcu_struct *sp) { int retval = __srcu_read_lock(sp); do { } while (0); do { } while (0) ; return retval; } static inline __attribute__((no_instrument_function)) void srcu_read_unlock(struct srcu_struct *sp, int idx) { do { } while (0) ; do { } while (0); __srcu_read_unlock(sp, idx); } static inline __attribute__((no_instrument_function)) int srcu_read_lock_raw(struct srcu_struct *sp) { unsigned long flags; int ret; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); ret = __srcu_read_lock(sp); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); return ret; } static inline __attribute__((no_instrument_function)) void srcu_read_unlock_raw(struct srcu_struct *sp, int idx) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); __srcu_read_unlock(sp, idx); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); } struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; }; struct atomic_notifier_head { spinlock_t lock; struct notifier_block *head; }; struct blocking_notifier_head { struct rw_semaphore rwsem; struct notifier_block *head; }; struct raw_notifier_head { struct notifier_block *head; }; struct srcu_notifier_head { struct mutex mutex; struct srcu_struct srcu; struct notifier_block *head; }; extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh, struct notifier_block *nb); extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh, struct notifier_block *nb); extern int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, struct notifier_block *nb); extern int blocking_notifier_chain_cond_register( struct blocking_notifier_head *nh, struct notifier_block *nb); extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *nb); extern int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, struct notifier_block *nb); extern int atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v); extern int __atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); extern int blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v); extern int __blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); extern int raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v); extern int __raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); extern int srcu_notifier_call_chain(struct srcu_notifier_head *nh, unsigned long val, void *v); extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); static inline __attribute__((no_instrument_function)) int notifier_from_errno(int err) { if (err) return 0x8000 | (0x0001 - err); return 0x0001; } static inline __attribute__((no_instrument_function)) int notifier_to_errno(int ret) { ret &= ~0x8000; return ret > 0x0001 ? 0x0001 - ret : 0; } extern struct blocking_notifier_head reboot_notifier_list; struct page; struct zone; struct pglist_data; struct mem_section; enum { MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12, SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE, MIX_SECTION_INFO, NODE_INFO, MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, }; static inline __attribute__((no_instrument_function)) void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags) { do { do { ({ unsigned long __dummy; typeof(*flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); *flags = _raw_spin_lock_irqsave(spinlock_check(&pgdat->node_size_lock)); } while (0); } while (0); } static inline __attribute__((no_instrument_function)) void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags) { spin_unlock_irqrestore(&pgdat->node_size_lock, *flags); } static inline __attribute__((no_instrument_function)) void pgdat_resize_init(struct pglist_data *pgdat) { do { spinlock_check(&pgdat->node_size_lock); do { static struct lock_class_key __key; __raw_spin_lock_init((&(&pgdat->node_size_lock)->rlock), "&(&pgdat->node_size_lock)->rlock", &__key); } while (0); } while (0); } static inline __attribute__((no_instrument_function)) unsigned zone_span_seqbegin(struct zone *zone) { return read_seqbegin(&zone->span_seqlock); } static inline __attribute__((no_instrument_function)) int zone_span_seqretry(struct zone *zone, unsigned iv) { return read_seqretry(&zone->span_seqlock, iv); } static inline __attribute__((no_instrument_function)) void zone_span_writelock(struct zone *zone) { write_seqlock(&zone->span_seqlock); } static inline __attribute__((no_instrument_function)) void zone_span_writeunlock(struct zone *zone) { write_sequnlock(&zone->span_seqlock); } static inline __attribute__((no_instrument_function)) void zone_seqlock_init(struct zone *zone) { do { (&zone->span_seqlock)->sequence = 0; do { spinlock_check(&(&zone->span_seqlock)->lock); do { static struct lock_class_key __key; __raw_spin_lock_init((&(&(&zone->span_seqlock)->lock)->rlock), "&(&(&zone->span_seqlock)->lock)->rlock", &__key); } while (0); } while (0); } while (0); } extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); extern int online_pages(unsigned long, unsigned long); extern void __offline_isolated_pages(unsigned long, unsigned long); typedef void (*online_page_callback_t)(struct page *page); extern int set_online_page_callback(online_page_callback_t callback); extern int restore_online_page_callback(online_page_callback_t callback); extern void __online_page_set_limits(struct page *page); extern void __online_page_increment_counters(struct page *page); extern void __online_page_free(struct page *page); extern bool is_pageblock_removable_nolock(struct page *page); extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, unsigned long nr_pages); extern int __remove_pages(struct zone *zone, unsigned long start_pfn, unsigned long nr_pages); extern int memory_add_physaddr_to_nid(u64 start); extern pg_data_t *node_data[]; static inline __attribute__((no_instrument_function)) void arch_refresh_nodedata(int nid, pg_data_t *pgdat) { node_data[nid] = pgdat; } static inline __attribute__((no_instrument_function)) void register_page_bootmem_info_node(struct pglist_data *pgdat) { } static inline __attribute__((no_instrument_function)) void put_page_bootmem(struct page *page) { } void lock_memory_hotplug(void); void unlock_memory_hotplug(void); extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); extern int mem_online_node(int nid); extern int add_memory(int nid, u64 start, u64 size); extern int arch_add_memory(int nid, u64 start, u64 size); extern int remove_memory(u64 start, u64 size); extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, int nr_pages); extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pnum); extern struct mutex zonelists_mutex; void build_all_zonelists(void *data); void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx); bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags); bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags); enum memmap_context { MEMMAP_EARLY, MEMMAP_HOTPLUG, }; extern int init_currently_empty_zone(struct zone *zone, unsigned long start_pfn, unsigned long size, enum memmap_context context); void memory_present(int nid, unsigned long start, unsigned long end); static inline __attribute__((no_instrument_function)) int local_memory_node(int node_id) { return node_id; }; static inline __attribute__((no_instrument_function)) int populated_zone(struct zone *zone) { return (!!zone->present_pages); } extern int movable_zone; static inline __attribute__((no_instrument_function)) int zone_movable_is_highmem(void) { return 0; } static inline __attribute__((no_instrument_function)) int is_highmem_idx(enum zone_type idx) { return 0; } static inline __attribute__((no_instrument_function)) int is_normal_idx(enum zone_type idx) { return (idx == ZONE_NORMAL); } static inline __attribute__((no_instrument_function)) int is_highmem(struct zone *zone) { return 0; } static inline __attribute__((no_instrument_function)) int is_normal(struct zone *zone) { return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; } static inline __attribute__((no_instrument_function)) int is_dma32(struct zone *zone) { return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; } static inline __attribute__((no_instrument_function)) int is_dma(struct zone *zone) { return zone == zone->zone_pgdat->node_zones + ZONE_DMA; } struct ctl_table; int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); extern int sysctl_lowmem_reserve_ratio[4 -1]; int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); extern int numa_zonelist_order_handler(struct ctl_table *, int, void *, size_t *, loff_t *); extern char numa_zonelist_order[]; extern struct pglist_data *node_data[]; extern struct pglist_data *first_online_pgdat(void); extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat); extern struct zone *next_zone(struct zone *zone); static inline __attribute__((no_instrument_function)) struct zone *zonelist_zone(struct zoneref *zoneref) { return zoneref->zone; } static inline __attribute__((no_instrument_function)) int zonelist_zone_idx(struct zoneref *zoneref) { return zoneref->zone_idx; } static inline __attribute__((no_instrument_function)) int zonelist_node_idx(struct zoneref *zoneref) { return zoneref->zone->node; } struct zoneref *next_zones_zonelist(struct zoneref *z, enum zone_type highest_zoneidx, nodemask_t *nodes, struct zone **zone); static inline __attribute__((no_instrument_function)) struct zoneref *first_zones_zonelist(struct zonelist *zonelist, enum zone_type highest_zoneidx, nodemask_t *nodes, struct zone **zone) { return next_zones_zonelist(zonelist->_zonerefs, highest_zoneidx, nodes, zone); } struct page; struct page_cgroup; struct mem_section { unsigned long section_mem_map; unsigned long *pageblock_flags; struct page_cgroup *page_cgroup; unsigned long pad; }; extern struct mem_section *mem_section[((((1UL << (46 - 27))) + ((((1UL) << 12) / sizeof (struct mem_section))) - 1) / ((((1UL) << 12) / sizeof (struct mem_section))))]; static inline __attribute__((no_instrument_function)) struct mem_section *__nr_to_section(unsigned long nr) { if (!mem_section[((nr) / (((1UL) << 12) / sizeof (struct mem_section)))]) return ((void *)0); return &mem_section[((nr) / (((1UL) << 12) / sizeof (struct mem_section)))][nr & ((((1UL) << 12) / sizeof (struct mem_section)) - 1)]; } extern int __section_nr(struct mem_section* ms); extern unsigned long usemap_size(void); static inline __attribute__((no_instrument_function)) struct page *__section_mem_map_addr(struct mem_section *section) { unsigned long map = section->section_mem_map; map &= (~((1UL<<2)-1)); return (struct page *)map; } static inline __attribute__((no_instrument_function)) int present_section(struct mem_section *section) { return (section && (section->section_mem_map & (1UL<<0))); } static inline __attribute__((no_instrument_function)) int present_section_nr(unsigned long nr) { return present_section(__nr_to_section(nr)); } static inline __attribute__((no_instrument_function)) int valid_section(struct mem_section *section) { return (section && (section->section_mem_map & (1UL<<1))); } static inline __attribute__((no_instrument_function)) int valid_section_nr(unsigned long nr) { return valid_section(__nr_to_section(nr)); } static inline __attribute__((no_instrument_function)) struct mem_section *__pfn_to_section(unsigned long pfn) { return __nr_to_section(((pfn) >> (27 - 12))); } static inline __attribute__((no_instrument_function)) int pfn_valid(unsigned long pfn) { if (((pfn) >> (27 - 12)) >= (1UL << (46 - 27))) return 0; return valid_section(__nr_to_section(((pfn) >> (27 - 12)))); } static inline __attribute__((no_instrument_function)) int pfn_present(unsigned long pfn) { if (((pfn) >> (27 - 12)) >= (1UL << (46 - 27))) return 0; return present_section(__nr_to_section(((pfn) >> (27 - 12)))); } void sparse_init(void); bool early_pfn_in_nid(unsigned long pfn, int nid); void memory_present(int nid, unsigned long start, unsigned long end); unsigned long __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) node_memmap_size_bytes(int, unsigned long, unsigned long); static inline __attribute__((no_instrument_function)) int memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone) { return 1; } extern void *pcpu_base_addr; extern const unsigned long *pcpu_unit_offsets; struct pcpu_group_info { int nr_units; unsigned long base_offset; unsigned int *cpu_map; }; struct pcpu_alloc_info { size_t static_size; size_t reserved_size; size_t dyn_size; size_t unit_size; size_t atom_size; size_t alloc_size; size_t __ai_size; int nr_groups; struct pcpu_group_info groups[]; }; enum pcpu_fc { PCPU_FC_AUTO, PCPU_FC_EMBED, PCPU_FC_PAGE, PCPU_FC_NR, }; extern const char *pcpu_fc_names[PCPU_FC_NR]; extern enum pcpu_fc pcpu_chosen_fc; typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size, size_t align); typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size); typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr); typedef int (pcpu_fc_cpu_distance_fn_t)(unsigned int from, unsigned int to); extern struct pcpu_alloc_info * __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pcpu_alloc_alloc_info(int nr_groups, int nr_units); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pcpu_free_alloc_info(struct pcpu_alloc_info *ai); extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, void *base_addr); extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, size_t atom_size, pcpu_fc_cpu_distance_fn_t cpu_distance_fn, pcpu_fc_alloc_fn_t alloc_fn, pcpu_fc_free_fn_t free_fn); extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_alloc_fn_t alloc_fn, pcpu_fc_free_fn_t free_fn, pcpu_fc_populate_pte_fn_t populate_pte_fn); extern void *__alloc_reserved_percpu(size_t size, size_t align); extern bool is_kernel_percpu_address(unsigned long addr); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) percpu_init_late(void); extern void *__alloc_percpu(size_t size, size_t align); extern void free_percpu(void *__pdata); extern phys_addr_t per_cpu_ptr_to_phys(void *addr); extern void __bad_size_call_parameter(void); int arch_update_cpu_topology(void); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_numa_node; extern __attribute__((section(".data..percpu" ""))) __typeof__(int) numa_node; static inline __attribute__((no_instrument_function)) int numa_node_id(void) { return ({ typeof((numa_node)) pscr_ret__; do { const void *__vpp_verify = (typeof(&((numa_node))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof((numa_node))) { case 1: pscr_ret__ = ({ typeof(((numa_node))) pfo_ret__; switch (sizeof(((numa_node)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((numa_node))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 2: pscr_ret__ = ({ typeof(((numa_node))) pfo_ret__; switch (sizeof(((numa_node)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((numa_node))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 4: pscr_ret__ = ({ typeof(((numa_node))) pfo_ret__; switch (sizeof(((numa_node)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((numa_node))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 8: pscr_ret__ = ({ typeof(((numa_node))) pfo_ret__; switch (sizeof(((numa_node)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((numa_node))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((numa_node))); break; default: __bad_percpu_size(); } pfo_ret__; });break; default: __bad_size_call_parameter();break; } pscr_ret__; }); } static inline __attribute__((no_instrument_function)) void set_numa_node(int node) { do { typedef typeof(numa_node) pto_T__; if (0) { pto_T__ pto_tmp__; pto_tmp__ = (node); (void)pto_tmp__; } switch (sizeof(numa_node)) { case 1: asm("mov" "b %1,""%%""gs"":" "%P" "0" : "+m" (numa_node) : "qi" ((pto_T__)(node))); break; case 2: asm("mov" "w %1,""%%""gs"":" "%P" "0" : "+m" (numa_node) : "ri" ((pto_T__)(node))); break; case 4: asm("mov" "l %1,""%%""gs"":" "%P" "0" : "+m" (numa_node) : "ri" ((pto_T__)(node))); break; case 8: asm("mov" "q %1,""%%""gs"":" "%P" "0" : "+m" (numa_node) : "re" ((pto_T__)(node))); break; default: __bad_percpu_size(); } } while (0); } static inline __attribute__((no_instrument_function)) void set_cpu_numa_node(int cpu, int node) { (*({ do { const void *__vpp_verify = (typeof((&(numa_node))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*(&(numa_node))) *)(&(numa_node)))); (typeof((typeof(*(&(numa_node))) *)(&(numa_node)))) (__ptr + (((__per_cpu_offset[cpu])))); }); })) = node; } static inline __attribute__((no_instrument_function)) int numa_mem_id(void) { return numa_node_id(); } static inline __attribute__((no_instrument_function)) int cpu_to_mem(int cpu) { return __cpu_to_node(cpu); } struct vm_area_struct; static inline __attribute__((no_instrument_function)) int allocflags_to_migratetype(gfp_t gfp_flags) { ({ int __ret_warn_on = !!((gfp_flags & ((( gfp_t)0x80000u)|(( gfp_t)0x08u))) == ((( gfp_t)0x80000u)|(( gfp_t)0x08u))); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/gfp.h", 154); ldv__builtin_expect(!!(__ret_warn_on), 0); }); if (ldv__builtin_expect(!!(page_group_by_mobility_disabled), 0)) return 0; return (((gfp_flags & (( gfp_t)0x08u)) != 0) << 1) | ((gfp_flags & (( gfp_t)0x80000u)) != 0); } static inline __attribute__((no_instrument_function)) enum zone_type gfp_zone(gfp_t flags) { enum zone_type z; int bit = ( int) (flags & ((( gfp_t)0x01u)|(( gfp_t)0x02u)|(( gfp_t)0x04u)|(( gfp_t)0x08u))); z = (( (ZONE_NORMAL << 0 * 2) | (ZONE_DMA << 0x01u * 2) | (ZONE_NORMAL << 0x02u * 2) | (ZONE_DMA32 << 0x04u * 2) | (ZONE_NORMAL << 0x08u * 2) | (ZONE_DMA << (0x08u | 0x01u) * 2) | (ZONE_MOVABLE << (0x08u | 0x02u) * 2) | (ZONE_DMA32 << (0x08u | 0x04u) * 2) ) >> (bit * 2)) & ((1 << 2) - 1); do { if (ldv__builtin_expect(!!((( 1 << (0x01u | 0x02u) | 1 << (0x01u | 0x04u) | 1 << (0x04u | 0x02u) | 1 << (0x01u | 0x04u | 0x02u) | 1 << (0x08u | 0x02u | 0x01u) | 1 << (0x08u | 0x04u | 0x01u) | 1 << (0x08u | 0x04u | 0x02u) | 1 << (0x08u | 0x04u | 0x01u | 0x02u) ) >> bit) & 1), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/gfp.h"), "i" (254), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return z; } static inline __attribute__((no_instrument_function)) int gfp_zonelist(gfp_t flags) { if (1 && ldv__builtin_expect(!!(flags & (( gfp_t)0x40000u)), 0)) return 1; return 0; } static inline __attribute__((no_instrument_function)) struct zonelist *node_zonelist(int nid, gfp_t flags) { return (node_data[nid])->node_zonelists + gfp_zonelist(flags); } static inline __attribute__((no_instrument_function)) void arch_free_page(struct page *page, int order) { } static inline __attribute__((no_instrument_function)) void arch_alloc_page(struct page *page, int order) { } struct page * __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, nodemask_t *nodemask); static inline __attribute__((no_instrument_function)) struct page * __alloc_pages(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist) { return __alloc_pages_nodemask(gfp_mask, order, zonelist, ((void *)0)); } static inline __attribute__((no_instrument_function)) struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { if (nid < 0) nid = numa_node_id(); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } static inline __attribute__((no_instrument_function)) struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, unsigned int order) { do { if (ldv__builtin_expect(!!(nid < 0 || nid >= (1 << 10) || !node_state((nid), N_ONLINE)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/gfp.h"), "i" (318), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); static inline __attribute__((no_instrument_function)) struct page * alloc_pages(gfp_t gfp_mask, unsigned int order) { return alloc_pages_current(gfp_mask, order); } extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, struct vm_area_struct *vma, unsigned long addr, int node); extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); extern unsigned long get_zeroed_page(gfp_t gfp_mask); void *alloc_pages_exact(size_t size, gfp_t gfp_mask); void free_pages_exact(void *virt, size_t size); void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); extern void __free_pages(struct page *page, unsigned int order); extern void free_pages(unsigned long addr, unsigned int order); extern void free_hot_cold_page(struct page *page, int cold); extern void free_hot_cold_page_list(struct list_head *list, int cold); void page_alloc_init(void); void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); void drain_all_pages(void); void drain_local_pages(void *dummy); extern gfp_t gfp_allowed_mask; extern void pm_restrict_gfp_mask(void); extern void pm_restore_gfp_mask(void); extern bool pm_suspended_storage(void); static inline __attribute__((no_instrument_function)) int irq_canonicalize(int irq) { return ((irq == 2) ? 9 : irq); } extern void fixup_irqs(void); extern void irq_force_complete_move(int); extern void (*x86_platform_ipi_callback)(void); extern void native_init_IRQ(void); extern bool handle_irq(unsigned irq, struct pt_regs *regs); extern unsigned int do_IRQ(struct pt_regs *regs); extern unsigned long used_vectors[(((256) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; extern int vector_used_by_percpu_irq(unsigned int vector); extern void init_ISA_irqs(void); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_irq_regs; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct pt_regs *) irq_regs; static inline __attribute__((no_instrument_function)) struct pt_regs *get_irq_regs(void) { return ({ typeof(irq_regs) pfo_ret__; switch (sizeof(irq_regs)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (irq_regs)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (irq_regs)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (irq_regs)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (irq_regs)); break; default: __bad_percpu_size(); } pfo_ret__; }); } static inline __attribute__((no_instrument_function)) struct pt_regs *set_irq_regs(struct pt_regs *new_regs) { struct pt_regs *old_regs; old_regs = get_irq_regs(); do { typedef typeof(irq_regs) pto_T__; if (0) { pto_T__ pto_tmp__; pto_tmp__ = (new_regs); (void)pto_tmp__; } switch (sizeof(irq_regs)) { case 1: asm("mov" "b %1,""%%""gs"":" "%P" "0" : "+m" (irq_regs) : "qi" ((pto_T__)(new_regs))); break; case 2: asm("mov" "w %1,""%%""gs"":" "%P" "0" : "+m" (irq_regs) : "ri" ((pto_T__)(new_regs))); break; case 4: asm("mov" "l %1,""%%""gs"":" "%P" "0" : "+m" (irq_regs) : "ri" ((pto_T__)(new_regs))); break; case 8: asm("mov" "q %1,""%%""gs"":" "%P" "0" : "+m" (irq_regs) : "re" ((pto_T__)(new_regs))); break; default: __bad_percpu_size(); } } while (0); return old_regs; } struct seq_file; struct module; struct irq_desc; struct irq_data; typedef void (*irq_flow_handler_t)(unsigned int irq, struct irq_desc *desc); typedef void (*irq_preflow_handler_t)(struct irq_data *data); enum { IRQ_TYPE_NONE = 0x00000000, IRQ_TYPE_EDGE_RISING = 0x00000001, IRQ_TYPE_EDGE_FALLING = 0x00000002, IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING), IRQ_TYPE_LEVEL_HIGH = 0x00000004, IRQ_TYPE_LEVEL_LOW = 0x00000008, IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), IRQ_TYPE_SENSE_MASK = 0x0000000f, IRQ_TYPE_DEFAULT = IRQ_TYPE_SENSE_MASK, IRQ_TYPE_PROBE = 0x00000010, IRQ_LEVEL = (1 << 8), IRQ_PER_CPU = (1 << 9), IRQ_NOPROBE = (1 << 10), IRQ_NOREQUEST = (1 << 11), IRQ_NOAUTOEN = (1 << 12), IRQ_NO_BALANCING = (1 << 13), IRQ_MOVE_PCNTXT = (1 << 14), IRQ_NESTED_THREAD = (1 << 15), IRQ_NOTHREAD = (1 << 16), IRQ_PER_CPU_DEVID = (1 << 17), }; enum { IRQ_SET_MASK_OK = 0, IRQ_SET_MASK_OK_NOCOPY, }; struct msi_desc; struct irq_domain; struct irq_data { unsigned int irq; unsigned long hwirq; unsigned int node; unsigned int state_use_accessors; struct irq_chip *chip; struct irq_domain *domain; void *handler_data; void *chip_data; struct msi_desc *msi_desc; cpumask_var_t affinity; }; enum { IRQD_TRIGGER_MASK = 0xf, IRQD_SETAFFINITY_PENDING = (1 << 8), IRQD_NO_BALANCING = (1 << 10), IRQD_PER_CPU = (1 << 11), IRQD_AFFINITY_SET = (1 << 12), IRQD_LEVEL = (1 << 13), IRQD_WAKEUP_STATE = (1 << 14), IRQD_MOVE_PCNTXT = (1 << 15), IRQD_IRQ_DISABLED = (1 << 16), IRQD_IRQ_MASKED = (1 << 17), IRQD_IRQ_INPROGRESS = (1 << 18), }; static inline __attribute__((no_instrument_function)) bool irqd_is_setaffinity_pending(struct irq_data *d) { return d->state_use_accessors & IRQD_SETAFFINITY_PENDING; } static inline __attribute__((no_instrument_function)) bool irqd_is_per_cpu(struct irq_data *d) { return d->state_use_accessors & IRQD_PER_CPU; } static inline __attribute__((no_instrument_function)) bool irqd_can_balance(struct irq_data *d) { return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING)); } static inline __attribute__((no_instrument_function)) bool irqd_affinity_was_set(struct irq_data *d) { return d->state_use_accessors & IRQD_AFFINITY_SET; } static inline __attribute__((no_instrument_function)) void irqd_mark_affinity_was_set(struct irq_data *d) { d->state_use_accessors |= IRQD_AFFINITY_SET; } static inline __attribute__((no_instrument_function)) u32 irqd_get_trigger_type(struct irq_data *d) { return d->state_use_accessors & IRQD_TRIGGER_MASK; } static inline __attribute__((no_instrument_function)) void irqd_set_trigger_type(struct irq_data *d, u32 type) { d->state_use_accessors &= ~IRQD_TRIGGER_MASK; d->state_use_accessors |= type & IRQD_TRIGGER_MASK; } static inline __attribute__((no_instrument_function)) bool irqd_is_level_type(struct irq_data *d) { return d->state_use_accessors & IRQD_LEVEL; } static inline __attribute__((no_instrument_function)) bool irqd_is_wakeup_set(struct irq_data *d) { return d->state_use_accessors & IRQD_WAKEUP_STATE; } static inline __attribute__((no_instrument_function)) bool irqd_can_move_in_process_context(struct irq_data *d) { return d->state_use_accessors & IRQD_MOVE_PCNTXT; } static inline __attribute__((no_instrument_function)) bool irqd_irq_disabled(struct irq_data *d) { return d->state_use_accessors & IRQD_IRQ_DISABLED; } static inline __attribute__((no_instrument_function)) bool irqd_irq_masked(struct irq_data *d) { return d->state_use_accessors & IRQD_IRQ_MASKED; } static inline __attribute__((no_instrument_function)) bool irqd_irq_inprogress(struct irq_data *d) { return d->state_use_accessors & IRQD_IRQ_INPROGRESS; } static inline __attribute__((no_instrument_function)) void irqd_set_chained_irq_inprogress(struct irq_data *d) { d->state_use_accessors |= IRQD_IRQ_INPROGRESS; } static inline __attribute__((no_instrument_function)) void irqd_clr_chained_irq_inprogress(struct irq_data *d) { d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS; } static inline __attribute__((no_instrument_function)) irq_hw_number_t irqd_to_hwirq(struct irq_data *d) { return d->hwirq; } struct irq_chip { const char *name; unsigned int (*irq_startup)(struct irq_data *data); void (*irq_shutdown)(struct irq_data *data); void (*irq_enable)(struct irq_data *data); void (*irq_disable)(struct irq_data *data); void (*irq_ack)(struct irq_data *data); void (*irq_mask)(struct irq_data *data); void (*irq_mask_ack)(struct irq_data *data); void (*irq_unmask)(struct irq_data *data); void (*irq_eoi)(struct irq_data *data); int (*irq_set_affinity)(struct irq_data *data, const struct cpumask *dest, bool force); int (*irq_retrigger)(struct irq_data *data); int (*irq_set_type)(struct irq_data *data, unsigned int flow_type); int (*irq_set_wake)(struct irq_data *data, unsigned int on); void (*irq_bus_lock)(struct irq_data *data); void (*irq_bus_sync_unlock)(struct irq_data *data); void (*irq_cpu_online)(struct irq_data *data); void (*irq_cpu_offline)(struct irq_data *data); void (*irq_suspend)(struct irq_data *data); void (*irq_resume)(struct irq_data *data); void (*irq_pm_shutdown)(struct irq_data *data); void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); unsigned long flags; }; enum { IRQCHIP_SET_TYPE_MASKED = (1 << 0), IRQCHIP_EOI_IF_HANDLED = (1 << 1), IRQCHIP_MASK_ON_SUSPEND = (1 << 2), IRQCHIP_ONOFFLINE_ENABLED = (1 << 3), IRQCHIP_SKIP_SET_WAKE = (1 << 4), }; struct irq_affinity_notify; struct proc_dir_entry; struct timer_rand_state; struct module; struct irq_desc { struct irq_data irq_data; struct timer_rand_state *timer_rand_state; unsigned int *kstat_irqs; irq_flow_handler_t handle_irq; struct irqaction *action; unsigned int status_use_accessors; unsigned int core_internal_state__do_not_mess_with_it; unsigned int depth; unsigned int wake_depth; unsigned int irq_count; unsigned long last_unhandled; unsigned int irqs_unhandled; raw_spinlock_t lock; struct cpumask *percpu_enabled; const struct cpumask *affinity_hint; struct irq_affinity_notify *affinity_notify; cpumask_var_t pending_mask; unsigned long threads_oneshot; atomic_t threads_active; wait_queue_head_t wait_for_threads; struct proc_dir_entry *dir; struct module *owner; const char *name; } __attribute__((__aligned__(1 << (12)))); static inline __attribute__((no_instrument_function)) struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) { return &desc->irq_data; } static inline __attribute__((no_instrument_function)) struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) { return desc->irq_data.chip; } static inline __attribute__((no_instrument_function)) void *irq_desc_get_chip_data(struct irq_desc *desc) { return desc->irq_data.chip_data; } static inline __attribute__((no_instrument_function)) void *irq_desc_get_handler_data(struct irq_desc *desc) { return desc->irq_data.handler_data; } static inline __attribute__((no_instrument_function)) struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) { return desc->irq_data.msi_desc; } static inline __attribute__((no_instrument_function)) void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) { desc->handle_irq(irq, desc); } int generic_handle_irq(unsigned int irq); static inline __attribute__((no_instrument_function)) int irq_has_action(unsigned int irq) { struct irq_desc *desc = irq_to_desc(irq); return desc->action != ((void *)0); } static inline __attribute__((no_instrument_function)) void __irq_set_handler_locked(unsigned int irq, irq_flow_handler_t handler) { struct irq_desc *desc; desc = irq_to_desc(irq); desc->handle_irq = handler; } static inline __attribute__((no_instrument_function)) void __irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip, irq_flow_handler_t handler, const char *name) { struct irq_desc *desc; desc = irq_to_desc(irq); irq_desc_get_irq_data(desc)->chip = chip; desc->handle_irq = handler; desc->name = name; } static inline __attribute__((no_instrument_function)) int irq_balancing_disabled(unsigned int irq) { struct irq_desc *desc; desc = irq_to_desc(irq); return desc->status_use_accessors & (IRQ_PER_CPU | IRQ_NO_BALANCING); } static inline __attribute__((no_instrument_function)) void irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class) { struct irq_desc *desc = irq_to_desc(irq); if (desc) do { (void)(class); } while (0); } struct proc_dir_entry; struct pt_regs; struct notifier_block; void create_prof_cpu_mask(struct proc_dir_entry *de); int create_proc_profile(void); enum profile_type { PROFILE_TASK_EXIT, PROFILE_MUNMAP }; extern int prof_on __attribute__((__section__(".data..read_mostly"))); int profile_init(void); int profile_setup(char *str); void profile_tick(int type); void profile_hits(int type, void *ip, unsigned int nr_hits); static inline __attribute__((no_instrument_function)) void profile_hit(int type, void *ip) { if (ldv__builtin_expect(!!(prof_on == type), 0)) profile_hits(type, ip, 1); } struct task_struct; struct mm_struct; void profile_task_exit(struct task_struct * task); int profile_handoff_task(struct task_struct * task); void profile_munmap(unsigned long addr); int task_handoff_register(struct notifier_block * n); int task_handoff_unregister(struct notifier_block * n); int profile_event_register(enum profile_type, struct notifier_block * n); int profile_event_unregister(enum profile_type, struct notifier_block * n); int register_timer_hook(int (*hook)(struct pt_regs *)); void unregister_timer_hook(int (*hook)(struct pt_regs *)); struct pt_regs; extern char _text[], _stext[], _etext[]; extern char _data[], _sdata[], _edata[]; extern char __bss_start[], __bss_stop[]; extern char __init_begin[], __init_end[]; extern char _sinittext[], _einittext[]; extern char _end[]; extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; extern char __kprobes_text_start[], __kprobes_text_end[]; extern char __entry_text_start[], __entry_text_end[]; extern char __initdata_begin[], __initdata_end[]; extern char __start_rodata[], __end_rodata[]; extern char __ctors_start[], __ctors_end[]; static inline __attribute__((no_instrument_function)) int arch_is_kernel_text(unsigned long addr) { return 0; } static inline __attribute__((no_instrument_function)) int arch_is_kernel_data(unsigned long addr) { return 0; } struct exception_table_entry { unsigned long insn, fixup; }; extern int fixup_exception(struct pt_regs *regs); extern int __get_user_1(void); extern int __get_user_2(void); extern int __get_user_4(void); extern int __get_user_8(void); extern int __get_user_bad(void); extern void __put_user_bad(void); extern void __put_user_1(void); extern void __put_user_2(void); extern void __put_user_4(void); extern void __put_user_8(void); struct __large_struct { unsigned long buf[100]; }; extern unsigned long copy_from_user_nmi(void *to, const void *from, unsigned long n); extern __attribute__((warn_unused_result)) long strncpy_from_user(char *dst, const char *src, long count); __attribute__((warn_unused_result)) unsigned long copy_user_generic_string(void *to, const void *from, unsigned len); __attribute__((warn_unused_result)) unsigned long copy_user_generic_unrolled(void *to, const void *from, unsigned len); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((warn_unused_result)) unsigned long copy_user_generic(void *to, const void *from, unsigned len) { unsigned ret; asm volatile ("661:\n\t" "call %P[old]" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(3*32+16)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "call %P[new]" "\n664:\n" ".previous" : "=a" (ret), "=D" (to), "=S" (from), "=d" (len) : [old] "i" (copy_user_generic_unrolled), [new] "i" (copy_user_generic_string), "1" (to), "2" (from), "3" (len) : "memory", "rcx", "r8", "r9", "r10", "r11") ; return ret; } __attribute__((warn_unused_result)) unsigned long _copy_to_user(void *to, const void *from, unsigned len); __attribute__((warn_unused_result)) unsigned long _copy_from_user(void *to, const void *from, unsigned len); __attribute__((warn_unused_result)) unsigned long copy_in_user(void *to, const void *from, unsigned len); static inline __attribute__((no_instrument_function)) unsigned long __attribute__((warn_unused_result)) copy_from_user(void *to, const void *from, unsigned long n) { int sz = __builtin_object_size(to, 0); might_fault(); if (ldv__builtin_expect(!!(sz == -1 || sz >= n), 1)) n = _copy_from_user(to, from, n); else ({ int __ret_warn_on = !!(1); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_fmt("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/uaccess_64.h", 57, "Buffer overflow detected!\n"); ldv__builtin_expect(!!(__ret_warn_on), 0); }); return n; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((warn_unused_result)) int copy_to_user(void *dst, const void *src, unsigned size) { might_fault(); return _copy_to_user(dst, src, size); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((warn_unused_result)) int __copy_from_user(void *dst, const void *src, unsigned size) { int ret = 0; might_fault(); if (!__builtin_constant_p(size)) return copy_user_generic(dst, ( void *)src, size); switch (size) { case 1:asm volatile("1: mov""b"" %2,%""b""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""b"" %""b""1,%""b""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=q"(*(u8 *)dst) : "m" ((*(struct __large_struct *)((u8 *)src))), "i" (1), "0" (ret)) ; return ret; case 2:asm volatile("1: mov""w"" %2,%""w""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""w"" %""w""1,%""w""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u16 *)dst) : "m" ((*(struct __large_struct *)((u16 *)src))), "i" (2), "0" (ret)) ; return ret; case 4:asm volatile("1: mov""l"" %2,%""k""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""l"" %""k""1,%""k""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u32 *)dst) : "m" ((*(struct __large_struct *)((u32 *)src))), "i" (4), "0" (ret)) ; return ret; case 8:asm volatile("1: mov""q"" %2,%""""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""q"" %""""1,%""""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u64 *)dst) : "m" ((*(struct __large_struct *)((u64 *)src))), "i" (8), "0" (ret)) ; return ret; case 10: asm volatile("1: mov""q"" %2,%""""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""q"" %""""1,%""""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u64 *)dst) : "m" ((*(struct __large_struct *)((u64 *)src))), "i" (10), "0" (ret)) ; if (ldv__builtin_expect(!!(ret), 0)) return ret; asm volatile("1: mov""w"" %2,%""w""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""w"" %""w""1,%""w""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u16 *)(8 + (char *)dst)) : "m" ((*(struct __large_struct *)((u16 *)(8 + (char *)src)))), "i" (2), "0" (ret)) ; return ret; case 16: asm volatile("1: mov""q"" %2,%""""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""q"" %""""1,%""""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u64 *)dst) : "m" ((*(struct __large_struct *)((u64 *)src))), "i" (16), "0" (ret)) ; if (ldv__builtin_expect(!!(ret), 0)) return ret; asm volatile("1: mov""q"" %2,%""""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""q"" %""""1,%""""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(*(u64 *)(8 + (char *)dst)) : "m" ((*(struct __large_struct *)((u64 *)(8 + (char *)src)))), "i" (8), "0" (ret)) ; return ret; default: return copy_user_generic(dst, ( void *)src, size); } } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((warn_unused_result)) int __copy_to_user(void *dst, const void *src, unsigned size) { int ret = 0; might_fault(); if (!__builtin_constant_p(size)) return copy_user_generic(( void *)dst, src, size); switch (size) { case 1:asm volatile("1: mov""b"" %""b""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "iq"(*(u8 *)src), "m" ((*(struct __large_struct *)((u8 *)dst))), "i" (1), "0" (ret)) ; return ret; case 2:asm volatile("1: mov""w"" %""w""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "ir"(*(u16 *)src), "m" ((*(struct __large_struct *)((u16 *)dst))), "i" (2), "0" (ret)) ; return ret; case 4:asm volatile("1: mov""l"" %""k""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "ir"(*(u32 *)src), "m" ((*(struct __large_struct *)((u32 *)dst))), "i" (4), "0" (ret)) ; return ret; case 8:asm volatile("1: mov""q"" %""""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "er"(*(u64 *)src), "m" ((*(struct __large_struct *)((u64 *)dst))), "i" (8), "0" (ret)) ; return ret; case 10: asm volatile("1: mov""q"" %""""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "er"(*(u64 *)src), "m" ((*(struct __large_struct *)((u64 *)dst))), "i" (10), "0" (ret)) ; if (ldv__builtin_expect(!!(ret), 0)) return ret; asm("":::"memory"); asm volatile("1: mov""w"" %""w""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "ir"(4[(u16 *)src]), "m" ((*(struct __large_struct *)(4 + (u16 *)dst))), "i" (2), "0" (ret)) ; return ret; case 16: asm volatile("1: mov""q"" %""""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "er"(*(u64 *)src), "m" ((*(struct __large_struct *)((u64 *)dst))), "i" (16), "0" (ret)) ; if (ldv__builtin_expect(!!(ret), 0)) return ret; asm("":::"memory"); asm volatile("1: mov""q"" %""""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "er"(1[(u64 *)src]), "m" ((*(struct __large_struct *)(1 + (u64 *)dst))), "i" (8), "0" (ret)) ; return ret; default: return copy_user_generic(( void *)dst, src, size); } } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) __attribute__((warn_unused_result)) int __copy_in_user(void *dst, const void *src, unsigned size) { int ret = 0; might_fault(); if (!__builtin_constant_p(size)) return copy_user_generic(( void *)dst, ( void *)src, size); switch (size) { case 1: { u8 tmp; asm volatile("1: mov""b"" %2,%""b""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""b"" %""b""1,%""b""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=q"(tmp) : "m" ((*(struct __large_struct *)((u8 *)src))), "i" (1), "0" (ret)) ; if (ldv__builtin_expect(!!(!ret), 1)) asm volatile("1: mov""b"" %""b""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "iq"(tmp), "m" ((*(struct __large_struct *)((u8 *)dst))), "i" (1), "0" (ret)) ; return ret; } case 2: { u16 tmp; asm volatile("1: mov""w"" %2,%""w""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""w"" %""w""1,%""w""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(tmp) : "m" ((*(struct __large_struct *)((u16 *)src))), "i" (2), "0" (ret)) ; if (ldv__builtin_expect(!!(!ret), 1)) asm volatile("1: mov""w"" %""w""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "ir"(tmp), "m" ((*(struct __large_struct *)((u16 *)dst))), "i" (2), "0" (ret)) ; return ret; } case 4: { u32 tmp; asm volatile("1: mov""l"" %2,%""k""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""l"" %""k""1,%""k""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(tmp) : "m" ((*(struct __large_struct *)((u32 *)src))), "i" (4), "0" (ret)) ; if (ldv__builtin_expect(!!(!ret), 1)) asm volatile("1: mov""l"" %""k""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "ir"(tmp), "m" ((*(struct __large_struct *)((u32 *)dst))), "i" (4), "0" (ret)) ; return ret; } case 8: { u64 tmp; asm volatile("1: mov""q"" %2,%""""1\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " xor""q"" %""""1,%""""1\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r" (ret), "=r"(tmp) : "m" ((*(struct __large_struct *)((u64 *)src))), "i" (8), "0" (ret)) ; if (ldv__builtin_expect(!!(!ret), 1)) asm volatile("1: mov""q"" %""""1,%2\n" "2:\n" ".section .fixup,\"ax\"\n" "3: mov %3,%0\n" " jmp 2b\n" ".previous\n" " .section __ex_table,\"a\"\n" " " ".balign 8" " " "\n" " " ".quad" " " "1b" "," "3b" "\n" " .previous\n" : "=r"(ret) : "er"(tmp), "m" ((*(struct __large_struct *)((u64 *)dst))), "i" (8), "0" (ret)) ; return ret; } default: return copy_user_generic(( void *)dst, ( void *)src, size); } } __attribute__((warn_unused_result)) long strnlen_user(const char *str, long n); __attribute__((warn_unused_result)) long __strnlen_user(const char *str, long n); __attribute__((warn_unused_result)) long strlen_user(const char *str); __attribute__((warn_unused_result)) unsigned long clear_user(void *mem, unsigned long len); __attribute__((warn_unused_result)) unsigned long __clear_user(void *mem, unsigned long len); static __attribute__((warn_unused_result)) inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int __copy_from_user_inatomic(void *dst, const void *src, unsigned size) { return copy_user_generic(dst, ( const void *)src, size); } static __attribute__((warn_unused_result)) inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int __copy_to_user_inatomic(void *dst, const void *src, unsigned size) { return copy_user_generic(( void *)dst, src, size); } extern long __copy_user_nocache(void *dst, const void *src, unsigned size, int zerorest); static inline __attribute__((no_instrument_function)) int __copy_from_user_nocache(void *dst, const void *src, unsigned size) { do { __might_sleep("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/uaccess_64.h", 235, 0); do { } while (0); } while (0); return __copy_user_nocache(dst, src, size, 1); } static inline __attribute__((no_instrument_function)) int __copy_from_user_inatomic_nocache(void *dst, const void *src, unsigned size) { return __copy_user_nocache(dst, src, size, 0); } unsigned long copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest); extern char __brk_base[], __brk_limit[]; extern struct exception_table_entry __stop___ex_table[]; extern char __end_rodata_hpage_align[]; extern void apic_timer_interrupt(void); extern void x86_platform_ipi(void); extern void error_interrupt(void); extern void irq_work_interrupt(void); extern void spurious_interrupt(void); extern void thermal_interrupt(void); extern void reschedule_interrupt(void); extern void invalidate_interrupt(void); extern void invalidate_interrupt0(void); extern void invalidate_interrupt1(void); extern void invalidate_interrupt2(void); extern void invalidate_interrupt3(void); extern void invalidate_interrupt4(void); extern void invalidate_interrupt5(void); extern void invalidate_interrupt6(void); extern void invalidate_interrupt7(void); extern void invalidate_interrupt8(void); extern void invalidate_interrupt9(void); extern void invalidate_interrupt10(void); extern void invalidate_interrupt11(void); extern void invalidate_interrupt12(void); extern void invalidate_interrupt13(void); extern void invalidate_interrupt14(void); extern void invalidate_interrupt15(void); extern void invalidate_interrupt16(void); extern void invalidate_interrupt17(void); extern void invalidate_interrupt18(void); extern void invalidate_interrupt19(void); extern void invalidate_interrupt20(void); extern void invalidate_interrupt21(void); extern void invalidate_interrupt22(void); extern void invalidate_interrupt23(void); extern void invalidate_interrupt24(void); extern void invalidate_interrupt25(void); extern void invalidate_interrupt26(void); extern void invalidate_interrupt27(void); extern void invalidate_interrupt28(void); extern void invalidate_interrupt29(void); extern void invalidate_interrupt30(void); extern void invalidate_interrupt31(void); extern void irq_move_cleanup_interrupt(void); extern void reboot_interrupt(void); extern void threshold_interrupt(void); extern void call_function_interrupt(void); extern void call_function_single_interrupt(void); extern unsigned long io_apic_irqs; extern void init_VISWS_APIC_irqs(void); extern void setup_IO_APIC(void); extern void disable_IO_APIC(void); struct io_apic_irq_attr { int ioapic; int ioapic_pin; int trigger; int polarity; }; static inline __attribute__((no_instrument_function)) void set_io_apic_irq_attr(struct io_apic_irq_attr *irq_attr, int ioapic, int ioapic_pin, int trigger, int polarity) { irq_attr->ioapic = ioapic; irq_attr->ioapic_pin = ioapic_pin; irq_attr->trigger = trigger; irq_attr->polarity = polarity; } struct irq_2_iommu { struct intel_iommu *iommu; u16 irte_index; u16 sub_handle; u8 irte_mask; }; struct irq_cfg { struct irq_pin_list *irq_2_pin; cpumask_var_t domain; cpumask_var_t old_domain; u8 vector; u8 move_in_progress : 1; struct irq_2_iommu irq_2_iommu; }; extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *); extern void send_cleanup_vector(struct irq_cfg *); struct irq_data; int __ioapic_set_affinity(struct irq_data *, const struct cpumask *, unsigned int *dest_id); extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr); extern void setup_ioapic_dest(void); extern void enable_IO_APIC(void); extern atomic_t irq_err_count; extern atomic_t irq_mis_count; extern void eisa_set_level_irq(unsigned int irq); extern void smp_apic_timer_interrupt(struct pt_regs *); extern void smp_spurious_interrupt(struct pt_regs *); extern void smp_x86_platform_ipi(struct pt_regs *); extern void smp_error_interrupt(struct pt_regs *); extern void smp_irq_move_cleanup_interrupt(void); extern void smp_reschedule_interrupt(struct pt_regs *); extern void smp_call_function_interrupt(struct pt_regs *); extern void smp_call_function_single_interrupt(struct pt_regs *); extern void smp_invalidate_interrupt(struct pt_regs *); extern void (*__attribute__ ((__section__(".init.rodata"))) interrupt[256 -0x20])(void); typedef int vector_irq_t[256]; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_vector_irq; extern __attribute__((section(".data..percpu" ""))) __typeof__(vector_irq_t) vector_irq; extern void setup_vector_irq(int cpu); extern void lock_vector_lock(void); extern void unlock_vector_lock(void); extern void __setup_vector_irq(int cpu); struct irqaction; extern int setup_irq(unsigned int irq, struct irqaction *new); extern void remove_irq(unsigned int irq, struct irqaction *act); extern int setup_percpu_irq(unsigned int irq, struct irqaction *new); extern void remove_percpu_irq(unsigned int irq, struct irqaction *act); extern void irq_cpu_online(void); extern void irq_cpu_offline(void); extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); void irq_move_irq(struct irq_data *data); void irq_move_masked_irq(struct irq_data *data); extern int no_irq_affinity; extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc); extern void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc); extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); extern void handle_percpu_devid_irq(unsigned int irq, struct irq_desc *desc); extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); extern void handle_nested_irq(unsigned int irq); extern void note_interrupt(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret); extern int noirqdebug_setup(char *str); extern int can_request_irq(unsigned int irq, unsigned long irqflags); extern struct irq_chip no_irq_chip; extern struct irq_chip dummy_irq_chip; extern void irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, irq_flow_handler_t handle, const char *name); static inline __attribute__((no_instrument_function)) void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *chip, irq_flow_handler_t handle) { irq_set_chip_and_handler_name(irq, chip, handle, ((void *)0)); } extern int irq_set_percpu_devid(unsigned int irq); extern void __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, const char *name); static inline __attribute__((no_instrument_function)) void irq_set_handler(unsigned int irq, irq_flow_handler_t handle) { __irq_set_handler(irq, handle, 0, ((void *)0)); } static inline __attribute__((no_instrument_function)) void irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle) { __irq_set_handler(irq, handle, 1, ((void *)0)); } void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set); static inline __attribute__((no_instrument_function)) void irq_set_status_flags(unsigned int irq, unsigned long set) { irq_modify_status(irq, 0, set); } static inline __attribute__((no_instrument_function)) void irq_clear_status_flags(unsigned int irq, unsigned long clr) { irq_modify_status(irq, clr, 0); } static inline __attribute__((no_instrument_function)) void irq_set_noprobe(unsigned int irq) { irq_modify_status(irq, 0, IRQ_NOPROBE); } static inline __attribute__((no_instrument_function)) void irq_set_probe(unsigned int irq) { irq_modify_status(irq, IRQ_NOPROBE, 0); } static inline __attribute__((no_instrument_function)) void irq_set_nothread(unsigned int irq) { irq_modify_status(irq, 0, IRQ_NOTHREAD); } static inline __attribute__((no_instrument_function)) void irq_set_thread(unsigned int irq) { irq_modify_status(irq, IRQ_NOTHREAD, 0); } static inline __attribute__((no_instrument_function)) void irq_set_nested_thread(unsigned int irq, bool nest) { if (nest) irq_set_status_flags(irq, IRQ_NESTED_THREAD); else irq_clear_status_flags(irq, IRQ_NESTED_THREAD); } static inline __attribute__((no_instrument_function)) void irq_set_percpu_devid_flags(unsigned int irq) { irq_set_status_flags(irq, IRQ_NOAUTOEN | IRQ_PER_CPU | IRQ_NOTHREAD | IRQ_NOPROBE | IRQ_PER_CPU_DEVID); } extern unsigned int create_irq_nr(unsigned int irq_want, int node); extern int create_irq(void); extern void destroy_irq(unsigned int irq); extern void dynamic_irq_cleanup(unsigned int irq); static inline __attribute__((no_instrument_function)) void dynamic_irq_init(unsigned int irq) { dynamic_irq_cleanup(irq); } extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); extern int irq_set_handler_data(unsigned int irq, void *data); extern int irq_set_chip_data(unsigned int irq, void *data); extern int irq_set_irq_type(unsigned int irq, unsigned int type); extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry); extern struct irq_data *irq_get_irq_data(unsigned int irq); static inline __attribute__((no_instrument_function)) struct irq_chip *irq_get_chip(unsigned int irq) { struct irq_data *d = irq_get_irq_data(irq); return d ? d->chip : ((void *)0); } static inline __attribute__((no_instrument_function)) struct irq_chip *irq_data_get_irq_chip(struct irq_data *d) { return d->chip; } static inline __attribute__((no_instrument_function)) void *irq_get_chip_data(unsigned int irq) { struct irq_data *d = irq_get_irq_data(irq); return d ? d->chip_data : ((void *)0); } static inline __attribute__((no_instrument_function)) void *irq_data_get_irq_chip_data(struct irq_data *d) { return d->chip_data; } static inline __attribute__((no_instrument_function)) void *irq_get_handler_data(unsigned int irq) { struct irq_data *d = irq_get_irq_data(irq); return d ? d->handler_data : ((void *)0); } static inline __attribute__((no_instrument_function)) void *irq_data_get_irq_handler_data(struct irq_data *d) { return d->handler_data; } static inline __attribute__((no_instrument_function)) struct msi_desc *irq_get_msi_desc(unsigned int irq) { struct irq_data *d = irq_get_irq_data(irq); return d ? d->msi_desc : ((void *)0); } static inline __attribute__((no_instrument_function)) struct msi_desc *irq_data_get_msi(struct irq_data *d) { return d->msi_desc; } int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node, struct module *owner); void irq_free_descs(unsigned int irq, unsigned int cnt); int irq_reserve_irqs(unsigned int from, unsigned int cnt); static inline __attribute__((no_instrument_function)) void irq_free_desc(unsigned int irq) { irq_free_descs(irq, 1); } static inline __attribute__((no_instrument_function)) int irq_reserve_irq(unsigned int irq) { return irq_reserve_irqs(irq, 1); } struct irq_chip_regs { unsigned long enable; unsigned long disable; unsigned long mask; unsigned long ack; unsigned long eoi; unsigned long type; unsigned long polarity; }; struct irq_chip_type { struct irq_chip chip; struct irq_chip_regs regs; irq_flow_handler_t handler; u32 type; }; struct irq_chip_generic { raw_spinlock_t lock; void *reg_base; unsigned int irq_base; unsigned int irq_cnt; u32 mask_cache; u32 type_cache; u32 polarity_cache; u32 wake_enabled; u32 wake_active; unsigned int num_ct; void *private; struct list_head list; struct irq_chip_type chip_types[0]; }; enum irq_gc_flags { IRQ_GC_INIT_MASK_CACHE = 1 << 0, IRQ_GC_INIT_NESTED_LOCK = 1 << 1, }; void irq_gc_noop(struct irq_data *d); void irq_gc_mask_disable_reg(struct irq_data *d); void irq_gc_mask_set_bit(struct irq_data *d); void irq_gc_mask_clr_bit(struct irq_data *d); void irq_gc_unmask_enable_reg(struct irq_data *d); void irq_gc_ack_set_bit(struct irq_data *d); void irq_gc_ack_clr_bit(struct irq_data *d); void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); void irq_gc_eoi(struct irq_data *d); int irq_gc_set_wake(struct irq_data *d, unsigned int on); struct irq_chip_generic * irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base, void *reg_base, irq_flow_handler_t handler); void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk, enum irq_gc_flags flags, unsigned int clr, unsigned int set); int irq_setup_alt_chip(struct irq_data *d, unsigned int type); void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, unsigned int clr, unsigned int set); static inline __attribute__((no_instrument_function)) struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) { return ({ const typeof( ((struct irq_chip_type *)0)->chip ) *__mptr = (d->chip); (struct irq_chip_type *)( (char *)__mptr - __builtin_offsetof(struct irq_chip_type,chip) );}); } static inline __attribute__((no_instrument_function)) void irq_gc_lock(struct irq_chip_generic *gc) { _raw_spin_lock(&gc->lock); } static inline __attribute__((no_instrument_function)) void irq_gc_unlock(struct irq_chip_generic *gc) { _raw_spin_unlock(&gc->lock); } typedef struct { unsigned int __softirq_pending; unsigned int __nmi_count; unsigned int apic_timer_irqs; unsigned int irq_spurious_count; unsigned int icr_read_retry_count; unsigned int x86_platform_ipis; unsigned int apic_perf_irqs; unsigned int apic_irq_work_irqs; unsigned int irq_resched_count; unsigned int irq_call_count; unsigned int irq_tlb_count; unsigned int irq_thermal_count; unsigned int irq_threshold_count; } __attribute__((__aligned__((1 << (6))))) irq_cpustat_t; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_irq_stat; extern __attribute__((section(".data..percpu" ""))) __typeof__(irq_cpustat_t) irq_stat __attribute__((__aligned__((1 << (6))))); extern void ack_bad_irq(unsigned int irq); extern u64 arch_irq_stat_cpu(unsigned int cpu); extern u64 arch_irq_stat(void); extern void synchronize_irq(unsigned int irq); struct task_struct; extern void account_system_vtime(struct task_struct *tsk); extern void rcu_nmi_enter(void); extern void rcu_nmi_exit(void); extern void irq_enter(void); extern void irq_exit(void); struct rb_node { unsigned long rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } __attribute__((aligned(sizeof(long)))); struct rb_root { struct rb_node *rb_node; }; static inline __attribute__((no_instrument_function)) void rb_set_parent(struct rb_node *rb, struct rb_node *p) { rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p; } static inline __attribute__((no_instrument_function)) void rb_set_color(struct rb_node *rb, int color) { rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; } static inline __attribute__((no_instrument_function)) void rb_init_node(struct rb_node *rb) { rb->rb_parent_color = 0; rb->rb_right = ((void *)0); rb->rb_left = ((void *)0); (rb_set_parent(rb, rb)); } extern void rb_insert_color(struct rb_node *, struct rb_root *); extern void rb_erase(struct rb_node *, struct rb_root *); typedef void (*rb_augment_f)(struct rb_node *node, void *data); extern void rb_augment_insert(struct rb_node *node, rb_augment_f func, void *data); extern struct rb_node *rb_augment_erase_begin(struct rb_node *node); extern void rb_augment_erase_end(struct rb_node *node, rb_augment_f func, void *data); extern struct rb_node *rb_next(const struct rb_node *); extern struct rb_node *rb_prev(const struct rb_node *); extern struct rb_node *rb_first(const struct rb_root *); extern struct rb_node *rb_last(const struct rb_root *); extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root); static inline __attribute__((no_instrument_function)) void rb_link_node(struct rb_node * node, struct rb_node * parent, struct rb_node ** rb_link) { node->rb_parent_color = (unsigned long )parent; node->rb_left = node->rb_right = ((void *)0); *rb_link = node; } struct timerqueue_node { struct rb_node node; ktime_t expires; }; struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; }; extern void timerqueue_add(struct timerqueue_head *head, struct timerqueue_node *node); extern void timerqueue_del(struct timerqueue_head *head, struct timerqueue_node *node); extern struct timerqueue_node *timerqueue_iterate_next( struct timerqueue_node *node); static inline __attribute__((no_instrument_function)) struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head) { return head->next; } static inline __attribute__((no_instrument_function)) void timerqueue_init(struct timerqueue_node *node) { rb_init_node(&node->node); } static inline __attribute__((no_instrument_function)) void timerqueue_init_head(struct timerqueue_head *head) { head->head = (struct rb_root) { ((void *)0), }; head->next = ((void *)0); } struct hrtimer_clock_base; struct hrtimer_cpu_base; enum hrtimer_mode { HRTIMER_MODE_ABS = 0x0, HRTIMER_MODE_REL = 0x1, HRTIMER_MODE_PINNED = 0x02, HRTIMER_MODE_ABS_PINNED = 0x02, HRTIMER_MODE_REL_PINNED = 0x03, }; enum hrtimer_restart { HRTIMER_NORESTART, HRTIMER_RESTART, }; struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; unsigned long state; int start_pid; void *start_site; char start_comm[16]; }; struct hrtimer_sleeper { struct hrtimer timer; struct task_struct *task; }; struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t resolution; ktime_t (*get_time)(void); ktime_t softirq_time; ktime_t offset; }; enum hrtimer_base_type { HRTIMER_BASE_MONOTONIC, HRTIMER_BASE_REALTIME, HRTIMER_BASE_BOOTTIME, HRTIMER_MAX_CLOCK_BASES, }; struct hrtimer_cpu_base { raw_spinlock_t lock; unsigned long active_bases; ktime_t expires_next; int hres_active; int hang_detected; unsigned long nr_events; unsigned long nr_retries; unsigned long nr_hangs; ktime_t max_hang_time; struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; }; static inline __attribute__((no_instrument_function)) void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) { timer->node.expires = time; timer->_softexpires = time; } static inline __attribute__((no_instrument_function)) void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta) { timer->_softexpires = time; timer->node.expires = ktime_add_safe(time, delta); } static inline __attribute__((no_instrument_function)) void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta) { timer->_softexpires = time; timer->node.expires = ktime_add_safe(time, ns_to_ktime(delta)); } static inline __attribute__((no_instrument_function)) void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) { timer->node.expires.tv64 = tv64; timer->_softexpires.tv64 = tv64; } static inline __attribute__((no_instrument_function)) void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) { timer->node.expires = ktime_add_safe(timer->node.expires, time); timer->_softexpires = ktime_add_safe(timer->_softexpires, time); } static inline __attribute__((no_instrument_function)) void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns) { timer->node.expires = ({ (ktime_t){ .tv64 = (timer->node.expires).tv64 + (ns) }; }); timer->_softexpires = ({ (ktime_t){ .tv64 = (timer->_softexpires).tv64 + (ns) }; }); } static inline __attribute__((no_instrument_function)) ktime_t hrtimer_get_expires(const struct hrtimer *timer) { return timer->node.expires; } static inline __attribute__((no_instrument_function)) ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) { return timer->_softexpires; } static inline __attribute__((no_instrument_function)) s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) { return timer->node.expires.tv64; } static inline __attribute__((no_instrument_function)) s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) { return timer->_softexpires.tv64; } static inline __attribute__((no_instrument_function)) s64 hrtimer_get_expires_ns(const struct hrtimer *timer) { return ((timer->node.expires).tv64); } static inline __attribute__((no_instrument_function)) ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) { return ({ (ktime_t){ .tv64 = (timer->node.expires).tv64 - (timer->base->get_time()).tv64 }; }); } struct clock_event_device; extern void hrtimer_interrupt(struct clock_event_device *dev); static inline __attribute__((no_instrument_function)) ktime_t hrtimer_cb_get_time(struct hrtimer *timer) { return timer->base->get_time(); } static inline __attribute__((no_instrument_function)) int hrtimer_is_hres_active(struct hrtimer *timer) { return timer->base->cpu_base->hres_active; } extern void hrtimer_peek_ahead_timers(void); extern void clock_was_set(void); extern void timerfd_clock_was_set(void); extern void hrtimers_resume(void); extern ktime_t ktime_get(void); extern ktime_t ktime_get_real(void); extern ktime_t ktime_get_boottime(void); extern ktime_t ktime_get_monotonic_offset(void); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_tick_cpu_device; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct tick_device) tick_cpu_device; extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); extern void destroy_hrtimer_on_stack(struct hrtimer *timer); extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode); extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, unsigned long range_ns, const enum hrtimer_mode mode); extern int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, unsigned long delta_ns, const enum hrtimer_mode mode, int wakeup); extern int hrtimer_cancel(struct hrtimer *timer); extern int hrtimer_try_to_cancel(struct hrtimer *timer); static inline __attribute__((no_instrument_function)) int hrtimer_start_expires(struct hrtimer *timer, enum hrtimer_mode mode) { unsigned long delta; ktime_t soft, hard; soft = hrtimer_get_softexpires(timer); hard = hrtimer_get_expires(timer); delta = ((({ (ktime_t){ .tv64 = (hard).tv64 - (soft).tv64 }; })).tv64); return hrtimer_start_range_ns(timer, soft, delta, mode); } static inline __attribute__((no_instrument_function)) int hrtimer_restart(struct hrtimer *timer) { return hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp); extern ktime_t hrtimer_get_next_event(void); static inline __attribute__((no_instrument_function)) int hrtimer_active(const struct hrtimer *timer) { return timer->state != 0x00; } static inline __attribute__((no_instrument_function)) int hrtimer_is_queued(struct hrtimer *timer) { return timer->state & 0x01; } static inline __attribute__((no_instrument_function)) int hrtimer_callback_running(struct hrtimer *timer) { return timer->state & 0x02; } extern u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); static inline __attribute__((no_instrument_function)) u64 hrtimer_forward_now(struct hrtimer *timer, ktime_t interval) { return hrtimer_forward(timer, timer->base->get_time(), interval); } extern long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp, const enum hrtimer_mode mode, const clockid_t clockid); extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *tsk); extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode); extern int schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode, int clock); extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); extern void hrtimer_run_queues(void); extern void hrtimer_run_pending(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) hrtimers_init(void); extern void sysrq_timer_list_show(void); struct kref { atomic_t refcount; }; static inline __attribute__((no_instrument_function)) void kref_init(struct kref *kref) { atomic_set(&kref->refcount, 1); } static inline __attribute__((no_instrument_function)) void kref_get(struct kref *kref) { ({ int __ret_warn_on = !!(!atomic_read(&kref->refcount)); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/kref.h", 41); ldv__builtin_expect(!!(__ret_warn_on), 0); }); atomic_inc(&kref->refcount); } static inline __attribute__((no_instrument_function)) int kref_sub(struct kref *kref, unsigned int count, void (*release)(struct kref *kref)) { ({ int __ret_warn_on = !!(release == ((void *)0)); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/kref.h", 66); ldv__builtin_expect(!!(__ret_warn_on), 0); }); if (atomic_sub_and_test((int) count, &kref->refcount)) { release(kref); return 1; } return 0; } static inline __attribute__((no_instrument_function)) int kref_put(struct kref *kref, void (*release)(struct kref *kref)) { return kref_sub(kref, 1, release); } enum { IRQC_IS_HARDIRQ = 0, IRQC_IS_NESTED, }; typedef irqreturn_t (*irq_handler_t)(int, void *); struct irqaction { irq_handler_t handler; unsigned long flags; void *dev_id; void *percpu_dev_id; struct irqaction *next; int irq; irq_handler_t thread_fn; struct task_struct *thread; unsigned long thread_flags; unsigned long thread_mask; const char *name; struct proc_dir_entry *dir; } __attribute__((__aligned__(1 << (12)))); extern irqreturn_t no_action(int cpl, void *dev_id); extern int __attribute__((warn_unused_result)) request_threaded_irq(unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, unsigned long flags, const char *name, void *dev); static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev) { return request_threaded_irq(irq, handler, ((void *)0), flags, name, dev); } extern int __attribute__((warn_unused_result)) request_any_context_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev_id); extern int __attribute__((warn_unused_result)) request_percpu_irq(unsigned int irq, irq_handler_t handler, const char *devname, void *percpu_dev_id); extern void exit_irq_thread(void); extern void free_irq(unsigned int, void *); extern void free_percpu_irq(unsigned int, void *); struct device; extern int __attribute__((warn_unused_result)) devm_request_threaded_irq(struct device *dev, unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, unsigned long irqflags, const char *devname, void *dev_id); static inline __attribute__((no_instrument_function)) int __attribute__((warn_unused_result)) devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id) { return devm_request_threaded_irq(dev, irq, handler, ((void *)0), irqflags, devname, dev_id); } extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); extern void disable_irq_nosync(unsigned int irq); extern void disable_irq(unsigned int irq); extern void disable_percpu_irq(unsigned int irq); extern void enable_irq(unsigned int irq); extern void enable_percpu_irq(unsigned int irq, unsigned int type); extern void suspend_device_irqs(void); extern void resume_device_irqs(void); extern int check_wakeup_irqs(void); extern cpumask_var_t irq_default_affinity; extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); extern int irq_can_set_affinity(unsigned int irq); extern int irq_select_affinity(unsigned int irq); extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); struct irq_affinity_notify { unsigned int irq; struct kref kref; struct work_struct work; void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask); void (*release)(struct kref *ref); }; extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); static inline __attribute__((no_instrument_function)) void irq_run_affinity_notifiers(void) { flush_scheduled_work(); } static inline __attribute__((no_instrument_function)) void disable_irq_nosync_lockdep(unsigned int irq) { disable_irq_nosync(irq); } static inline __attribute__((no_instrument_function)) void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags) { disable_irq_nosync(irq); } static inline __attribute__((no_instrument_function)) void disable_irq_lockdep(unsigned int irq) { disable_irq(irq); } static inline __attribute__((no_instrument_function)) void enable_irq_lockdep(unsigned int irq) { enable_irq(irq); } static inline __attribute__((no_instrument_function)) void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags) { enable_irq(irq); } extern int irq_set_irq_wake(unsigned int irq, unsigned int on); static inline __attribute__((no_instrument_function)) int enable_irq_wake(unsigned int irq) { return irq_set_irq_wake(irq, 1); } static inline __attribute__((no_instrument_function)) int disable_irq_wake(unsigned int irq) { return irq_set_irq_wake(irq, 0); } extern bool force_irqthreads; enum { HI_SOFTIRQ=0, TIMER_SOFTIRQ, NET_TX_SOFTIRQ, NET_RX_SOFTIRQ, BLOCK_SOFTIRQ, BLOCK_IOPOLL_SOFTIRQ, TASKLET_SOFTIRQ, SCHED_SOFTIRQ, HRTIMER_SOFTIRQ, RCU_SOFTIRQ, NR_SOFTIRQS }; extern char *softirq_to_name[NR_SOFTIRQS]; struct softirq_action { void (*action)(struct softirq_action *); }; void do_softirq(void); void __do_softirq(void); extern void open_softirq(int nr, void (*action)(struct softirq_action *)); extern void softirq_init(void); extern void __raise_softirq_irqoff(unsigned int nr); extern void raise_softirq_irqoff(unsigned int nr); extern void raise_softirq(unsigned int nr); extern __attribute__((section(".discard"), unused)) char __pcpu_scope_softirq_work_list; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct list_head [NR_SOFTIRQS]) softirq_work_list; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_ksoftirqd; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct task_struct *) ksoftirqd; static inline __attribute__((no_instrument_function)) struct task_struct *this_cpu_ksoftirqd(void) { return ({ typeof((ksoftirqd)) pscr_ret__; do { const void *__vpp_verify = (typeof(&((ksoftirqd))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof((ksoftirqd))) { case 1: pscr_ret__ = ({ typeof(((ksoftirqd))) pfo_ret__; switch (sizeof(((ksoftirqd)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((ksoftirqd))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 2: pscr_ret__ = ({ typeof(((ksoftirqd))) pfo_ret__; switch (sizeof(((ksoftirqd)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((ksoftirqd))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 4: pscr_ret__ = ({ typeof(((ksoftirqd))) pfo_ret__; switch (sizeof(((ksoftirqd)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((ksoftirqd))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; default: __bad_percpu_size(); } pfo_ret__; });break; case 8: pscr_ret__ = ({ typeof(((ksoftirqd))) pfo_ret__; switch (sizeof(((ksoftirqd)))) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m"((ksoftirqd))); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m"((ksoftirqd))); break; default: __bad_percpu_size(); } pfo_ret__; });break; default: __bad_size_call_parameter();break; } pscr_ret__; }); } extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq); extern void __send_remote_softirq(struct call_single_data *cp, int cpu, int this_cpu, int softirq); struct tasklet_struct { struct tasklet_struct *next; unsigned long state; atomic_t count; void (*func)(unsigned long); unsigned long data; }; enum { TASKLET_STATE_SCHED, TASKLET_STATE_RUN }; static inline __attribute__((no_instrument_function)) int tasklet_trylock(struct tasklet_struct *t) { return !test_and_set_bit(TASKLET_STATE_RUN, &(t)->state); } static inline __attribute__((no_instrument_function)) void tasklet_unlock(struct tasklet_struct *t) { __asm__ __volatile__("": : :"memory"); clear_bit(TASKLET_STATE_RUN, &(t)->state); } static inline __attribute__((no_instrument_function)) void tasklet_unlock_wait(struct tasklet_struct *t) { while ((__builtin_constant_p((TASKLET_STATE_RUN)) ? constant_test_bit((TASKLET_STATE_RUN), (&(t)->state)) : variable_test_bit((TASKLET_STATE_RUN), (&(t)->state)))) { __asm__ __volatile__("": : :"memory"); } } extern void __tasklet_schedule(struct tasklet_struct *t); static inline __attribute__((no_instrument_function)) void tasklet_schedule(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) __tasklet_schedule(t); } extern void __tasklet_hi_schedule(struct tasklet_struct *t); static inline __attribute__((no_instrument_function)) void tasklet_hi_schedule(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) __tasklet_hi_schedule(t); } extern void __tasklet_hi_schedule_first(struct tasklet_struct *t); static inline __attribute__((no_instrument_function)) void tasklet_hi_schedule_first(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) __tasklet_hi_schedule_first(t); } static inline __attribute__((no_instrument_function)) void tasklet_disable_nosync(struct tasklet_struct *t) { atomic_inc(&t->count); __asm__ __volatile__("": : :"memory"); } static inline __attribute__((no_instrument_function)) void tasklet_disable(struct tasklet_struct *t) { tasklet_disable_nosync(t); tasklet_unlock_wait(t); asm volatile("mfence":::"memory"); } static inline __attribute__((no_instrument_function)) void tasklet_enable(struct tasklet_struct *t) { __asm__ __volatile__("": : :"memory"); atomic_dec(&t->count); } static inline __attribute__((no_instrument_function)) void tasklet_hi_enable(struct tasklet_struct *t) { __asm__ __volatile__("": : :"memory"); atomic_dec(&t->count); } extern void tasklet_kill(struct tasklet_struct *t); extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu); extern void tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data); struct tasklet_hrtimer { struct hrtimer timer; struct tasklet_struct tasklet; enum hrtimer_restart (*function)(struct hrtimer *); }; extern void tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer, enum hrtimer_restart (*function)(struct hrtimer *), clockid_t which_clock, enum hrtimer_mode mode); static inline __attribute__((no_instrument_function)) int tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time, const enum hrtimer_mode mode) { return hrtimer_start(&ttimer->timer, time, mode); } static inline __attribute__((no_instrument_function)) void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer) { hrtimer_cancel(&ttimer->timer); tasklet_kill(&ttimer->tasklet); } extern unsigned long probe_irq_on(void); extern int probe_irq_off(unsigned long); extern unsigned int probe_irq_mask(unsigned long); extern void init_irq_proc(void); struct seq_file; int show_interrupts(struct seq_file *p, void *v); int arch_show_interrupts(struct seq_file *p, int prec); extern int early_irq_init(void); extern int arch_probe_nr_irqs(void); extern int arch_early_irq_init(void); struct sock; struct kobject; enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET, KOBJ_NS_TYPES }; struct kobj_ns_type_operations { enum kobj_ns_type type; void *(*grab_current_ns)(void); const void *(*netlink_ns)(struct sock *sk); const void *(*initial_ns)(void); void (*drop_ns)(void *); }; int kobj_ns_type_register(const struct kobj_ns_type_operations *ops); int kobj_ns_type_registered(enum kobj_ns_type type); const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); void *kobj_ns_grab_current(enum kobj_ns_type type); const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); const void *kobj_ns_initial(enum kobj_ns_type type); void kobj_ns_drop(enum kobj_ns_type type, void *ns); struct kobject; struct module; enum kobj_ns_type; struct attribute { const char *name; umode_t mode; }; struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); struct attribute **attrs; }; struct file; struct vm_area_struct; struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t, size_t); ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, char *, loff_t, size_t); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, struct vm_area_struct *vma); }; struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); const void *(*namespace)(struct kobject *, const struct attribute *); }; struct sysfs_dirent; int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), void *data, struct module *owner); int __attribute__((warn_unused_result)) sysfs_create_dir(struct kobject *kobj); void sysfs_remove_dir(struct kobject *kobj); int __attribute__((warn_unused_result)) sysfs_rename_dir(struct kobject *kobj, const char *new_name); int __attribute__((warn_unused_result)) sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj); int __attribute__((warn_unused_result)) sysfs_create_file(struct kobject *kobj, const struct attribute *attr); int __attribute__((warn_unused_result)) sysfs_create_files(struct kobject *kobj, const struct attribute **attr); int __attribute__((warn_unused_result)) sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, umode_t mode); void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); int __attribute__((warn_unused_result)) sysfs_create_bin_file(struct kobject *kobj, const struct bin_attribute *attr); void sysfs_remove_bin_file(struct kobject *kobj, const struct bin_attribute *attr); int __attribute__((warn_unused_result)) sysfs_create_link(struct kobject *kobj, struct kobject *target, const char *name); int __attribute__((warn_unused_result)) sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, const char *name); void sysfs_remove_link(struct kobject *kobj, const char *name); int sysfs_rename_link(struct kobject *kobj, struct kobject *target, const char *old_name, const char *new_name); void sysfs_delete_link(struct kobject *dir, struct kobject *targ, const char *name); int __attribute__((warn_unused_result)) sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp); int sysfs_update_group(struct kobject *kobj, const struct attribute_group *grp); void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp); int sysfs_add_file_to_group(struct kobject *kobj, const struct attribute *attr, const char *group); void sysfs_remove_file_from_group(struct kobject *kobj, const struct attribute *attr, const char *group); int sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp); void sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp); void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); void sysfs_notify_dirent(struct sysfs_dirent *sd); struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, const void *ns, const unsigned char *name); struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); void sysfs_put(struct sysfs_dirent *sd); int __attribute__((warn_unused_result)) sysfs_init(void); extern char uevent_helper[]; extern u64 uevent_seqnum; enum kobject_action { KOBJ_ADD, KOBJ_REMOVE, KOBJ_CHANGE, KOBJ_MOVE, KOBJ_ONLINE, KOBJ_OFFLINE, KOBJ_MAX }; struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct sysfs_dirent *sd; struct kref kref; unsigned int state_initialized:1; unsigned int state_in_sysfs:1; unsigned int state_add_uevent_sent:1; unsigned int state_remove_uevent_sent:1; unsigned int uevent_suppress:1; }; extern __attribute__((format(printf, 2, 3))) int kobject_set_name(struct kobject *kobj, const char *name, ...); extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs); static inline __attribute__((no_instrument_function)) const char *kobject_name(const struct kobject *kobj) { return kobj->name; } extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); extern __attribute__((format(printf, 3, 4))) __attribute__((warn_unused_result)) int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...); extern __attribute__((format(printf, 4, 5))) __attribute__((warn_unused_result)) int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...); extern void kobject_del(struct kobject *kobj); extern struct kobject * __attribute__((warn_unused_result)) kobject_create(void); extern struct kobject * __attribute__((warn_unused_result)) kobject_create_and_add(const char *name, struct kobject *parent); extern int __attribute__((warn_unused_result)) kobject_rename(struct kobject *, const char *new_name); extern int __attribute__((warn_unused_result)) kobject_move(struct kobject *, struct kobject *); extern struct kobject *kobject_get(struct kobject *kobj); extern void kobject_put(struct kobject *kobj); extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); struct kobj_type { void (*release)(struct kobject *kobj); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); const void *(*namespace)(struct kobject *kobj); }; struct kobj_uevent_env { char *envp[32]; int envp_idx; char buf[2048]; int buflen; }; struct kset_uevent_ops { int (* const filter)(struct kset *kset, struct kobject *kobj); const char *(* const name)(struct kset *kset, struct kobject *kobj); int (* const uevent)(struct kset *kset, struct kobject *kobj, struct kobj_uevent_env *env); }; struct kobj_attribute { struct attribute attr; ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf); ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); }; extern const struct sysfs_ops kobj_sysfs_ops; struct sock; struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; }; extern void kset_init(struct kset *kset); extern int __attribute__((warn_unused_result)) kset_register(struct kset *kset); extern void kset_unregister(struct kset *kset); extern struct kset * __attribute__((warn_unused_result)) kset_create_and_add(const char *name, const struct kset_uevent_ops *u, struct kobject *parent_kobj); static inline __attribute__((no_instrument_function)) struct kset *to_kset(struct kobject *kobj) { return kobj ? ({ const typeof( ((struct kset *)0)->kobj ) *__mptr = (kobj); (struct kset *)( (char *)__mptr - __builtin_offsetof(struct kset,kobj) );}) : ((void *)0); } static inline __attribute__((no_instrument_function)) struct kset *kset_get(struct kset *k) { return k ? to_kset(kobject_get(&k->kobj)) : ((void *)0); } static inline __attribute__((no_instrument_function)) void kset_put(struct kset *k) { kobject_put(&k->kobj); } static inline __attribute__((no_instrument_function)) struct kobj_type *get_ktype(struct kobject *kobj) { return kobj->ktype; } extern struct kobject *kset_find_obj(struct kset *, const char *); extern struct kobject *kernel_kobj; extern struct kobject *mm_kobj; extern struct kobject *hypervisor_kobj; extern struct kobject *power_kobj; extern struct kobject *firmware_kobj; int kobject_uevent(struct kobject *kobj, enum kobject_action action); int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp[]); __attribute__((format(printf, 2, 3))) int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); int kobject_action_type(const char *buf, size_t count, enum kobject_action *type); struct klist_node; struct klist { spinlock_t k_lock; struct list_head k_list; void (*get)(struct klist_node *); void (*put)(struct klist_node *); } __attribute__ ((aligned (sizeof(void *)))); extern void klist_init(struct klist *k, void (*get)(struct klist_node *), void (*put)(struct klist_node *)); struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; }; extern void klist_add_tail(struct klist_node *n, struct klist *k); extern void klist_add_head(struct klist_node *n, struct klist *k); extern void klist_add_after(struct klist_node *n, struct klist_node *pos); extern void klist_add_before(struct klist_node *n, struct klist_node *pos); extern void klist_del(struct klist_node *n); extern void klist_remove(struct klist_node *n); extern int klist_node_attached(struct klist_node *n); struct klist_iter { struct klist *i_klist; struct klist_node *i_cur; }; extern void klist_iter_init(struct klist *k, struct klist_iter *i); extern void klist_iter_init_node(struct klist *k, struct klist_iter *i, struct klist_node *n); extern void klist_iter_exit(struct klist_iter *i); extern struct klist_node *klist_next(struct klist_iter *i); struct dev_archdata { void *acpi_handle; struct dma_map_ops *dma_ops; void *iommu; }; struct pdev_archdata { }; struct device; struct device_private; struct device_driver; struct driver_private; struct module; struct class; struct subsys_private; struct bus_type; struct device_node; struct iommu_ops; struct bus_attribute { struct attribute attr; ssize_t (*show)(struct bus_type *bus, char *buf); ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); }; extern int __attribute__((warn_unused_result)) bus_create_file(struct bus_type *, struct bus_attribute *); extern void bus_remove_file(struct bus_type *, struct bus_attribute *); struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct bus_attribute *bus_attrs; struct device_attribute *dev_attrs; struct driver_attribute *drv_attrs; int (*match)(struct device *dev, struct device_driver *drv); int (*uevent)(struct device *dev, struct kobj_uevent_env *env); int (*probe)(struct device *dev); int (*remove)(struct device *dev); void (*shutdown)(struct device *dev); int (*suspend)(struct device *dev, pm_message_t state); int (*resume)(struct device *dev); const struct dev_pm_ops *pm; struct iommu_ops *iommu_ops; struct subsys_private *p; }; extern int __attribute__((warn_unused_result)) __bus_register(struct bus_type *bus, struct lock_class_key *key); extern void bus_unregister(struct bus_type *bus); extern int __attribute__((warn_unused_result)) bus_rescan_devices(struct bus_type *bus); struct subsys_dev_iter { struct klist_iter ki; const struct device_type *type; }; void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys, struct device *start, const struct device_type *type); struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); struct device *bus_find_device(struct bus_type *bus, struct device *start, void *data, int (*match)(struct device *dev, void *data)); struct device *bus_find_device_by_name(struct bus_type *bus, struct device *start, const char *name); struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, void *data, int (*fn)(struct device_driver *, void *)); void bus_sort_breadthfirst(struct bus_type *bus, int (*compare)(const struct device *a, const struct device *b)); struct notifier_block; extern int bus_register_notifier(struct bus_type *bus, struct notifier_block *nb); extern int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb); extern struct kset *bus_get_kset(struct bus_type *bus); extern struct klist *bus_get_device_klist(struct bus_type *bus); struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; const struct of_device_id *of_match_table; int (*probe) (struct device *dev); int (*remove) (struct device *dev); void (*shutdown) (struct device *dev); int (*suspend) (struct device *dev, pm_message_t state); int (*resume) (struct device *dev); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; }; extern int __attribute__((warn_unused_result)) driver_register(struct device_driver *drv); extern void driver_unregister(struct device_driver *drv); extern struct device_driver *driver_find(const char *name, struct bus_type *bus); extern int driver_probe_done(void); extern void wait_for_device_probe(void); struct driver_attribute { struct attribute attr; ssize_t (*show)(struct device_driver *driver, char *buf); ssize_t (*store)(struct device_driver *driver, const char *buf, size_t count); }; extern int __attribute__((warn_unused_result)) driver_create_file(struct device_driver *driver, const struct driver_attribute *attr); extern void driver_remove_file(struct device_driver *driver, const struct driver_attribute *attr); extern int __attribute__((warn_unused_result)) driver_for_each_device(struct device_driver *drv, struct device *start, void *data, int (*fn)(struct device *dev, void *)); struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, void *data)); struct subsys_interface { const char *name; struct bus_type *subsys; struct list_head node; int (*add_dev)(struct device *dev, struct subsys_interface *sif); int (*remove_dev)(struct device *dev, struct subsys_interface *sif); }; int subsys_interface_register(struct subsys_interface *sif); void subsys_interface_unregister(struct subsys_interface *sif); int subsys_system_register(struct bus_type *subsys, const struct attribute_group **groups); struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; struct device_attribute *dev_attrs; struct bin_attribute *dev_bin_attrs; struct kobject *dev_kobj; int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); char *(*devnode)(struct device *dev, umode_t *mode); void (*class_release)(struct class *class); void (*dev_release)(struct device *dev); int (*suspend)(struct device *dev, pm_message_t state); int (*resume)(struct device *dev); const struct kobj_ns_type_operations *ns_type; const void *(*namespace)(struct device *dev); const struct dev_pm_ops *pm; struct subsys_private *p; }; struct class_dev_iter { struct klist_iter ki; const struct device_type *type; }; extern struct kobject *sysfs_dev_block_kobj; extern struct kobject *sysfs_dev_char_kobj; extern int __attribute__((warn_unused_result)) __class_register(struct class *class, struct lock_class_key *key); extern void class_unregister(struct class *class); struct class_compat; struct class_compat *class_compat_register(const char *name); void class_compat_unregister(struct class_compat *cls); int class_compat_create_link(struct class_compat *cls, struct device *dev, struct device *device_link); void class_compat_remove_link(struct class_compat *cls, struct device *dev, struct device *device_link); extern void class_dev_iter_init(struct class_dev_iter *iter, struct class *class, struct device *start, const struct device_type *type); extern struct device *class_dev_iter_next(struct class_dev_iter *iter); extern void class_dev_iter_exit(struct class_dev_iter *iter); extern int class_for_each_device(struct class *class, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); extern struct device *class_find_device(struct class *class, struct device *start, void *data, int (*match)(struct device *, void *)); struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *class, struct class_attribute *attr, char *buf); ssize_t (*store)(struct class *class, struct class_attribute *attr, const char *buf, size_t count); const void *(*namespace)(struct class *class, const struct class_attribute *attr); }; extern int __attribute__((warn_unused_result)) class_create_file(struct class *class, const struct class_attribute *attr); extern void class_remove_file(struct class *class, const struct class_attribute *attr); struct class_attribute_string { struct class_attribute attr; char *str; }; extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, char *buf); struct class_interface { struct list_head node; struct class *class; int (*add_dev) (struct device *, struct class_interface *); void (*remove_dev) (struct device *, struct class_interface *); }; extern int __attribute__((warn_unused_result)) class_interface_register(struct class_interface *); extern void class_interface_unregister(struct class_interface *); extern struct class * __attribute__((warn_unused_result)) __class_create(struct module *owner, const char *name, struct lock_class_key *key); extern void class_destroy(struct class *cls); struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *dev, struct kobj_uevent_env *env); char *(*devnode)(struct device *dev, umode_t *mode); void (*release)(struct device *dev); const struct dev_pm_ops *pm; }; struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf); ssize_t (*store)(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); }; struct dev_ext_attribute { struct device_attribute attr; void *var; }; ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, char *buf); ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); ssize_t device_show_int(struct device *dev, struct device_attribute *attr, char *buf); ssize_t device_store_int(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); extern int device_create_file(struct device *device, const struct device_attribute *entry); extern void device_remove_file(struct device *dev, const struct device_attribute *attr); extern int __attribute__((warn_unused_result)) device_create_bin_file(struct device *dev, const struct bin_attribute *attr); extern void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr); extern int device_schedule_callback_owner(struct device *dev, void (*func)(struct device *dev), struct module *owner); typedef void (*dr_release_t)(struct device *dev, void *res); typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp, const char *name); extern void devres_free(void *res); extern void devres_add(struct device *dev, void *res); extern void *devres_find(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); extern void *devres_get(struct device *dev, void *new_res, dr_match_t match, void *match_data); extern void *devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); extern int devres_destroy(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); extern void * __attribute__((warn_unused_result)) devres_open_group(struct device *dev, void *id, gfp_t gfp); extern void devres_close_group(struct device *dev, void *id); extern void devres_remove_group(struct device *dev, void *id); extern int devres_release_group(struct device *dev, void *id); extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); extern void devm_kfree(struct device *dev, void *p); void *devm_request_and_ioremap(struct device *dev, struct resource *res); struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; }; struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; struct dev_pm_info power; struct dev_pm_domain *pm_domain; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct dev_archdata archdata; struct device_node *of_node; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *dev); }; struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long hit_count; unsigned int active:1; }; static inline __attribute__((no_instrument_function)) bool device_can_wakeup(struct device *dev) { return dev->power.can_wakeup; } static inline __attribute__((no_instrument_function)) bool device_may_wakeup(struct device *dev) { return dev->power.can_wakeup && !!dev->power.wakeup; } extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name); extern struct wakeup_source *wakeup_source_create(const char *name); extern void wakeup_source_drop(struct wakeup_source *ws); extern void wakeup_source_destroy(struct wakeup_source *ws); extern void wakeup_source_add(struct wakeup_source *ws); extern void wakeup_source_remove(struct wakeup_source *ws); extern struct wakeup_source *wakeup_source_register(const char *name); extern void wakeup_source_unregister(struct wakeup_source *ws); extern int device_wakeup_enable(struct device *dev); extern int device_wakeup_disable(struct device *dev); extern void device_set_wakeup_capable(struct device *dev, bool capable); extern int device_init_wakeup(struct device *dev, bool val); extern int device_set_wakeup_enable(struct device *dev, bool enable); extern void __pm_stay_awake(struct wakeup_source *ws); extern void pm_stay_awake(struct device *dev); extern void __pm_relax(struct wakeup_source *ws); extern void pm_relax(struct device *dev); extern void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec); extern void pm_wakeup_event(struct device *dev, unsigned int msec); static inline __attribute__((no_instrument_function)) void wakeup_source_init(struct wakeup_source *ws, const char *name) { wakeup_source_prepare(ws, name); wakeup_source_add(ws); } static inline __attribute__((no_instrument_function)) void wakeup_source_trash(struct wakeup_source *ws) { wakeup_source_remove(ws); wakeup_source_drop(ws); } static inline __attribute__((no_instrument_function)) const char *dev_name(const struct device *dev) { if (dev->init_name) return dev->init_name; return kobject_name(&dev->kobj); } extern __attribute__((format(printf, 2, 3))) int dev_set_name(struct device *dev, const char *name, ...); static inline __attribute__((no_instrument_function)) int dev_to_node(struct device *dev) { return dev->numa_node; } static inline __attribute__((no_instrument_function)) void set_dev_node(struct device *dev, int node) { dev->numa_node = node; } static inline __attribute__((no_instrument_function)) struct pm_subsys_data *dev_to_psd(struct device *dev) { return dev ? dev->power.subsys_data : ((void *)0); } static inline __attribute__((no_instrument_function)) unsigned int dev_get_uevent_suppress(const struct device *dev) { return dev->kobj.uevent_suppress; } static inline __attribute__((no_instrument_function)) void dev_set_uevent_suppress(struct device *dev, int val) { dev->kobj.uevent_suppress = val; } static inline __attribute__((no_instrument_function)) int device_is_registered(struct device *dev) { return dev->kobj.state_in_sysfs; } static inline __attribute__((no_instrument_function)) void device_enable_async_suspend(struct device *dev) { if (!dev->power.is_prepared) dev->power.async_suspend = true; } static inline __attribute__((no_instrument_function)) void device_disable_async_suspend(struct device *dev) { if (!dev->power.is_prepared) dev->power.async_suspend = false; } static inline __attribute__((no_instrument_function)) bool device_async_suspend_enabled(struct device *dev) { return !!dev->power.async_suspend; } static inline __attribute__((no_instrument_function)) void pm_suspend_ignore_children(struct device *dev, bool enable) { dev->power.ignore_children = enable; } static inline __attribute__((no_instrument_function)) void device_lock(struct device *dev) { mutex_lock(&dev->mutex); } static inline __attribute__((no_instrument_function)) int device_trylock(struct device *dev) { return mutex_trylock(&dev->mutex); } static inline __attribute__((no_instrument_function)) void device_unlock(struct device *dev) { mutex_unlock(&dev->mutex); } void driver_init(void); extern int __attribute__((warn_unused_result)) device_register(struct device *dev); extern void device_unregister(struct device *dev); extern void device_initialize(struct device *dev); extern int __attribute__((warn_unused_result)) device_add(struct device *dev); extern void device_del(struct device *dev); extern int device_for_each_child(struct device *dev, void *data, int (*fn)(struct device *dev, void *data)); extern struct device *device_find_child(struct device *dev, void *data, int (*match)(struct device *dev, void *data)); extern int device_rename(struct device *dev, const char *new_name); extern int device_move(struct device *dev, struct device *new_parent, enum dpm_order dpm_order); extern const char *device_get_devnode(struct device *dev, umode_t *mode, const char **tmp); extern void *dev_get_drvdata(const struct device *dev); extern int dev_set_drvdata(struct device *dev, void *data); extern struct device *__root_device_register(const char *name, struct module *owner); extern void root_device_unregister(struct device *root); static inline __attribute__((no_instrument_function)) void *dev_get_platdata(const struct device *dev) { return dev->platform_data; } extern int __attribute__((warn_unused_result)) device_bind_driver(struct device *dev); extern void device_release_driver(struct device *dev); extern int __attribute__((warn_unused_result)) device_attach(struct device *dev); extern int __attribute__((warn_unused_result)) driver_attach(struct device_driver *drv); extern int __attribute__((warn_unused_result)) device_reprobe(struct device *dev); extern struct device *device_create_vargs(struct class *cls, struct device *parent, dev_t devt, void *drvdata, const char *fmt, va_list vargs); extern __attribute__((format(printf, 5, 6))) struct device *device_create(struct class *cls, struct device *parent, dev_t devt, void *drvdata, const char *fmt, ...); extern void device_destroy(struct class *cls, dev_t devt); extern int (*platform_notify)(struct device *dev); extern int (*platform_notify_remove)(struct device *dev); extern struct device *get_device(struct device *dev); extern void put_device(struct device *dev); extern void wait_for_device_probe(void); extern int devtmpfs_create_node(struct device *dev); extern int devtmpfs_delete_node(struct device *dev); extern int devtmpfs_mount(const char *mntdir); extern void device_shutdown(void); extern const char *dev_driver_string(const struct device *dev); extern int __dev_printk(const char *level, const struct device *dev, struct va_format *vaf); extern __attribute__((format(printf, 3, 4))) int dev_printk(const char *level, const struct device *dev, const char *fmt, ...) ; extern __attribute__((format(printf, 2, 3))) int dev_emerg(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int dev_alert(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int dev_crit(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int dev_err(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int dev_warn(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int dev_notice(const struct device *dev, const char *fmt, ...); extern __attribute__((format(printf, 2, 3))) int _dev_info(const struct device *dev, const char *fmt, ...); extern long sysfs_deprecated; struct bio_set; struct bio; struct bio_integrity_payload; struct page; struct block_device; typedef void (bio_end_io_t) (struct bio *, int); typedef void (bio_destructor_t) (struct bio *); struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; }; struct bio { sector_t bi_sector; struct bio *bi_next; struct block_device *bi_bdev; unsigned long bi_flags; unsigned long bi_rw; unsigned short bi_vcnt; unsigned short bi_idx; unsigned int bi_phys_segments; unsigned int bi_size; unsigned int bi_seg_front_size; unsigned int bi_seg_back_size; unsigned int bi_max_vecs; atomic_t bi_cnt; struct bio_vec *bi_io_vec; bio_end_io_t *bi_end_io; void *bi_private; struct bio_integrity_payload *bi_integrity; bio_destructor_t *bi_destructor; struct bio_vec bi_inline_vecs[0]; }; enum rq_flag_bits { __REQ_WRITE, __REQ_FAILFAST_DEV, __REQ_FAILFAST_TRANSPORT, __REQ_FAILFAST_DRIVER, __REQ_SYNC, __REQ_META, __REQ_PRIO, __REQ_DISCARD, __REQ_SECURE, __REQ_NOIDLE, __REQ_FUA, __REQ_FLUSH, __REQ_RAHEAD, __REQ_THROTTLED, __REQ_SORTED, __REQ_SOFTBARRIER, __REQ_NOMERGE, __REQ_STARTED, __REQ_DONTPREP, __REQ_QUEUED, __REQ_ELVPRIV, __REQ_FAILED, __REQ_QUIET, __REQ_PREEMPT, __REQ_ALLOCED, __REQ_COPY_USER, __REQ_FLUSH_SEQ, __REQ_IO_STAT, __REQ_MIXED_MERGE, __REQ_NR_BITS, }; struct fstrim_range { __u64 start; __u64 len; __u64 minlen; }; struct files_stat_struct { unsigned long nr_files; unsigned long nr_free_files; unsigned long max_files; }; struct inodes_stat_t { int nr_inodes; int nr_unused; int dummy[5]; }; static inline __attribute__((no_instrument_function)) int old_valid_dev(dev_t dev) { return ((unsigned int) ((dev) >> 20)) < 256 && ((unsigned int) ((dev) & ((1U << 20) - 1))) < 256; } static inline __attribute__((no_instrument_function)) u16 old_encode_dev(dev_t dev) { return (((unsigned int) ((dev) >> 20)) << 8) | ((unsigned int) ((dev) & ((1U << 20) - 1))); } static inline __attribute__((no_instrument_function)) dev_t old_decode_dev(u16 val) { return ((((val >> 8) & 255) << 20) | (val & 255)); } static inline __attribute__((no_instrument_function)) int new_valid_dev(dev_t dev) { return 1; } static inline __attribute__((no_instrument_function)) u32 new_encode_dev(dev_t dev) { unsigned major = ((unsigned int) ((dev) >> 20)); unsigned minor = ((unsigned int) ((dev) & ((1U << 20) - 1))); return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); } static inline __attribute__((no_instrument_function)) dev_t new_decode_dev(u32 dev) { unsigned major = (dev & 0xfff00) >> 8; unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); return (((major) << 20) | (minor)); } static inline __attribute__((no_instrument_function)) int huge_valid_dev(dev_t dev) { return 1; } static inline __attribute__((no_instrument_function)) u64 huge_encode_dev(dev_t dev) { return new_encode_dev(dev); } static inline __attribute__((no_instrument_function)) dev_t huge_decode_dev(u64 dev) { return new_decode_dev(dev); } static inline __attribute__((no_instrument_function)) int sysv_valid_dev(dev_t dev) { return ((unsigned int) ((dev) >> 20)) < (1<<14) && ((unsigned int) ((dev) & ((1U << 20) - 1))) < (1<<18); } static inline __attribute__((no_instrument_function)) u32 sysv_encode_dev(dev_t dev) { return ((unsigned int) ((dev) & ((1U << 20) - 1))) | (((unsigned int) ((dev) >> 20)) << 18); } static inline __attribute__((no_instrument_function)) unsigned sysv_major(u32 dev) { return (dev >> 18) & 0x3fff; } static inline __attribute__((no_instrument_function)) unsigned sysv_minor(u32 dev) { return dev & 0x3ffff; } static inline __attribute__((no_instrument_function)) void __list_add_rcu(struct list_head *new, struct list_head *prev, struct list_head *next) { new->next = next; new->prev = prev; ({ __asm__ __volatile__("": : :"memory"); (((*((struct list_head **)(&(prev)->next))))) = (typeof(*(new)) *)((new)); }); next->prev = new; } static inline __attribute__((no_instrument_function)) void list_add_rcu(struct list_head *new, struct list_head *head) { __list_add_rcu(new, head, head->next); } static inline __attribute__((no_instrument_function)) void list_add_tail_rcu(struct list_head *new, struct list_head *head) { __list_add_rcu(new, head->prev, head); } static inline __attribute__((no_instrument_function)) void list_del_rcu(struct list_head *entry) { __list_del(entry->prev, entry->next); entry->prev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_del_init_rcu(struct hlist_node *n) { if (!hlist_unhashed(n)) { __hlist_del(n); n->pprev = ((void *)0); } } static inline __attribute__((no_instrument_function)) void list_replace_rcu(struct list_head *old, struct list_head *new) { new->next = old->next; new->prev = old->prev; ({ __asm__ __volatile__("": : :"memory"); (((*((struct list_head **)(&(new->prev)->next))))) = (typeof(*(new)) *)((new)); }); new->next->prev = new; old->prev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void list_splice_init_rcu(struct list_head *list, struct list_head *head, void (*sync)(void)) { struct list_head *first = list->next; struct list_head *last = list->prev; struct list_head *at = head->next; if (list_empty(list)) return; INIT_LIST_HEAD(list); sync(); last->next = at; ({ __asm__ __volatile__("": : :"memory"); (((*((struct list_head **)(&(head)->next))))) = (typeof(*(first)) *)((first)); }); first->prev = head; at->prev = last; } static inline __attribute__((no_instrument_function)) void hlist_del_rcu(struct hlist_node *n) { __hlist_del(n); n->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_replace_rcu(struct hlist_node *old, struct hlist_node *new) { struct hlist_node *next = old->next; new->next = next; new->pprev = old->pprev; ({ __asm__ __volatile__("": : :"memory"); ((*(struct hlist_node **)new->pprev)) = (typeof(*(new)) *)((new)); }); if (next) new->next->pprev = &new->next; old->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_add_head_rcu(struct hlist_node *n, struct hlist_head *h) { struct hlist_node *first = h->first; n->next = first; n->pprev = &h->first; ({ __asm__ __volatile__("": : :"memory"); (((*((struct hlist_node **)(&(h)->first))))) = (typeof(*(n)) *)((n)); }); if (first) first->pprev = &n->next; } static inline __attribute__((no_instrument_function)) void hlist_add_before_rcu(struct hlist_node *n, struct hlist_node *next) { n->pprev = next->pprev; n->next = next; ({ __asm__ __volatile__("": : :"memory"); (((*((struct hlist_node **)((n)->pprev))))) = (typeof(*(n)) *)((n)); }); next->pprev = &n->next; } static inline __attribute__((no_instrument_function)) void hlist_add_after_rcu(struct hlist_node *prev, struct hlist_node *n) { n->next = prev->next; n->pprev = &prev->next; ({ __asm__ __volatile__("": : :"memory"); (((*((struct hlist_node **)(&(prev)->next))))) = (typeof(*(n)) *)((n)); }); if (n->next) n->next->pprev = &n->next; } static inline __attribute__((no_instrument_function)) void bit_spin_lock(int bitnum, unsigned long *addr) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); while (ldv__builtin_expect(!!(test_and_set_bit_lock(bitnum, addr)), 0)) { do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); do { cpu_relax(); } while ((__builtin_constant_p((bitnum)) ? constant_test_bit((bitnum), (addr)) : variable_test_bit((bitnum), (addr)))); do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); } (void)0; } static inline __attribute__((no_instrument_function)) int bit_spin_trylock(int bitnum, unsigned long *addr) { do { do { (current_thread_info()->preempt_count) += (1); } while (0); __asm__ __volatile__("": : :"memory"); } while (0); if (ldv__builtin_expect(!!(test_and_set_bit_lock(bitnum, addr)), 0)) { do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); return 0; } (void)0; return 1; } static inline __attribute__((no_instrument_function)) void bit_spin_unlock(int bitnum, unsigned long *addr) { do { if (ldv__builtin_expect(!!(!(__builtin_constant_p((bitnum)) ? constant_test_bit((bitnum), (addr)) : variable_test_bit((bitnum), (addr)))), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/bit_spinlock.h"), "i" (59), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); clear_bit_unlock(bitnum, addr); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); (void)0; } static inline __attribute__((no_instrument_function)) void __bit_spin_unlock(int bitnum, unsigned long *addr) { do { if (ldv__builtin_expect(!!(!(__builtin_constant_p((bitnum)) ? constant_test_bit((bitnum), (addr)) : variable_test_bit((bitnum), (addr)))), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/bit_spinlock.h"), "i" (76), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); __clear_bit_unlock(bitnum, addr); do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); (void)0; } static inline __attribute__((no_instrument_function)) int bit_spin_is_locked(int bitnum, unsigned long *addr) { return (__builtin_constant_p((bitnum)) ? constant_test_bit((bitnum), (addr)) : variable_test_bit((bitnum), (addr))); } struct hlist_bl_head { struct hlist_bl_node *first; }; struct hlist_bl_node { struct hlist_bl_node *next, **pprev; }; static inline __attribute__((no_instrument_function)) void INIT_HLIST_BL_NODE(struct hlist_bl_node *h) { h->next = ((void *)0); h->pprev = ((void *)0); } static inline __attribute__((no_instrument_function)) int hlist_bl_unhashed(const struct hlist_bl_node *h) { return !h->pprev; } static inline __attribute__((no_instrument_function)) struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h) { return (struct hlist_bl_node *) ((unsigned long)h->first & ~1UL); } static inline __attribute__((no_instrument_function)) void hlist_bl_set_first(struct hlist_bl_head *h, struct hlist_bl_node *n) { do { if (ldv__builtin_expect(!!((unsigned long)n & 1UL), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/list_bl.h"), "i" (65), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(((unsigned long)h->first & 1UL) != 1UL), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "include/linux/list_bl.h" ), "i" ( 67 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0) ; h->first = (struct hlist_bl_node *)((unsigned long)n | 1UL); } static inline __attribute__((no_instrument_function)) int hlist_bl_empty(const struct hlist_bl_head *h) { return !((unsigned long)h->first & ~1UL); } static inline __attribute__((no_instrument_function)) void hlist_bl_add_head(struct hlist_bl_node *n, struct hlist_bl_head *h) { struct hlist_bl_node *first = hlist_bl_first(h); n->next = first; if (first) first->pprev = &n->next; n->pprev = &h->first; hlist_bl_set_first(h, n); } static inline __attribute__((no_instrument_function)) void __hlist_bl_del(struct hlist_bl_node *n) { struct hlist_bl_node *next = n->next; struct hlist_bl_node **pprev = n->pprev; do { if (ldv__builtin_expect(!!((unsigned long)n & 1UL), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/list_bl.h"), "i" (93), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); *pprev = (struct hlist_bl_node *) ((unsigned long)next | ((unsigned long)*pprev & 1UL)); if (next) next->pprev = pprev; } static inline __attribute__((no_instrument_function)) void hlist_bl_del(struct hlist_bl_node *n) { __hlist_bl_del(n); n->next = ((void *) 0x00100100 + (0xdead000000000000UL)); n->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_bl_del_init(struct hlist_bl_node *n) { if (!hlist_bl_unhashed(n)) { __hlist_bl_del(n); INIT_HLIST_BL_NODE(n); } } static inline __attribute__((no_instrument_function)) void hlist_bl_lock(struct hlist_bl_head *b) { bit_spin_lock(0, (unsigned long *)b); } static inline __attribute__((no_instrument_function)) void hlist_bl_unlock(struct hlist_bl_head *b) { __bit_spin_unlock(0, (unsigned long *)b); } static inline __attribute__((no_instrument_function)) void hlist_bl_set_first_rcu(struct hlist_bl_head *h, struct hlist_bl_node *n) { do { if (ldv__builtin_expect(!!((unsigned long)n & 1UL), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/rculist_bl.h"), "i" (13), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(((unsigned long)h->first & 1UL) != 1UL), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ( "include/linux/rculist_bl.h" ), "i" ( 15 ), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0) ; ({ __asm__ __volatile__("": : :"memory"); ((h->first)) = (typeof(*((struct hlist_bl_node *)((unsigned long)n | 1UL))) *)(((struct hlist_bl_node *)((unsigned long)n | 1UL))); }) ; } static inline __attribute__((no_instrument_function)) struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h) { return (struct hlist_bl_node *) ((unsigned long)({ typeof(*(h->first)) *_________p1 = (typeof(*(h->first))* )(*(volatile typeof((h->first)) *)&((h->first))); do { } while (0); ; do { } while (0); ((typeof(*(h->first)) *)(_________p1)); }) & ~1UL); } static inline __attribute__((no_instrument_function)) void hlist_bl_del_init_rcu(struct hlist_bl_node *n) { if (!hlist_bl_unhashed(n)) { __hlist_bl_del(n); n->pprev = ((void *)0); } } static inline __attribute__((no_instrument_function)) void hlist_bl_del_rcu(struct hlist_bl_node *n) { __hlist_bl_del(n); n->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } static inline __attribute__((no_instrument_function)) void hlist_bl_add_head_rcu(struct hlist_bl_node *n, struct hlist_bl_head *h) { struct hlist_bl_node *first; first = hlist_bl_first(h); n->next = first; if (first) first->pprev = &n->next; n->pprev = &h->first; hlist_bl_set_first_rcu(h, n); } struct nameidata; struct path; struct vfsmount; struct qstr { unsigned int hash; unsigned int len; const unsigned char *name; }; struct dentry_stat_t { int nr_dentry; int nr_unused; int age_limit; int want_pages; int dummy[2]; }; extern struct dentry_stat_t dentry_stat; static inline __attribute__((no_instrument_function)) unsigned long partial_name_hash(unsigned long c, unsigned long prevhash) { return (prevhash + (c << 4) + (c >> 4)) * 11; } static inline __attribute__((no_instrument_function)) unsigned long end_name_hash(unsigned long hash) { return (unsigned int) hash; } extern unsigned int full_name_hash(const unsigned char *, unsigned int); struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32]; unsigned int d_count; spinlock_t d_lock; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; struct list_head d_lru; union { struct list_head d_child; struct rcu_head d_rcu; } d_u; struct list_head d_subdirs; struct list_head d_alias; }; enum dentry_d_lock_class { DENTRY_D_LOCK_NORMAL, DENTRY_D_LOCK_NESTED }; struct dentry_operations { int (*d_revalidate)(struct dentry *, struct nameidata *); int (*d_hash)(const struct dentry *, const struct inode *, struct qstr *); int (*d_compare)(const struct dentry *, const struct inode *, const struct dentry *, const struct inode *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char *(*d_dname)(struct dentry *, char *, int); struct vfsmount *(*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool); } __attribute__((__aligned__((1 << (6))))); extern seqlock_t rename_lock; static inline __attribute__((no_instrument_function)) int dname_external(struct dentry *dentry) { return dentry->d_name.name != dentry->d_iname; } extern void d_instantiate(struct dentry *, struct inode *); extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); extern void __d_drop(struct dentry *dentry); extern void d_drop(struct dentry *dentry); extern void d_delete(struct dentry *); extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op); extern struct dentry * d_alloc(struct dentry *, const struct qstr *); extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *); extern struct dentry * d_splice_alias(struct inode *, struct dentry *); extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); extern struct dentry *d_find_any_alias(struct inode *inode); extern struct dentry * d_obtain_alias(struct inode *); extern void shrink_dcache_sb(struct super_block *); extern void shrink_dcache_parent(struct dentry *); extern void shrink_dcache_for_umount(struct super_block *); extern int d_invalidate(struct dentry *); extern struct dentry * d_make_root(struct inode *); extern void d_genocide(struct dentry *); extern struct dentry *d_find_alias(struct inode *); extern void d_prune_aliases(struct inode *); extern int have_submounts(struct dentry *); extern void d_rehash(struct dentry *); static inline __attribute__((no_instrument_function)) void d_add(struct dentry *entry, struct inode *inode) { d_instantiate(entry, inode); d_rehash(entry); } static inline __attribute__((no_instrument_function)) struct dentry *d_add_unique(struct dentry *entry, struct inode *inode) { struct dentry *res; res = d_instantiate_unique(entry, inode); d_rehash(res != ((void *)0) ? res : entry); return res; } extern void dentry_update_name_case(struct dentry *, struct qstr *); extern void d_move(struct dentry *, struct dentry *); extern struct dentry *d_ancestor(struct dentry *, struct dentry *); extern struct dentry *d_lookup(struct dentry *, struct qstr *); extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); extern struct dentry *__d_lookup(struct dentry *, struct qstr *); extern struct dentry *__d_lookup_rcu(const struct dentry *parent, const struct qstr *name, unsigned *seq, struct inode **inode); static inline __attribute__((no_instrument_function)) int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) { int ret = 0; do { if (ldv__builtin_expect(!!(!arch_spin_is_locked(&(&(&dentry->d_lock)->rlock)->raw_lock)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dcache.h"), "i" (300), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (!read_seqcount_retry(&dentry->d_seq, seq)) { ret = 1; dentry->d_count++; } return ret; } extern int d_validate(struct dentry *, struct dentry *); extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); extern char *__d_path(const struct path *, const struct path *, char *, int); extern char *d_absolute_path(const struct path *, char *, int); extern char *d_path(const struct path *, char *, int); extern char *d_path_with_unreachable(const struct path *, char *, int); extern char *dentry_path_raw(struct dentry *, char *, int); extern char *dentry_path(struct dentry *, char *, int); static inline __attribute__((no_instrument_function)) struct dentry *dget_dlock(struct dentry *dentry) { if (dentry) dentry->d_count++; return dentry; } static inline __attribute__((no_instrument_function)) struct dentry *dget(struct dentry *dentry) { if (dentry) { spin_lock(&dentry->d_lock); dget_dlock(dentry); spin_unlock(&dentry->d_lock); } return dentry; } extern struct dentry *dget_parent(struct dentry *dentry); static inline __attribute__((no_instrument_function)) int d_unhashed(struct dentry *dentry) { return hlist_bl_unhashed(&dentry->d_hash); } static inline __attribute__((no_instrument_function)) int d_unlinked(struct dentry *dentry) { return d_unhashed(dentry) && !((dentry) == (dentry)->d_parent); } static inline __attribute__((no_instrument_function)) int cant_mount(struct dentry *dentry) { return (dentry->d_flags & 0x0100); } static inline __attribute__((no_instrument_function)) void dont_mount(struct dentry *dentry) { spin_lock(&dentry->d_lock); dentry->d_flags |= 0x0100; spin_unlock(&dentry->d_lock); } extern void dput(struct dentry *); static inline __attribute__((no_instrument_function)) bool d_managed(struct dentry *dentry) { return dentry->d_flags & (0x10000|0x20000|0x40000); } static inline __attribute__((no_instrument_function)) bool d_mountpoint(struct dentry *dentry) { return dentry->d_flags & 0x10000; } static inline __attribute__((no_instrument_function)) bool d_need_lookup(struct dentry *dentry) { return dentry->d_flags & 0x80000; } extern void d_clear_need_lookup(struct dentry *dentry); extern int sysctl_vfs_cache_pressure; struct dentry; struct vfsmount; struct path { struct vfsmount *mnt; struct dentry *dentry; }; extern void path_get(struct path *); extern void path_put(struct path *); static inline __attribute__((no_instrument_function)) int path_equal(const struct path *path1, const struct path *path2) { return path1->mnt == path2->mnt && path1->dentry == path2->dentry; } struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; unsigned int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned long st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; long __unused[3]; }; struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned int st_size; unsigned int st_atime; unsigned int st_mtime; unsigned int st_ctime; }; struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; uid_t uid; gid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; }; static inline __attribute__((no_instrument_function)) int radix_tree_is_indirect_ptr(void *ptr) { return (int)((unsigned long)ptr & 1); } struct radix_tree_root { unsigned int height; gfp_t gfp_mask; struct radix_tree_node *rnode; }; static inline __attribute__((no_instrument_function)) void *radix_tree_deref_slot(void **pslot) { return ({ typeof(*(*pslot)) *_________p1 = (typeof(*(*pslot))* )(*(volatile typeof((*pslot)) *)&((*pslot))); do { } while (0); ; do { } while (0); ((typeof(*(*pslot)) *)(_________p1)); }); } static inline __attribute__((no_instrument_function)) void *radix_tree_deref_slot_protected(void **pslot, spinlock_t *treelock) { return ({ do { } while (0); ; ((typeof(*(*pslot)) *)((*pslot))); }); } static inline __attribute__((no_instrument_function)) int radix_tree_deref_retry(void *arg) { return ldv__builtin_expect(!!((unsigned long)arg & 1), 0); } static inline __attribute__((no_instrument_function)) int radix_tree_exceptional_entry(void *arg) { return (unsigned long)arg & 2; } static inline __attribute__((no_instrument_function)) int radix_tree_exception(void *arg) { return ldv__builtin_expect(!!((unsigned long)arg & (1 | 2)), 0) ; } static inline __attribute__((no_instrument_function)) void radix_tree_replace_slot(void **pslot, void *item) { do { if (ldv__builtin_expect(!!(radix_tree_is_indirect_ptr(item)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/radix-tree.h"), "i" (215), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); ({ __asm__ __volatile__("": : :"memory"); ((*pslot)) = (typeof(*(item)) *)((item)); }); } int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); void *radix_tree_lookup(struct radix_tree_root *, unsigned long); void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); void *radix_tree_delete(struct radix_tree_root *, unsigned long); unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, unsigned long *indices, unsigned long first_index, unsigned int max_items); unsigned long radix_tree_next_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan); unsigned long radix_tree_prev_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan); int radix_tree_preload(gfp_t gfp_mask); void radix_tree_init(void); void *radix_tree_tag_set(struct radix_tree_root *root, unsigned long index, unsigned int tag); void *radix_tree_tag_clear(struct radix_tree_root *root, unsigned long index, unsigned int tag); int radix_tree_tag_get(struct radix_tree_root *root, unsigned long index, unsigned int tag); unsigned int radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items, unsigned int tag); unsigned int radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, unsigned long first_index, unsigned int max_items, unsigned int tag); unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, unsigned long *first_indexp, unsigned long last_index, unsigned long nr_to_tag, unsigned int fromtag, unsigned int totag); int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); unsigned long radix_tree_locate_item(struct radix_tree_root *root, void *item); static inline __attribute__((no_instrument_function)) void radix_tree_preload_end(void) { do { do { __asm__ __volatile__("": : :"memory"); do { (current_thread_info()->preempt_count) -= (1); } while (0); } while (0); __asm__ __volatile__("": : :"memory"); do { } while (0); } while (0); } struct radix_tree_iter { unsigned long index; unsigned long next_index; unsigned long tags; }; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void ** radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start) { iter->index = 0; iter->next_index = start; return ((void *)0); } void **radix_tree_next_chunk(struct radix_tree_root *root, struct radix_tree_iter *iter, unsigned flags); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) unsigned radix_tree_chunk_size(struct radix_tree_iter *iter) { return iter->next_index - iter->index; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void ** radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) { if (flags & 0x0100) { iter->tags >>= 1; if (ldv__builtin_expect(!!(iter->tags & 1ul), 1)) { iter->index++; return slot + 1; } if (!(flags & 0x0200) && ldv__builtin_expect(!!(iter->tags), 1)) { unsigned offset = __ffs(iter->tags); iter->tags >>= offset; iter->index += offset + 1; return slot + offset + 1; } } else { unsigned size = radix_tree_chunk_size(iter) - 1; while (size--) { slot++; iter->index++; if (ldv__builtin_expect(!!(*slot), 1)) return slot; if (flags & 0x0200) break; } } return ((void *)0); } struct raw_prio_tree_node { struct prio_tree_node *left; struct prio_tree_node *right; struct prio_tree_node *parent; }; struct prio_tree_node { struct prio_tree_node *left; struct prio_tree_node *right; struct prio_tree_node *parent; unsigned long start; unsigned long last; }; struct prio_tree_root { struct prio_tree_node *prio_tree_node; unsigned short index_bits; unsigned short raw; }; struct prio_tree_iter { struct prio_tree_node *cur; unsigned long mask; unsigned long value; int size_level; struct prio_tree_root *root; unsigned long r_index; unsigned long h_index; }; static inline __attribute__((no_instrument_function)) void prio_tree_iter_init(struct prio_tree_iter *iter, struct prio_tree_root *root, unsigned long r_index, unsigned long h_index) { iter->root = root; iter->r_index = r_index; iter->h_index = h_index; iter->cur = ((void *)0); } static inline __attribute__((no_instrument_function)) int prio_tree_empty(const struct prio_tree_root *root) { return root->prio_tree_node == ((void *)0); } static inline __attribute__((no_instrument_function)) int prio_tree_root(const struct prio_tree_node *node) { return node->parent == node; } static inline __attribute__((no_instrument_function)) int prio_tree_left_empty(const struct prio_tree_node *node) { return node->left == node; } static inline __attribute__((no_instrument_function)) int prio_tree_right_empty(const struct prio_tree_node *node) { return node->right == node; } struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root, struct prio_tree_node *old, struct prio_tree_node *node); struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root, struct prio_tree_node *node); void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node); struct prio_tree_node *prio_tree_next(struct prio_tree_iter *iter); enum pid_type { PIDTYPE_PID, PIDTYPE_PGID, PIDTYPE_SID, PIDTYPE_MAX }; struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; }; struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[PIDTYPE_MAX]; struct rcu_head rcu; struct upid numbers[1]; }; extern struct pid init_struct_pid; struct pid_link { struct hlist_node node; struct pid *pid; }; static inline __attribute__((no_instrument_function)) struct pid *get_pid(struct pid *pid) { if (pid) atomic_inc(&pid->count); return pid; } extern void put_pid(struct pid *pid); extern struct task_struct *pid_task(struct pid *pid, enum pid_type); extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type); extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); extern void attach_pid(struct task_struct *task, enum pid_type type, struct pid *pid); extern void detach_pid(struct task_struct *task, enum pid_type); extern void change_pid(struct task_struct *task, enum pid_type, struct pid *pid); extern void transfer_pid(struct task_struct *old, struct task_struct *new, enum pid_type); struct pid_namespace; extern struct pid_namespace init_pid_ns; extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns); extern struct pid *find_vpid(int nr); extern struct pid *find_get_pid(int nr); extern struct pid *find_ge_pid(int nr, struct pid_namespace *); int next_pidmap(struct pid_namespace *pid_ns, unsigned int last); extern struct pid *alloc_pid(struct pid_namespace *ns); extern void free_pid(struct pid *pid); static inline __attribute__((no_instrument_function)) struct pid_namespace *ns_of_pid(struct pid *pid) { struct pid_namespace *ns = ((void *)0); if (pid) ns = pid->numbers[pid->level].ns; return ns; } static inline __attribute__((no_instrument_function)) bool is_child_reaper(struct pid *pid) { return pid->numbers[pid->level].nr == 1; } static inline __attribute__((no_instrument_function)) pid_t pid_nr(struct pid *pid) { pid_t nr = 0; if (pid) nr = pid->numbers[0].nr; return nr; } pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns); pid_t pid_vnr(struct pid *pid); struct task_struct; typedef struct __user_cap_header_struct { __u32 version; int pid; } *cap_user_header_t; typedef struct __user_cap_data_struct { __u32 effective; __u32 permitted; __u32 inheritable; } *cap_user_data_t; struct vfs_cap_data { __le32 magic_etc; struct { __le32 permitted; __le32 inheritable; } data[2]; }; extern int file_caps_enabled; typedef struct kernel_cap_struct { __u32 cap[2]; } kernel_cap_t; struct cpu_vfs_cap_data { __u32 magic_etc; kernel_cap_t permitted; kernel_cap_t inheritable; }; struct dentry; struct user_namespace; struct user_namespace *current_user_ns(void); extern const kernel_cap_t __cap_empty_set; extern const kernel_cap_t __cap_init_eff_set; static inline __attribute__((no_instrument_function)) kernel_cap_t cap_combine(const kernel_cap_t a, const kernel_cap_t b) { kernel_cap_t dest; do { unsigned __capi; for (__capi = 0; __capi < 2; ++__capi) { dest.cap[__capi] = a.cap[__capi] | b.cap[__capi]; } } while (0); return dest; } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_intersect(const kernel_cap_t a, const kernel_cap_t b) { kernel_cap_t dest; do { unsigned __capi; for (__capi = 0; __capi < 2; ++__capi) { dest.cap[__capi] = a.cap[__capi] & b.cap[__capi]; } } while (0); return dest; } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_drop(const kernel_cap_t a, const kernel_cap_t drop) { kernel_cap_t dest; do { unsigned __capi; for (__capi = 0; __capi < 2; ++__capi) { dest.cap[__capi] = a.cap[__capi] &~ drop.cap[__capi]; } } while (0); return dest; } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_invert(const kernel_cap_t c) { kernel_cap_t dest; do { unsigned __capi; for (__capi = 0; __capi < 2; ++__capi) { dest.cap[__capi] = ~ c.cap[__capi]; } } while (0); return dest; } static inline __attribute__((no_instrument_function)) int cap_isclear(const kernel_cap_t a) { unsigned __capi; for (__capi = 0; __capi < 2; ++__capi) { if (a.cap[__capi] != 0) return 0; } return 1; } static inline __attribute__((no_instrument_function)) int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) { kernel_cap_t dest; dest = cap_drop(a, set); return cap_isclear(dest); } static inline __attribute__((no_instrument_function)) int cap_is_fs_cap(int cap) { const kernel_cap_t __cap_fs_set = ((kernel_cap_t){{ ((1 << ((0) & 31)) | (1 << ((27) & 31)) | (1 << ((1) & 31)) | (1 << ((2) & 31)) | (1 << ((3) & 31)) | (1 << ((4) & 31))) | (1 << ((9) & 31)), ((1 << ((32) & 31))) } }); return !!((1 << ((cap) & 31)) & __cap_fs_set.cap[((cap) >> 5)]); } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_drop_fs_set(const kernel_cap_t a) { const kernel_cap_t __cap_fs_set = ((kernel_cap_t){{ ((1 << ((0) & 31)) | (1 << ((27) & 31)) | (1 << ((1) & 31)) | (1 << ((2) & 31)) | (1 << ((3) & 31)) | (1 << ((4) & 31))) | (1 << ((9) & 31)), ((1 << ((32) & 31))) } }); return cap_drop(a, __cap_fs_set); } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_raise_fs_set(const kernel_cap_t a, const kernel_cap_t permitted) { const kernel_cap_t __cap_fs_set = ((kernel_cap_t){{ ((1 << ((0) & 31)) | (1 << ((27) & 31)) | (1 << ((1) & 31)) | (1 << ((2) & 31)) | (1 << ((3) & 31)) | (1 << ((4) & 31))) | (1 << ((9) & 31)), ((1 << ((32) & 31))) } }); return cap_combine(a, cap_intersect(permitted, __cap_fs_set)); } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_drop_nfsd_set(const kernel_cap_t a) { const kernel_cap_t __cap_fs_set = ((kernel_cap_t){{ ((1 << ((0) & 31)) | (1 << ((27) & 31)) | (1 << ((1) & 31)) | (1 << ((2) & 31)) | (1 << ((3) & 31)) | (1 << ((4) & 31))) | (1 << ((24) & 31)), ((1 << ((32) & 31))) } }); return cap_drop(a, __cap_fs_set); } static inline __attribute__((no_instrument_function)) kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a, const kernel_cap_t permitted) { const kernel_cap_t __cap_nfsd_set = ((kernel_cap_t){{ ((1 << ((0) & 31)) | (1 << ((27) & 31)) | (1 << ((1) & 31)) | (1 << ((2) & 31)) | (1 << ((3) & 31)) | (1 << ((4) & 31))) | (1 << ((24) & 31)), ((1 << ((32) & 31))) } }); return cap_combine(a, cap_intersect(permitted, __cap_nfsd_set)); } extern bool has_capability(struct task_struct *t, int cap); extern bool has_ns_capability(struct task_struct *t, struct user_namespace *ns, int cap); extern bool has_capability_noaudit(struct task_struct *t, int cap); extern bool has_ns_capability_noaudit(struct task_struct *t, struct user_namespace *ns, int cap); extern bool capable(int cap); extern bool ns_capable(struct user_namespace *ns, int cap); extern bool nsown_capable(int cap); extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); struct semaphore { raw_spinlock_t lock; unsigned int count; struct list_head wait_list; }; static inline __attribute__((no_instrument_function)) void sema_init(struct semaphore *sem, int val) { static struct lock_class_key __key; *sem = (struct semaphore) { .lock = (raw_spinlock_t) { .raw_lock = { { 0 } }, .magic = 0xdead4ead, .owner_cpu = -1, .owner = ((void *)-1L), }, .count = val, .wait_list = { &((*sem).wait_list), &((*sem).wait_list) }, }; do { (void)("semaphore->lock"); (void)(&__key); } while (0); } extern void down(struct semaphore *sem); extern int __attribute__((warn_unused_result)) down_interruptible(struct semaphore *sem); extern int __attribute__((warn_unused_result)) down_killable(struct semaphore *sem); extern int __attribute__((warn_unused_result)) down_trylock(struct semaphore *sem); extern int __attribute__((warn_unused_result)) down_timeout(struct semaphore *sem, long jiffies); extern void up(struct semaphore *sem); struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2]; __u32 fe_flags; __u32 fe_reserved[3]; }; struct fiemap { __u64 fm_start; __u64 fm_length; __u32 fm_flags; __u32 fm_mapped_extents; __u32 fm_extent_count; __u32 fm_reserved; struct fiemap_extent fm_extents[0]; }; struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; }; struct shrinker { int (*shrink)(struct shrinker *, struct shrink_control *sc); int seeks; long batch; struct list_head list; atomic_long_t nr_in_batch; }; extern void register_shrinker(struct shrinker *); extern void unregister_shrinker(struct shrinker *); enum migrate_mode { MIGRATE_ASYNC, MIGRATE_SYNC_LIGHT, MIGRATE_SYNC, }; struct export_operations; struct hd_geometry; struct iovec; struct nameidata; struct kiocb; struct kobject; struct pipe_inode_info; struct poll_table_struct; struct kstatfs; struct vm_area_struct; struct vfsmount; struct cred; extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) inode_init(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) inode_init_early(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) files_init(unsigned long); extern struct files_stat_struct files_stat; extern unsigned long get_max_files(void); extern int sysctl_nr_open; extern struct inodes_stat_t inodes_stat; extern int leases_enable, lease_break_time; struct buffer_head; typedef int (get_block_t)(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, ssize_t bytes, void *private, int ret, bool is_async); struct iattr { unsigned int ia_valid; umode_t ia_mode; uid_t ia_uid; gid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; }; enum { QIF_BLIMITS_B = 0, QIF_SPACE_B, QIF_ILIMITS_B, QIF_INODES_B, QIF_BTIME_B, QIF_ITIME_B, }; struct if_dqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; }; struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; __u32 dqi_valid; }; enum { QUOTA_NL_C_UNSPEC, QUOTA_NL_C_WARNING, __QUOTA_NL_C_MAX, }; enum { QUOTA_NL_A_UNSPEC, QUOTA_NL_A_QTYPE, QUOTA_NL_A_EXCESS_ID, QUOTA_NL_A_WARNING, QUOTA_NL_A_DEV_MAJOR, QUOTA_NL_A_DEV_MINOR, QUOTA_NL_A_CAUSED_ID, __QUOTA_NL_A_MAX, }; struct percpu_counter { raw_spinlock_t lock; s64 count; struct list_head list; s32 *counters; }; extern int percpu_counter_batch; int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, struct lock_class_key *key); void percpu_counter_destroy(struct percpu_counter *fbc); void percpu_counter_set(struct percpu_counter *fbc, s64 amount); void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); s64 __percpu_counter_sum(struct percpu_counter *fbc); int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs); static inline __attribute__((no_instrument_function)) void percpu_counter_add(struct percpu_counter *fbc, s64 amount) { __percpu_counter_add(fbc, amount, percpu_counter_batch); } static inline __attribute__((no_instrument_function)) s64 percpu_counter_sum_positive(struct percpu_counter *fbc) { s64 ret = __percpu_counter_sum(fbc); return ret < 0 ? 0 : ret; } static inline __attribute__((no_instrument_function)) s64 percpu_counter_sum(struct percpu_counter *fbc) { return __percpu_counter_sum(fbc); } static inline __attribute__((no_instrument_function)) s64 percpu_counter_read(struct percpu_counter *fbc) { return fbc->count; } static inline __attribute__((no_instrument_function)) s64 percpu_counter_read_positive(struct percpu_counter *fbc) { s64 ret = fbc->count; __asm__ __volatile__("": : :"memory"); if (ret >= 0) return ret; return 0; } static inline __attribute__((no_instrument_function)) int percpu_counter_initialized(struct percpu_counter *fbc) { return (fbc->counters != ((void *)0)); } static inline __attribute__((no_instrument_function)) void percpu_counter_inc(struct percpu_counter *fbc) { percpu_counter_add(fbc, 1); } static inline __attribute__((no_instrument_function)) void percpu_counter_dec(struct percpu_counter *fbc) { percpu_counter_add(fbc, -1); } static inline __attribute__((no_instrument_function)) void percpu_counter_sub(struct percpu_counter *fbc, s64 amount) { percpu_counter_add(fbc, -amount); } typedef struct fs_disk_quota { __s8 d_version; __s8 d_flags; __u16 d_fieldmask; __u32 d_id; __u64 d_blk_hardlimit; __u64 d_blk_softlimit; __u64 d_ino_hardlimit; __u64 d_ino_softlimit; __u64 d_bcount; __u64 d_icount; __s32 d_itimer; __s32 d_btimer; __u16 d_iwarns; __u16 d_bwarns; __s32 d_padding2; __u64 d_rtb_hardlimit; __u64 d_rtb_softlimit; __u64 d_rtbcount; __s32 d_rtbtimer; __u16 d_rtbwarns; __s16 d_padding3; char d_padding4[8]; } fs_disk_quota_t; typedef struct fs_qfilestat { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; } fs_qfilestat_t; typedef struct fs_quota_stat { __s8 qs_version; __u16 qs_flags; __s8 qs_pad; fs_qfilestat_t qs_uquota; fs_qfilestat_t qs_gquota; __u32 qs_incoredqs; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; } fs_quota_stat_t; struct dquot; struct qtree_fmt_operations { void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); int (*is_id)(void *disk, struct dquot *dquot); }; struct qtree_mem_dqinfo { struct super_block *dqi_sb; int dqi_type; unsigned int dqi_blocks; unsigned int dqi_free_blk; unsigned int dqi_free_entry; unsigned int dqi_blocksize_bits; unsigned int dqi_entry_size; unsigned int dqi_usable_bs; unsigned int dqi_qtree_depth; struct qtree_fmt_operations *dqi_ops; }; int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot); int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot); int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot); int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot); int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk); static inline __attribute__((no_instrument_function)) int qtree_depth(struct qtree_mem_dqinfo *info) { unsigned int epb = info->dqi_usable_bs >> 2; unsigned long long entries = epb; int i; for (i = 1; entries < (1ULL << 32); i++) entries *= epb; return i; } typedef __kernel_uid32_t qid_t; typedef long long qsize_t; extern spinlock_t dq_data_lock; struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; }; struct quota_format_type; struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_maxblimit; qsize_t dqi_maxilimit; void *dqi_priv; }; struct super_block; extern void mark_info_dirty(struct super_block *sb, int type); static inline __attribute__((no_instrument_function)) int info_dirty(struct mem_dqinfo *info) { return (__builtin_constant_p((31)) ? constant_test_bit((31), (&info->dqi_flags)) : variable_test_bit((31), (&info->dqi_flags))); } enum { DQST_LOOKUPS, DQST_DROPS, DQST_READS, DQST_WRITES, DQST_CACHE_HITS, DQST_ALLOC_DQUOTS, DQST_FREE_DQUOTS, DQST_SYNCS, _DQST_DQSTAT_LAST }; struct dqstats { int stat[_DQST_DQSTAT_LAST]; struct percpu_counter counter[_DQST_DQSTAT_LAST]; }; extern struct dqstats *dqstats_pcpu; extern struct dqstats dqstats; static inline __attribute__((no_instrument_function)) void dqstats_inc(unsigned int type) { percpu_counter_inc(&dqstats.counter[type]); } static inline __attribute__((no_instrument_function)) void dqstats_dec(unsigned int type) { percpu_counter_dec(&dqstats.counter[type]); } struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; unsigned int dq_id; loff_t dq_off; unsigned long dq_flags; short dq_type; struct mem_dqblk dq_dqb; }; struct quota_format_ops { int (*check_quota_file)(struct super_block *sb, int type); int (*read_file_info)(struct super_block *sb, int type); int (*write_file_info)(struct super_block *sb, int type); int (*free_file_info)(struct super_block *sb, int type); int (*read_dqblk)(struct dquot *dquot); int (*commit_dqblk)(struct dquot *dquot); int (*release_dqblk)(struct dquot *dquot); }; struct dquot_operations { int (*write_dquot) (struct dquot *); struct dquot *(*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot) (struct dquot *); int (*release_dquot) (struct dquot *); int (*mark_dirty) (struct dquot *); int (*write_info) (struct super_block *, int); qsize_t *(*get_reserved_space) (struct inode *); }; struct path; struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_on_meta)(struct super_block *, int, int); int (*quota_off)(struct super_block *, int); int (*quota_sync)(struct super_block *, int, int); int (*get_info)(struct super_block *, int, struct if_dqinfo *); int (*set_info)(struct super_block *, int, struct if_dqinfo *); int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *); int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *); int (*get_xstate)(struct super_block *, struct fs_quota_stat *); int (*set_xstate)(struct super_block *, unsigned int, int); }; struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; }; enum { _DQUOT_USAGE_ENABLED = 0, _DQUOT_LIMITS_ENABLED, _DQUOT_SUSPENDED, _DQUOT_STATE_FLAGS }; static inline __attribute__((no_instrument_function)) unsigned int dquot_state_flag(unsigned int flags, int type) { return flags << _DQUOT_STATE_FLAGS * type; } static inline __attribute__((no_instrument_function)) unsigned int dquot_generic_flag(unsigned int flags, int type) { return (flags >> _DQUOT_STATE_FLAGS * type) & ((1 << _DQUOT_USAGE_ENABLED) | (1 << _DQUOT_LIMITS_ENABLED) | (1 << _DQUOT_SUSPENDED)); } extern void quota_send_warning(short type, unsigned int id, dev_t dev, const char warntype); struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct rw_semaphore dqptr_sem; struct inode *files[2]; struct mem_dqinfo info[2]; const struct quota_format_ops *ops[2]; }; int register_quota_format(struct quota_format_type *fmt); void unregister_quota_format(struct quota_format_type *fmt); struct quota_module_name { int qm_fmt_id; char *qm_mod_name; }; enum positive_aop_returns { AOP_WRITEPAGE_ACTIVATE = 0x80000, AOP_TRUNCATED_PAGE = 0x80001, }; struct page; struct address_space; struct writeback_control; struct iov_iter { const struct iovec *iov; unsigned long nr_segs; size_t iov_offset; size_t count; }; size_t iov_iter_copy_from_user_atomic(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes); size_t iov_iter_copy_from_user(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes); void iov_iter_advance(struct iov_iter *i, size_t bytes); int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); size_t iov_iter_single_seg_count(struct iov_iter *i); static inline __attribute__((no_instrument_function)) void iov_iter_init(struct iov_iter *i, const struct iovec *iov, unsigned long nr_segs, size_t count, size_t written) { i->iov = iov; i->nr_segs = nr_segs; i->iov_offset = 0; i->count = count + written; iov_iter_advance(i, written); } static inline __attribute__((no_instrument_function)) size_t iov_iter_count(struct iov_iter *i) { return i->count; } typedef struct { size_t written; size_t count; union { char *buf; void *data; } arg; int error; } read_descriptor_t; typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); struct address_space_operations { int (*writepage)(struct page *page, struct writeback_control *wbc); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *page); int (*readpages)(struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata); sector_t (*bmap)(struct address_space *, sector_t); void (*invalidatepage) (struct page *, unsigned long); int (*releasepage) (struct page *, gfp_t); void (*freepage)(struct page *); ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, loff_t offset, unsigned long nr_segs); int (*get_xip_mem)(struct address_space *, unsigned long, int, void **, unsigned long *); int (*migratepage) (struct address_space *, struct page *, struct page *, enum migrate_mode); int (*launder_page) (struct page *); int (*is_partially_uptodate) (struct page *, read_descriptor_t *, unsigned long); int (*error_remove_page)(struct address_space *, struct page *); }; extern const struct address_space_operations empty_aops; int pagecache_write_begin(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata); int pagecache_write_end(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata); struct backing_dev_info; struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; unsigned int i_mmap_writable; struct prio_tree_root i_mmap; struct list_head i_mmap_nonlinear; struct mutex i_mmap_mutex; unsigned long nrpages; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; struct backing_dev_info *backing_dev_info; spinlock_t private_lock; struct list_head private_list; struct address_space *assoc_mapping; } __attribute__((aligned(sizeof(long)))); struct request_queue; struct block_device { dev_t bd_dev; int bd_openers; struct inode * bd_inode; struct super_block * bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void * bd_claiming; void * bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device * bd_contains; unsigned bd_block_size; struct hd_struct * bd_part; unsigned bd_part_count; int bd_invalidated; struct gendisk * bd_disk; struct request_queue * bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; }; int mapping_tagged(struct address_space *mapping, int tag); static inline __attribute__((no_instrument_function)) int mapping_mapped(struct address_space *mapping) { return !prio_tree_empty(&mapping->i_mmap) || !list_empty(&mapping->i_mmap_nonlinear); } static inline __attribute__((no_instrument_function)) int mapping_writably_mapped(struct address_space *mapping) { return mapping->i_mmap_writable != 0; } struct posix_acl; struct inode { umode_t i_mode; unsigned short i_opflags; uid_t i_uid; gid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union { const unsigned int i_nlink; unsigned int __i_nlink; }; dev_t i_rdev; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; blkcnt_t i_blocks; loff_t i_size; unsigned long i_state; struct mutex i_mutex; unsigned long dirtied_when; struct hlist_node i_hash; struct list_head i_wb_list; struct list_head i_lru; struct list_head i_sb_list; union { struct list_head i_dentry; struct rcu_head i_rcu; }; atomic_t i_count; unsigned int i_blkbits; u64 i_version; atomic_t i_dio_count; atomic_t i_writecount; const struct file_operations *i_fop; struct file_lock *i_flock; struct address_space i_data; struct dquot *i_dquot[2]; struct list_head i_devices; union { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; }; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; atomic_t i_readcount; void *i_private; }; static inline __attribute__((no_instrument_function)) int inode_unhashed(struct inode *inode) { return hlist_unhashed(&inode->i_hash); } enum inode_i_mutex_lock_class { I_MUTEX_NORMAL, I_MUTEX_PARENT, I_MUTEX_CHILD, I_MUTEX_XATTR, I_MUTEX_QUOTA }; static inline __attribute__((no_instrument_function)) loff_t i_size_read(const struct inode *inode) { return inode->i_size; } static inline __attribute__((no_instrument_function)) void i_size_write(struct inode *inode, loff_t i_size) { inode->i_size = i_size; } static inline __attribute__((no_instrument_function)) unsigned iminor(const struct inode *inode) { return ((unsigned int) ((inode->i_rdev) & ((1U << 20) - 1))); } static inline __attribute__((no_instrument_function)) unsigned imajor(const struct inode *inode) { return ((unsigned int) ((inode->i_rdev) >> 20)); } extern struct block_device *I_BDEV(struct inode *inode); struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; uid_t uid, euid; int signum; }; struct file_ra_state { unsigned long start; unsigned int size; unsigned int async_size; unsigned int ra_pages; unsigned int mmap_miss; loff_t prev_pos; }; static inline __attribute__((no_instrument_function)) int ra_has_index(struct file_ra_state *ra, unsigned long index) { return (index >= ra->start && index < ra->start + ra->size); } struct file { union { struct list_head fu_list; struct rcu_head fu_rcuhead; } f_u; struct path f_path; const struct file_operations *f_op; spinlock_t f_lock; int f_sb_list_cpu; atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version; void *f_security; void *private_data; struct list_head f_ep_links; struct list_head f_tfile_llink; struct address_space *f_mapping; unsigned long f_mnt_write_state; }; struct file_handle { __u32 handle_bytes; int handle_type; unsigned char f_handle[0]; }; static inline __attribute__((no_instrument_function)) void file_take_write(struct file *f) { ({ int __ret_warn_on = !!(f->f_mnt_write_state != 0); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/fs.h", 1038); ldv__builtin_expect(!!(__ret_warn_on), 0); }); f->f_mnt_write_state = 1; } static inline __attribute__((no_instrument_function)) void file_release_write(struct file *f) { f->f_mnt_write_state |= 2; } static inline __attribute__((no_instrument_function)) void file_reset_write(struct file *f) { f->f_mnt_write_state = 0; } static inline __attribute__((no_instrument_function)) void file_check_state(struct file *f) { ({ int __ret_warn_on = !!(f->f_mnt_write_state == 1); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/fs.h", 1055); ldv__builtin_expect(!!(__ret_warn_on), 0); }); ({ int __ret_warn_on = !!(f->f_mnt_write_state == 2); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/fs.h", 1056); ldv__builtin_expect(!!(__ret_warn_on), 0); }); } static inline __attribute__((no_instrument_function)) int file_check_writeable(struct file *f) { if (f->f_mnt_write_state == 1) return 0; printk("<4>" "writeable file with no " "mnt_want_write()\n"); ({ int __ret_warn_on = !!(1); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/fs.h", 1064); ldv__builtin_expect(!!(__ret_warn_on), 0); }); return -22; } typedef struct files_struct *fl_owner_t; struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); }; struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, struct file_lock *, int); void (*lm_release_private)(struct file_lock *); void (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock **, int); }; struct lock_manager { struct list_head list; }; void locks_start_grace(struct lock_manager *); void locks_end_grace(struct lock_manager *); int locks_in_grace(void); struct nlm_lockowner; struct nfs_lock_info { u32 state; struct nlm_lockowner *owner; struct list_head list; }; struct nfs4_lock_state; struct nfs4_lock_info { struct nfs4_lock_state *owner; }; struct file_lock { struct file_lock *fl_next; struct list_head fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct * fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct { struct list_head link; int state; } afs; } fl_u; }; struct f_owner_ex { int type; __kernel_pid_t pid; }; struct flock { short l_type; short l_whence; __kernel_off_t l_start; __kernel_off_t l_len; __kernel_pid_t l_pid; }; extern void send_sigio(struct fown_struct *fown, int fd, int band); extern int fcntl_getlk(struct file *, struct flock *); extern int fcntl_setlk(unsigned int, struct file *, unsigned int, struct flock *); extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); extern int fcntl_getlease(struct file *filp); void locks_free_lock(struct file_lock *fl); extern void locks_init_lock(struct file_lock *); extern struct file_lock * locks_alloc_lock(void); extern void locks_copy_lock(struct file_lock *, struct file_lock *); extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); extern void locks_remove_posix(struct file *, fl_owner_t); extern void locks_remove_flock(struct file *); extern void locks_release_private(struct file_lock *); extern void posix_test_lock(struct file *, struct file_lock *); extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); extern int posix_lock_file_wait(struct file *, struct file_lock *); extern int posix_unblock_lock(struct file *, struct file_lock *); extern int vfs_test_lock(struct file *, struct file_lock *); extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); extern int __break_lease(struct inode *inode, unsigned int flags); extern void lease_get_mtime(struct inode *, struct timespec *time); extern int generic_setlease(struct file *, long, struct file_lock **); extern int vfs_setlease(struct file *, long, struct file_lock **); extern int lease_modify(struct file_lock **, int); extern int lock_may_read(struct inode *, loff_t start, unsigned long count); extern int lock_may_write(struct inode *, loff_t start, unsigned long count); extern void locks_delete_block(struct file_lock *waiter); extern void lock_flocks(void); extern void unlock_flocks(void); struct fasync_struct { spinlock_t fa_lock; int magic; int fa_fd; struct fasync_struct *fa_next; struct file *fa_file; struct rcu_head fa_rcu; }; extern int fasync_helper(int, struct file *, int, struct fasync_struct **); extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *); extern int fasync_remove_entry(struct file *, struct fasync_struct **); extern struct fasync_struct *fasync_alloc(void); extern void fasync_free(struct fasync_struct *); extern void kill_fasync(struct fasync_struct **, int, int); extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); extern int f_setown(struct file *filp, unsigned long arg, int force); extern void f_delown(struct file *filp); extern pid_t f_getown(struct file *filp); extern int send_sigurg(struct fown_struct *fown); extern struct list_head super_blocks; extern spinlock_t sb_lock; struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_dirt; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; struct mutex s_lock; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; struct list_head s_inodes; struct hlist_bl_head s_anon; struct list_head *s_files; struct list_head s_mounts; struct list_head s_dentry_lru; int s_nr_dentry_unused; spinlock_t s_inode_lru_lock __attribute__((__aligned__((1 << (6))))); struct list_head s_inode_lru; int s_nr_inodes_unused; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; struct quota_info s_dquot; int s_frozen; wait_queue_head_t s_wait_unfrozen; char s_id[32]; u8 s_uuid[16]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; }; extern void prune_icache_sb(struct super_block *sb, int nr_to_scan); extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan); extern struct timespec current_fs_time(struct super_block *sb); enum { SB_UNFROZEN = 0, SB_FREEZE_WRITE = 1, SB_FREEZE_TRANS = 2, }; extern struct user_namespace init_user_ns; extern bool inode_owner_or_capable(const struct inode *inode); extern void lock_super(struct super_block *); extern void unlock_super(struct super_block *); extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *); extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); extern int vfs_symlink(struct inode *, struct dentry *, const char *); extern int vfs_link(struct dentry *, struct inode *, struct dentry *); extern int vfs_rmdir(struct inode *, struct dentry *); extern int vfs_unlink(struct inode *, struct dentry *); extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); extern void dentry_unhash(struct dentry *dentry); extern void inode_init_owner(struct inode *inode, const struct inode *dir, umode_t mode); struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; }; int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, u64 phys, u64 len, u32 flags); int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); struct block_device_operations; struct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char *, size_t, loff_t *); ssize_t (*write) (struct file *, const char *, size_t, loff_t *); ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, struct poll_table_struct *); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); int (*open) (struct inode *, struct file *); int (*flush) (struct file *, fl_owner_t id); int (*release) (struct inode *, struct file *); int (*fsync) (struct file *, loff_t, loff_t, int datasync); int (*aio_fsync) (struct kiocb *, int datasync); int (*fasync) (int, struct file *, int); int (*lock) (struct file *, int, struct file_lock *); ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock) (struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); int (*setlease)(struct file *, long, struct file_lock **); long (*fallocate)(struct file *file, int mode, loff_t offset, loff_t len); }; struct inode_operations { struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); void * (*follow_link) (struct dentry *, struct nameidata *); int (*permission) (struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink) (struct dentry *, char *,int); void (*put_link) (struct dentry *, struct nameidata *, void *); int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *); int (*link) (struct dentry *,struct inode *,struct dentry *); int (*unlink) (struct inode *,struct dentry *); int (*symlink) (struct inode *,struct dentry *,const char *); int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*rmdir) (struct inode *,struct dentry *); int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *); void (*truncate) (struct inode *); int (*setattr) (struct dentry *, struct iattr *); int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t); int (*removexattr) (struct dentry *, const char *); void (*truncate_range)(struct inode *, loff_t, loff_t); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); } __attribute__((__aligned__((1 << (6))))); struct seq_file; ssize_t rw_copy_check_uvector(int type, const struct iovec * uvector, unsigned long nr_segs, unsigned long fast_segs, struct iovec *fast_pointer, struct iovec **ret_pointer, int check_access); extern ssize_t vfs_read(struct file *, char *, size_t, loff_t *); extern ssize_t vfs_write(struct file *, const char *, size_t, loff_t *); extern ssize_t vfs_readv(struct file *, const struct iovec *, unsigned long, loff_t *); extern ssize_t vfs_writev(struct file *, const struct iovec *, unsigned long, loff_t *); struct super_operations { struct inode *(*alloc_inode)(struct super_block *sb); void (*destroy_inode)(struct inode *); void (*dirty_inode) (struct inode *, int flags); int (*write_inode) (struct inode *, struct writeback_control *wbc); int (*drop_inode) (struct inode *); void (*evict_inode) (struct inode *); void (*put_super) (struct super_block *); void (*write_super) (struct super_block *); int (*sync_fs)(struct super_block *sb, int wait); int (*freeze_fs) (struct super_block *); int (*unfreeze_fs) (struct super_block *); int (*statfs) (struct dentry *, struct kstatfs *); int (*remount_fs) (struct super_block *, int *, char *); void (*umount_begin) (struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); int (*nr_cached_objects)(struct super_block *); void (*free_cached_objects)(struct super_block *, int); }; extern void __mark_inode_dirty(struct inode *, int); static inline __attribute__((no_instrument_function)) void mark_inode_dirty(struct inode *inode) { __mark_inode_dirty(inode, ((1 << 0) | (1 << 1) | (1 << 2))); } static inline __attribute__((no_instrument_function)) void mark_inode_dirty_sync(struct inode *inode) { __mark_inode_dirty(inode, (1 << 0)); } extern void inc_nlink(struct inode *inode); extern void drop_nlink(struct inode *inode); extern void clear_nlink(struct inode *inode); extern void set_nlink(struct inode *inode, unsigned int nlink); static inline __attribute__((no_instrument_function)) void inode_inc_link_count(struct inode *inode) { inc_nlink(inode); mark_inode_dirty(inode); } static inline __attribute__((no_instrument_function)) void inode_dec_link_count(struct inode *inode) { drop_nlink(inode); mark_inode_dirty(inode); } static inline __attribute__((no_instrument_function)) void inode_inc_iversion(struct inode *inode) { spin_lock(&inode->i_lock); inode->i_version++; spin_unlock(&inode->i_lock); } extern void touch_atime(struct path *); static inline __attribute__((no_instrument_function)) void file_accessed(struct file *file) { if (!(file->f_flags & 01000000)) touch_atime(&file->f_path); } int sync_inode(struct inode *inode, struct writeback_control *wbc); int sync_inode_metadata(struct inode *inode, int wait); struct file_system_type { const char *name; int fs_flags; struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); void (*kill_sb) (struct super_block *); struct module *owner; struct file_system_type * next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; }; extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, void *data, int (*fill_super)(struct super_block *, void *, int)); extern struct dentry *mount_bdev(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, int (*fill_super)(struct super_block *, void *, int)); extern struct dentry *mount_single(struct file_system_type *fs_type, int flags, void *data, int (*fill_super)(struct super_block *, void *, int)); extern struct dentry *mount_nodev(struct file_system_type *fs_type, int flags, void *data, int (*fill_super)(struct super_block *, void *, int)); extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); void generic_shutdown_super(struct super_block *sb); void kill_block_super(struct super_block *sb); void kill_anon_super(struct super_block *sb); void kill_litter_super(struct super_block *sb); void deactivate_super(struct super_block *sb); void deactivate_locked_super(struct super_block *sb); int set_anon_super(struct super_block *s, void *data); int get_anon_bdev(dev_t *); void free_anon_bdev(dev_t); struct super_block *sget(struct file_system_type *type, int (*test)(struct super_block *,void *), int (*set)(struct super_block *,void *), void *data); extern struct dentry *mount_pseudo(struct file_system_type *, char *, const struct super_operations *ops, const struct dentry_operations *dops, unsigned long); extern int register_filesystem(struct file_system_type *); extern int unregister_filesystem(struct file_system_type *); extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); extern void kern_unmount(struct vfsmount *mnt); extern int may_umount_tree(struct vfsmount *); extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); extern struct vfsmount *collect_mounts(struct path *); extern void drop_collected_mounts(struct vfsmount *); extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, struct vfsmount *); extern int vfs_statfs(struct path *, struct kstatfs *); extern int user_statfs(const char *, struct kstatfs *); extern int fd_statfs(int, struct kstatfs *); extern int vfs_ustat(dev_t, struct kstatfs *); extern int freeze_super(struct super_block *super); extern int thaw_super(struct super_block *super); extern bool our_mnt(struct vfsmount *mnt); extern int current_umask(void); extern struct kobject *fs_kobj; extern int rw_verify_area(int, struct file *, loff_t *, size_t); extern int locks_mandatory_locked(struct inode *); extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); static inline __attribute__((no_instrument_function)) int __mandatory_lock(struct inode *ino) { return (ino->i_mode & (0002000 | 00010)) == 0002000; } static inline __attribute__((no_instrument_function)) int mandatory_lock(struct inode *ino) { return ((ino)->i_sb->s_flags & (64)) && __mandatory_lock(ino); } static inline __attribute__((no_instrument_function)) int locks_verify_locked(struct inode *inode) { if (mandatory_lock(inode)) return locks_mandatory_locked(inode); return 0; } static inline __attribute__((no_instrument_function)) int locks_verify_truncate(struct inode *inode, struct file *filp, loff_t size) { if (inode->i_flock && mandatory_lock(inode)) return locks_mandatory_area( 2, inode, filp, size < inode->i_size ? size : inode->i_size, (size < inode->i_size ? inode->i_size - size : size - inode->i_size) ); return 0; } static inline __attribute__((no_instrument_function)) int break_lease(struct inode *inode, unsigned int mode) { if (inode->i_flock) return __break_lease(inode, mode); return 0; } extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, struct file *filp); extern int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len); extern long do_sys_open(int dfd, const char *filename, int flags, umode_t mode); extern struct file *filp_open(const char *, int, umode_t); extern struct file *file_open_root(struct dentry *, struct vfsmount *, const char *, int); extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, const struct cred *); extern int filp_close(struct file *, fl_owner_t id); extern char * getname(const char *); extern int ioctl_preallocate(struct file *filp, void *argp); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) vfs_caches_init_early(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) vfs_caches_init(unsigned long); extern struct kmem_cache *names_cachep; extern void putname(const char *name); extern int register_blkdev(unsigned int, const char *); extern void unregister_blkdev(unsigned int, const char *); extern struct block_device *bdget(dev_t); extern struct block_device *bdgrab(struct block_device *bdev); extern void bd_set_size(struct block_device *, loff_t size); extern sector_t blkdev_max_block(struct block_device *bdev); extern void bd_forget(struct inode *inode); extern void bdput(struct block_device *); extern void invalidate_bdev(struct block_device *); extern int sync_blockdev(struct block_device *bdev); extern void kill_bdev(struct block_device *); extern struct super_block *freeze_bdev(struct block_device *); extern void emergency_thaw_all(void); extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); extern int fsync_bdev(struct block_device *); extern int sync_filesystem(struct super_block *); extern const struct file_operations def_blk_fops; extern const struct file_operations def_chr_fops; extern const struct file_operations bad_sock_fops; extern const struct file_operations def_fifo_fops; extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, void *holder); extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder); extern int blkdev_put(struct block_device *bdev, fmode_t mode); extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); extern void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk); extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); extern int register_chrdev_region(dev_t, unsigned, const char *); extern int __register_chrdev(unsigned int major, unsigned int baseminor, unsigned int count, const char *name, const struct file_operations *fops); extern void __unregister_chrdev(unsigned int major, unsigned int baseminor, unsigned int count, const char *name); extern void unregister_chrdev_region(dev_t, unsigned); extern void chrdev_show(struct seq_file *,off_t); static inline __attribute__((no_instrument_function)) int register_chrdev(unsigned int major, const char *name, const struct file_operations *fops) { return __register_chrdev(major, 0, 256, name, fops); } static inline __attribute__((no_instrument_function)) void unregister_chrdev(unsigned int major, const char *name) { __unregister_chrdev(major, 0, 256, name); } extern const char *__bdevname(dev_t, char *buffer); extern const char *bdevname(struct block_device *bdev, char *buffer); extern struct block_device *lookup_bdev(const char *); extern void blkdev_show(struct seq_file *,off_t); extern void init_special_inode(struct inode *, umode_t, dev_t); extern void make_bad_inode(struct inode *); extern int is_bad_inode(struct inode *); extern const struct file_operations read_pipefifo_fops; extern const struct file_operations write_pipefifo_fops; extern const struct file_operations rdwr_pipefifo_fops; extern void check_disk_size_change(struct gendisk *disk, struct block_device *bdev); extern int revalidate_disk(struct gendisk *); extern int check_disk_change(struct block_device *); extern int __invalidate_device(struct block_device *, bool); extern int invalidate_partition(struct gendisk *, int); unsigned long invalidate_mapping_pages(struct address_space *mapping, unsigned long start, unsigned long end); static inline __attribute__((no_instrument_function)) void invalidate_remote_inode(struct inode *inode) { if ((((inode->i_mode) & 00170000) == 0100000) || (((inode->i_mode) & 00170000) == 0040000) || (((inode->i_mode) & 00170000) == 0120000)) invalidate_mapping_pages(inode->i_mapping, 0, -1); } extern int invalidate_inode_pages2(struct address_space *mapping); extern int invalidate_inode_pages2_range(struct address_space *mapping, unsigned long start, unsigned long end); extern int write_inode_now(struct inode *, int); extern int filemap_fdatawrite(struct address_space *); extern int filemap_flush(struct address_space *); extern int filemap_fdatawait(struct address_space *); extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend); extern int filemap_write_and_wait(struct address_space *mapping); extern int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend); extern int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end, int sync_mode); extern int filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end); extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync); extern int vfs_fsync(struct file *file, int datasync); extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); extern void sync_supers(void); extern void emergency_sync(void); extern void emergency_remount(void); extern sector_t bmap(struct inode *, sector_t); extern int notify_change(struct dentry *, struct iattr *); extern int inode_permission(struct inode *, int); extern int generic_permission(struct inode *, int); static inline __attribute__((no_instrument_function)) bool execute_ok(struct inode *inode) { return (inode->i_mode & (00100|00010|00001)) || (((inode->i_mode) & 00170000) == 0040000); } static inline __attribute__((no_instrument_function)) int get_write_access(struct inode *inode) { return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -26; } static inline __attribute__((no_instrument_function)) int deny_write_access(struct file *file) { struct inode *inode = file->f_path.dentry->d_inode; return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -26; } static inline __attribute__((no_instrument_function)) void put_write_access(struct inode * inode) { atomic_dec(&inode->i_writecount); } static inline __attribute__((no_instrument_function)) void allow_write_access(struct file *file) { if (file) atomic_inc(&file->f_path.dentry->d_inode->i_writecount); } static inline __attribute__((no_instrument_function)) void i_readcount_dec(struct inode *inode) { do { if (ldv__builtin_expect(!!(!atomic_read(&inode->i_readcount)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/fs.h"), "i" (2260), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); atomic_dec(&inode->i_readcount); } static inline __attribute__((no_instrument_function)) void i_readcount_inc(struct inode *inode) { atomic_inc(&inode->i_readcount); } extern int do_pipe_flags(int *, int); extern struct file *create_read_pipe(struct file *f, int flags); extern struct file *create_write_pipe(int flags); extern void free_write_pipe(struct file *); extern int kernel_read(struct file *, loff_t, char *, unsigned long); extern struct file * open_exec(const char *); extern int is_subdir(struct dentry *, struct dentry *); extern int path_is_under(struct path *, struct path *); extern ino_t find_inode_number(struct dentry *, struct qstr *); extern loff_t default_llseek(struct file *file, loff_t offset, int origin); extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); extern int inode_init_always(struct super_block *, struct inode *); extern void inode_init_once(struct inode *); extern void address_space_init_once(struct address_space *mapping); extern void ihold(struct inode * inode); extern void iput(struct inode *); extern struct inode * igrab(struct inode *); extern ino_t iunique(struct super_block *, ino_t); extern int inode_needs_sync(struct inode *inode); extern int generic_delete_inode(struct inode *inode); static inline __attribute__((no_instrument_function)) int generic_drop_inode(struct inode *inode) { return !inode->i_nlink || inode_unhashed(inode); } extern struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval, int (*test)(struct inode *, void *), void *data); extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, int (*test)(struct inode *, void *), void *data); extern struct inode *ilookup(struct super_block *sb, unsigned long ino); extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *); extern struct inode * iget_locked(struct super_block *, unsigned long); extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); extern int insert_inode_locked(struct inode *); static inline __attribute__((no_instrument_function)) void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; extern void unlock_new_inode(struct inode *); extern unsigned int get_next_ino(void); extern void __iget(struct inode * inode); extern void iget_failed(struct inode *); extern void end_writeback(struct inode *); extern void __destroy_inode(struct inode *); extern struct inode *new_inode_pseudo(struct super_block *sb); extern struct inode *new_inode(struct super_block *sb); extern void free_inode_nonrcu(struct inode *inode); extern int should_remove_suid(struct dentry *); extern int file_remove_suid(struct file *); extern void __insert_inode_hash(struct inode *, unsigned long hashval); static inline __attribute__((no_instrument_function)) void insert_inode_hash(struct inode *inode) { __insert_inode_hash(inode, inode->i_ino); } extern void __remove_inode_hash(struct inode *); static inline __attribute__((no_instrument_function)) void remove_inode_hash(struct inode *inode) { if (!inode_unhashed(inode)) __remove_inode_hash(inode); } extern void inode_sb_list_add(struct inode *inode); extern void submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); extern int set_blocksize(struct block_device *, int); extern int sb_set_blocksize(struct super_block *, int); extern int sb_min_blocksize(struct super_block *, int); extern int generic_file_mmap(struct file *, struct vm_area_struct *); extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t *); extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, unsigned long *, loff_t, loff_t *, size_t, size_t); extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, unsigned long, loff_t, loff_t *, size_t, ssize_t); extern ssize_t do_sync_read(struct file *filp, char *buf, size_t len, loff_t *ppos); extern ssize_t do_sync_write(struct file *filp, const char *buf, size_t len, loff_t *ppos); extern int generic_segment_checks(const struct iovec *iov, unsigned long *nr_segs, size_t *count, int access_flags); extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync); extern void block_sync_page(struct page *page); extern ssize_t generic_file_splice_read(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); extern ssize_t default_file_splice_read(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); extern ssize_t generic_file_splice_write(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, struct file *out, loff_t *, size_t len, unsigned int flags); extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, size_t len, unsigned int flags); extern void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); extern loff_t no_llseek(struct file *file, loff_t offset, int origin); extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, int origin, loff_t maxsize); extern int generic_file_open(struct inode * inode, struct file * filp); extern int nonseekable_open(struct inode * inode, struct file * filp); extern ssize_t xip_file_read(struct file *filp, char *buf, size_t len, loff_t *ppos); extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma); extern ssize_t xip_file_write(struct file *filp, const char *buf, size_t len, loff_t *ppos); extern int xip_truncate_page(struct address_space *mapping, loff_t from); typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, loff_t file_offset); enum { DIO_LOCKING = 0x01, DIO_SKIP_HOLES = 0x02, }; void dio_end_io(struct bio *bio, int error); void inode_dio_wait(struct inode *inode); void inode_dio_done(struct inode *inode); ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, struct block_device *bdev, const struct iovec *iov, loff_t offset, unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, dio_submit_t submit_io, int flags); static inline __attribute__((no_instrument_function)) ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, const struct iovec *iov, loff_t offset, unsigned long nr_segs, get_block_t get_block) { return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, get_block, ((void *)0), ((void *)0), DIO_LOCKING | DIO_SKIP_HOLES); } extern const struct file_operations generic_ro_fops; extern int vfs_readlink(struct dentry *, char *, int, const char *); extern int vfs_follow_link(struct nameidata *, const char *); extern int page_readlink(struct dentry *, char *, int); extern void *page_follow_link_light(struct dentry *, struct nameidata *); extern void page_put_link(struct dentry *, struct nameidata *, void *); extern int __page_symlink(struct inode *inode, const char *symname, int len, int nofs); extern int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; extern int generic_readlink(struct dentry *, char *, int); extern void generic_fillattr(struct inode *, struct kstat *); extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); void __inode_add_bytes(struct inode *inode, loff_t bytes); void inode_add_bytes(struct inode *inode, loff_t bytes); void inode_sub_bytes(struct inode *inode, loff_t bytes); loff_t inode_get_bytes(struct inode *inode); void inode_set_bytes(struct inode *inode, loff_t bytes); extern int vfs_readdir(struct file *, filldir_t, void *); extern int vfs_stat(const char *, struct kstat *); extern int vfs_lstat(const char *, struct kstat *); extern int vfs_fstat(unsigned int, struct kstat *); extern int vfs_fstatat(int , const char *, struct kstat *, int); extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg); extern int __generic_block_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, loff_t start, loff_t len, get_block_t *get_block); extern int generic_block_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len, get_block_t *get_block); extern void get_filesystem(struct file_system_type *fs); extern void put_filesystem(struct file_system_type *fs); extern struct file_system_type *get_fs_type(const char *name); extern struct super_block *get_super(struct block_device *); extern struct super_block *get_super_thawed(struct block_device *); extern struct super_block *get_active_super(struct block_device *bdev); extern void drop_super(struct super_block *sb); extern void iterate_supers(void (*)(struct super_block *, void *), void *); extern void iterate_supers_type(struct file_system_type *, void (*)(struct super_block *, void *), void *); extern int dcache_dir_open(struct inode *, struct file *); extern int dcache_dir_close(struct inode *, struct file *); extern loff_t dcache_dir_lseek(struct file *, loff_t, int); extern int dcache_readdir(struct file *, void *, filldir_t); extern int simple_setattr(struct dentry *, struct iattr *); extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); extern int simple_statfs(struct dentry *, struct kstatfs *); extern int simple_open(struct inode *inode, struct file *file); extern int simple_link(struct dentry *, struct inode *, struct dentry *); extern int simple_unlink(struct inode *, struct dentry *); extern int simple_rmdir(struct inode *, struct dentry *); extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); extern int noop_fsync(struct file *, loff_t, loff_t, int); extern int simple_empty(struct dentry *); extern int simple_readpage(struct file *file, struct page *page); extern int simple_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata); extern int simple_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata); extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *); extern const struct file_operations simple_dir_operations; extern const struct inode_operations simple_dir_inode_operations; struct tree_descr { char *name; const struct file_operations *ops; int mode; }; struct dentry *d_alloc_name(struct dentry *, const char *); extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *); extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); extern void simple_release_fs(struct vfsmount **mount, int *count); extern ssize_t simple_read_from_buffer(void *to, size_t count, loff_t *ppos, const void *from, size_t available); extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, const void *from, size_t count); extern int generic_file_fsync(struct file *, loff_t, loff_t, int); extern int generic_check_addressable(unsigned, u64); extern int buffer_migrate_page(struct address_space *, struct page *, struct page *, enum migrate_mode); extern int inode_change_ok(const struct inode *, struct iattr *); extern int inode_newsize_ok(const struct inode *, loff_t offset); extern void setattr_copy(struct inode *inode, const struct iattr *attr); extern void file_update_time(struct file *file); extern int generic_show_options(struct seq_file *m, struct dentry *root); extern void save_mount_options(struct super_block *sb, char *options); extern void replace_mount_options(struct super_block *sb, char *options); static inline __attribute__((no_instrument_function)) ino_t parent_ino(struct dentry *dentry) { ino_t res; spin_lock(&dentry->d_lock); res = dentry->d_parent->d_inode->i_ino; spin_unlock(&dentry->d_lock); return res; } struct simple_transaction_argresp { ssize_t size; char data[0]; }; char *simple_transaction_get(struct file *file, const char *buf, size_t size); ssize_t simple_transaction_read(struct file *file, char *buf, size_t size, loff_t *pos); int simple_transaction_release(struct inode *inode, struct file *file); void simple_transaction_set(struct file *file, size_t n); static inline __attribute__((no_instrument_function)) __attribute__((format(printf, 1, 2))) void __simple_attr_check_format(const char *fmt, ...) { } int simple_attr_open(struct inode *inode, struct file *file, int (*get)(void *, u64 *), int (*set)(void *, u64), const char *fmt); int simple_attr_release(struct inode *inode, struct file *file); ssize_t simple_attr_read(struct file *file, char *buf, size_t len, loff_t *ppos); ssize_t simple_attr_write(struct file *file, const char *buf, size_t len, loff_t *ppos); struct ctl_table; int proc_nr_files(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); int proc_nr_dentry(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); int proc_nr_inodes(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) get_filesystem_list(char *buf); static inline __attribute__((no_instrument_function)) int is_sxid(umode_t mode) { return (mode & 0004000) || ((mode & 0002000) && (mode & 00010)); } static inline __attribute__((no_instrument_function)) void inode_has_no_xattr(struct inode *inode) { if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & (1<<28))) inode->i_flags |= 4096; } struct sched_param { int sched_priority; }; enum page_debug_flags { PAGE_DEBUG_FLAG_POISON, PAGE_DEBUG_FLAG_GUARD, }; struct address_space; struct page { unsigned long flags; struct address_space *mapping; struct { union { unsigned long index; void *freelist; }; union { unsigned long counters; struct { union { atomic_t _mapcount; struct { unsigned inuse:16; unsigned objects:15; unsigned frozen:1; }; }; atomic_t _count; }; }; }; union { struct list_head lru; struct { struct page *next; int pages; int pobjects; }; }; union { unsigned long private; struct kmem_cache *slab; struct page *first_page; }; unsigned long debug_flags; } __attribute__((aligned(2 * sizeof(unsigned long)))) ; struct page_frag { struct page *page; __u32 offset; __u32 size; }; typedef unsigned long vm_flags_t; struct vm_region { struct rb_node vm_rb; vm_flags_t vm_flags; unsigned long vm_start; unsigned long vm_end; unsigned long vm_top; unsigned long vm_pgoff; struct file *vm_file; int vm_usage; bool vm_icache_flushed : 1; }; struct vm_area_struct { struct mm_struct * vm_mm; unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next, *vm_prev; pgprot_t vm_page_prot; unsigned long vm_flags; struct rb_node vm_rb; union { struct { struct list_head list; void *parent; struct vm_area_struct *head; } vm_set; struct raw_prio_tree_node prio_tree_node; } shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file * vm_file; void * vm_private_data; struct mempolicy *vm_policy; }; struct core_thread { struct task_struct *task; struct core_thread *next; }; struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; }; enum { MM_FILEPAGES, MM_ANONPAGES, MM_SWAPENTS, NR_MM_COUNTERS }; struct mm_rss_stat { atomic_long_t count[NR_MM_COUNTERS]; }; struct mm_struct { struct vm_area_struct * mmap; struct rb_root mm_rb; struct vm_area_struct * mmap_cache; unsigned long (*get_unmapped_area) (struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); void (*unmap_area) (struct mm_struct *mm, unsigned long addr); unsigned long mmap_base; unsigned long task_size; unsigned long cached_hole_size; unsigned long free_area_cache; pgd_t * pgd; atomic_t mm_users; atomic_t mm_count; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long shared_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long reserved_vm; unsigned long def_flags; unsigned long nr_ptes; unsigned long start_code, end_code, start_data, end_data; unsigned long start_brk, brk, start_stack; unsigned long arg_start, arg_end, env_start, env_end; unsigned long saved_auxv[(2*(2 + 19 + 1))]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned int faultstamp; unsigned int token_priority; unsigned int last_interval; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct hlist_head ioctx_list; struct task_struct *owner; struct file *exe_file; unsigned long num_exe_file_vmas; struct mmu_notifier_mm *mmu_notifier_mm; pgtable_t pmd_huge_pte; struct cpumask cpumask_allocation; }; static inline __attribute__((no_instrument_function)) void mm_init_cpumask(struct mm_struct *mm) { mm->cpu_vm_mask_var = &mm->cpumask_allocation; } static inline __attribute__((no_instrument_function)) cpumask_t *mm_cpumask(struct mm_struct *mm) { return mm->cpu_vm_mask_var; } typedef unsigned long cputime_t; typedef u64 cputime64_t; struct ipc_perm { __kernel_key_t key; __kernel_uid_t uid; __kernel_gid_t gid; __kernel_uid_t cuid; __kernel_gid_t cgid; __kernel_mode_t mode; unsigned short seq; }; struct ipc64_perm { __kernel_key_t key; __kernel_uid32_t uid; __kernel_gid32_t gid; __kernel_uid32_t cuid; __kernel_gid32_t cgid; __kernel_mode_t mode; unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; unsigned short seq; unsigned short __pad2; unsigned long __unused1; unsigned long __unused2; }; struct ipc_kludge { struct msgbuf *msgp; long msgtyp; }; struct kern_ipc_perm { spinlock_t lock; int deleted; int id; key_t key; uid_t uid; gid_t gid; uid_t cuid; gid_t cgid; umode_t mode; unsigned long seq; void *security; }; struct semid_ds { struct ipc_perm sem_perm; __kernel_time_t sem_otime; __kernel_time_t sem_ctime; struct sem *sem_base; struct sem_queue *sem_pending; struct sem_queue **sem_pending_last; struct sem_undo *undo; unsigned short sem_nsems; }; struct semid64_ds { struct ipc64_perm sem_perm; __kernel_time_t sem_otime; unsigned long __unused1; __kernel_time_t sem_ctime; unsigned long __unused2; unsigned long sem_nsems; unsigned long __unused3; unsigned long __unused4; }; struct sembuf { unsigned short sem_num; short sem_op; short sem_flg; }; union semun { int val; struct semid_ds *buf; unsigned short *array; struct seminfo *__buf; void *__pad; }; struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; struct task_struct; struct sem_array { struct kern_ipc_perm __attribute__((__aligned__((1 << (6))))) sem_perm; time_t sem_otime; time_t sem_ctime; struct sem *sem_base; struct list_head sem_pending; struct list_head list_id; int sem_nsems; int complex_count; }; struct sysv_sem { struct sem_undo_list *undo_list; }; extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); extern void exit_sem(struct task_struct *tsk); struct siginfo; typedef unsigned long old_sigset_t; typedef struct { unsigned long sig[(64 / 64)]; } sigset_t; typedef void __signalfn_t(int); typedef __signalfn_t *__sighandler_t; typedef void __restorefn_t(void); typedef __restorefn_t *__sigrestore_t; extern void do_notify_resume(struct pt_regs *, void *, __u32); struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; }; struct k_sigaction { struct sigaction sa; }; typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; typedef struct siginfo { int si_signo; int si_errno; int si_code; union { int _pad[((128 - (4 * sizeof(int))) / sizeof(int))]; struct { __kernel_pid_t _pid; __kernel_uid32_t _uid; } _kill; struct { __kernel_timer_t _tid; int _overrun; char _pad[sizeof( __kernel_uid32_t) - sizeof(int)]; sigval_t _sigval; int _sys_private; } _timer; struct { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } _rt; struct { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } _sigchld; struct { void *_addr; short _addr_lsb; } _sigfault; struct { long _band; int _fd; } _sigpoll; } _sifields; } siginfo_t; typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[((64 - (sizeof(int) * 2 + sizeof(sigval_t))) / sizeof(int))]; int _tid; struct { void (*_function)(sigval_t); void *_attribute; } _sigev_thread; } _sigev_un; } sigevent_t; struct siginfo; void do_schedule_next_timer(struct siginfo *info); static inline __attribute__((no_instrument_function)) void copy_siginfo(struct siginfo *to, struct siginfo *from) { if (from->si_code < 0) ({ size_t __len = (sizeof(*to)); void *__ret; if (__builtin_constant_p(sizeof(*to)) && __len >= 64) __ret = __memcpy((to), (from), __len); else __ret = __builtin_memcpy((to), (from), __len); __ret; }); else ({ size_t __len = ((4 * sizeof(int)) + sizeof(from->_sifields._sigchld)); void *__ret; if (__builtin_constant_p((4 * sizeof(int)) + sizeof(from->_sifields._sigchld)) && __len >= 64) __ret = __memcpy((to), (from), __len); else __ret = __builtin_memcpy((to), (from), __len); __ret; }); } extern int copy_siginfo_to_user(struct siginfo *to, struct siginfo *from); struct task_struct; extern int print_fatal_signals; struct sigqueue { struct list_head list; int flags; siginfo_t info; struct user_struct *user; }; struct sigpending { struct list_head list; sigset_t signal; }; static inline __attribute__((no_instrument_function)) void sigaddset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if ((64 / 64) == 1) set->sig[0] |= 1UL << sig; else set->sig[sig / 64] |= 1UL << (sig % 64); } static inline __attribute__((no_instrument_function)) void sigdelset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if ((64 / 64) == 1) set->sig[0] &= ~(1UL << sig); else set->sig[sig / 64] &= ~(1UL << (sig % 64)); } static inline __attribute__((no_instrument_function)) int sigismember(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if ((64 / 64) == 1) return 1 & (set->sig[0] >> sig); else return 1 & (set->sig[sig / 64] >> (sig % 64)); } static inline __attribute__((no_instrument_function)) int sigfindinword(unsigned long word) { return ffz(~word); } static inline __attribute__((no_instrument_function)) int sigisemptyset(sigset_t *set) { extern void _NSIG_WORDS_is_unsupported_size(void); switch ((64 / 64)) { case 4: return (set->sig[3] | set->sig[2] | set->sig[1] | set->sig[0]) == 0; case 2: return (set->sig[1] | set->sig[0]) == 0; case 1: return set->sig[0] == 0; default: _NSIG_WORDS_is_unsupported_size(); return 0; } } static inline __attribute__((no_instrument_function)) void sigorsets(sigset_t *r, const sigset_t *a, const sigset_t *b) { extern void _NSIG_WORDS_is_unsupported_size(void); unsigned long a0, a1, a2, a3, b0, b1, b2, b3; switch ((64 / 64)) { case 4: a3 = a->sig[3]; a2 = a->sig[2]; b3 = b->sig[3]; b2 = b->sig[2]; r->sig[3] = ((a3) | (b3)); r->sig[2] = ((a2) | (b2)); case 2: a1 = a->sig[1]; b1 = b->sig[1]; r->sig[1] = ((a1) | (b1)); case 1: a0 = a->sig[0]; b0 = b->sig[0]; r->sig[0] = ((a0) | (b0)); break; default: _NSIG_WORDS_is_unsupported_size(); } } static inline __attribute__((no_instrument_function)) void sigandsets(sigset_t *r, const sigset_t *a, const sigset_t *b) { extern void _NSIG_WORDS_is_unsupported_size(void); unsigned long a0, a1, a2, a3, b0, b1, b2, b3; switch ((64 / 64)) { case 4: a3 = a->sig[3]; a2 = a->sig[2]; b3 = b->sig[3]; b2 = b->sig[2]; r->sig[3] = ((a3) & (b3)); r->sig[2] = ((a2) & (b2)); case 2: a1 = a->sig[1]; b1 = b->sig[1]; r->sig[1] = ((a1) & (b1)); case 1: a0 = a->sig[0]; b0 = b->sig[0]; r->sig[0] = ((a0) & (b0)); break; default: _NSIG_WORDS_is_unsupported_size(); } } static inline __attribute__((no_instrument_function)) void sigandnsets(sigset_t *r, const sigset_t *a, const sigset_t *b) { extern void _NSIG_WORDS_is_unsupported_size(void); unsigned long a0, a1, a2, a3, b0, b1, b2, b3; switch ((64 / 64)) { case 4: a3 = a->sig[3]; a2 = a->sig[2]; b3 = b->sig[3]; b2 = b->sig[2]; r->sig[3] = ((a3) & ~(b3)); r->sig[2] = ((a2) & ~(b2)); case 2: a1 = a->sig[1]; b1 = b->sig[1]; r->sig[1] = ((a1) & ~(b1)); case 1: a0 = a->sig[0]; b0 = b->sig[0]; r->sig[0] = ((a0) & ~(b0)); break; default: _NSIG_WORDS_is_unsupported_size(); } } static inline __attribute__((no_instrument_function)) void signotset(sigset_t *set) { extern void _NSIG_WORDS_is_unsupported_size(void); switch ((64 / 64)) { case 4: set->sig[3] = (~(set->sig[3])); set->sig[2] = (~(set->sig[2])); case 2: set->sig[1] = (~(set->sig[1])); case 1: set->sig[0] = (~(set->sig[0])); break; default: _NSIG_WORDS_is_unsupported_size(); } } static inline __attribute__((no_instrument_function)) void sigemptyset(sigset_t *set) { switch ((64 / 64)) { default: memset(set, 0, sizeof(sigset_t)); break; case 2: set->sig[1] = 0; case 1: set->sig[0] = 0; break; } } static inline __attribute__((no_instrument_function)) void sigfillset(sigset_t *set) { switch ((64 / 64)) { default: memset(set, -1, sizeof(sigset_t)); break; case 2: set->sig[1] = -1; case 1: set->sig[0] = -1; break; } } static inline __attribute__((no_instrument_function)) void sigaddsetmask(sigset_t *set, unsigned long mask) { set->sig[0] |= mask; } static inline __attribute__((no_instrument_function)) void sigdelsetmask(sigset_t *set, unsigned long mask) { set->sig[0] &= ~mask; } static inline __attribute__((no_instrument_function)) int sigtestsetmask(sigset_t *set, unsigned long mask) { return (set->sig[0] & mask) != 0; } static inline __attribute__((no_instrument_function)) void siginitset(sigset_t *set, unsigned long mask) { set->sig[0] = mask; switch ((64 / 64)) { default: memset(&set->sig[1], 0, sizeof(long)*((64 / 64)-1)); break; case 2: set->sig[1] = 0; case 1: ; } } static inline __attribute__((no_instrument_function)) void siginitsetinv(sigset_t *set, unsigned long mask) { set->sig[0] = ~mask; switch ((64 / 64)) { default: memset(&set->sig[1], -1, sizeof(long)*((64 / 64)-1)); break; case 2: set->sig[1] = -1; case 1: ; } } static inline __attribute__((no_instrument_function)) void init_sigpending(struct sigpending *sig) { sigemptyset(&sig->signal); INIT_LIST_HEAD(&sig->list); } extern void flush_sigqueue(struct sigpending *queue); static inline __attribute__((no_instrument_function)) int valid_signal(unsigned long sig) { return sig <= 64 ? 1 : 0; } struct timespec; struct pt_regs; extern int next_signal(struct sigpending *pending, sigset_t *mask); extern int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, bool group); extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info); extern long do_sigpending(void *, unsigned long); extern int do_sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *); extern int sigprocmask(int, sigset_t *, sigset_t *); extern void set_current_blocked(const sigset_t *); extern int show_unhandled_signals; extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); extern void block_sigmask(struct k_sigaction *ka, int signr); extern void exit_signals(struct task_struct *tsk); extern struct kmem_cache *sighand_cachep; int unhandled_signal(struct task_struct *tsk, int sig); void signals_init(void); struct prop_global { int shift; struct percpu_counter events; }; struct prop_descriptor { int index; struct prop_global pg[2]; struct mutex mutex; }; int prop_descriptor_init(struct prop_descriptor *pd, int shift); void prop_change_shift(struct prop_descriptor *pd, int new_shift); struct prop_local_percpu { struct percpu_counter events; int shift; unsigned long period; raw_spinlock_t lock; }; int prop_local_init_percpu(struct prop_local_percpu *pl); void prop_local_destroy_percpu(struct prop_local_percpu *pl); void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, long *numerator, long *denominator); static inline __attribute__((no_instrument_function)) void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); __prop_inc_percpu(pd, pl); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); } void __prop_inc_percpu_max(struct prop_descriptor *pd, struct prop_local_percpu *pl, long frac); struct prop_local_single { unsigned long events; unsigned long period; int shift; raw_spinlock_t lock; }; int prop_local_init_single(struct prop_local_single *pl); void prop_local_destroy_single(struct prop_local_single *pl); void __prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl); void prop_fraction_single(struct prop_descriptor *pd, struct prop_local_single *pl, long *numerator, long *denominator); static inline __attribute__((no_instrument_function)) void prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl) { unsigned long flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); __prop_inc_single(pd, pl); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); } typedef struct { int mode; } seccomp_t; extern void __secure_computing(int); static inline __attribute__((no_instrument_function)) void secure_computing(int this_syscall) { if (ldv__builtin_expect(!!(test_ti_thread_flag(current_thread_info(), 8)), 0)) __secure_computing(this_syscall); } extern long prctl_get_seccomp(void); extern long prctl_set_seccomp(unsigned long); static inline __attribute__((no_instrument_function)) int seccomp_mode(seccomp_t *s) { return s->mode; } struct plist_head { struct list_head node_list; }; struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; }; static inline __attribute__((no_instrument_function)) void plist_head_init(struct plist_head *head) { INIT_LIST_HEAD(&head->node_list); } static inline __attribute__((no_instrument_function)) void plist_node_init(struct plist_node *node, int prio) { node->prio = prio; INIT_LIST_HEAD(&node->prio_list); INIT_LIST_HEAD(&node->node_list); } extern void plist_add(struct plist_node *node, struct plist_head *head); extern void plist_del(struct plist_node *node, struct plist_head *head); static inline __attribute__((no_instrument_function)) int plist_head_empty(const struct plist_head *head) { return list_empty(&head->node_list); } static inline __attribute__((no_instrument_function)) int plist_node_empty(const struct plist_node *node) { return list_empty(&node->node_list); } static inline __attribute__((no_instrument_function)) struct plist_node *plist_first(const struct plist_head *head) { return ({ const typeof( ((struct plist_node *)0)->node_list ) *__mptr = (head->node_list.next); (struct plist_node *)( (char *)__mptr - __builtin_offsetof(struct plist_node,node_list) );}) ; } static inline __attribute__((no_instrument_function)) struct plist_node *plist_last(const struct plist_head *head) { return ({ const typeof( ((struct plist_node *)0)->node_list ) *__mptr = (head->node_list.prev); (struct plist_node *)( (char *)__mptr - __builtin_offsetof(struct plist_node,node_list) );}) ; } extern int max_lock_depth; struct rt_mutex { raw_spinlock_t wait_lock; struct plist_head wait_list; struct task_struct *owner; int save_state; const char *name, *file; int line; void *magic; }; struct rt_mutex_waiter; struct hrtimer_sleeper; extern int rt_mutex_debug_check_no_locks_freed(const void *from, unsigned long len); extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task); extern void rt_mutex_debug_task_free(struct task_struct *tsk); static inline __attribute__((no_instrument_function)) int rt_mutex_is_locked(struct rt_mutex *lock) { return lock->owner != ((void *)0); } extern void __rt_mutex_init(struct rt_mutex *lock, const char *name); extern void rt_mutex_destroy(struct rt_mutex *lock); extern void rt_mutex_lock(struct rt_mutex *lock); extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, int detect_deadlock); extern int rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout, int detect_deadlock); extern int rt_mutex_trylock(struct rt_mutex *lock); extern void rt_mutex_unlock(struct rt_mutex *lock); struct rusage { struct timeval ru_utime; struct timeval ru_stime; long ru_maxrss; long ru_ixrss; long ru_idrss; long ru_isrss; long ru_minflt; long ru_majflt; long ru_nswap; long ru_inblock; long ru_oublock; long ru_msgsnd; long ru_msgrcv; long ru_nsignals; long ru_nvcsw; long ru_nivcsw; }; struct rlimit { unsigned long rlim_cur; unsigned long rlim_max; }; struct rlimit64 { __u64 rlim_cur; __u64 rlim_max; }; struct task_struct; int getrusage(struct task_struct *p, int who, struct rusage *ru); int do_prlimit(struct task_struct *tsk, unsigned int resource, struct rlimit *new_rlim, struct rlimit *old_rlim); struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; }; struct task_struct; struct latency_record { unsigned long backtrace[12]; unsigned int count; unsigned long time; unsigned long max; }; extern int latencytop_enabled; void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); static inline __attribute__((no_instrument_function)) void account_scheduler_latency(struct task_struct *task, int usecs, int inter) { if (ldv__builtin_expect(!!(latencytop_enabled), 0)) __account_scheduler_latency(task, usecs, inter); } void clear_all_latency_tracing(struct task_struct *p); struct completion; struct __sysctl_args { int *name; int nlen; void *oldval; size_t *oldlenp; void *newval; size_t newlen; unsigned long __unused[4]; }; enum { CTL_KERN=1, CTL_VM=2, CTL_NET=3, CTL_PROC=4, CTL_FS=5, CTL_DEBUG=6, CTL_DEV=7, CTL_BUS=8, CTL_ABI=9, CTL_CPU=10, CTL_ARLAN=254, CTL_S390DBF=5677, CTL_SUNRPC=7249, CTL_PM=9899, CTL_FRV=9898, }; enum { CTL_BUS_ISA=1 }; enum { INOTIFY_MAX_USER_INSTANCES=1, INOTIFY_MAX_USER_WATCHES=2, INOTIFY_MAX_QUEUED_EVENTS=3 }; enum { KERN_OSTYPE=1, KERN_OSRELEASE=2, KERN_OSREV=3, KERN_VERSION=4, KERN_SECUREMASK=5, KERN_PROF=6, KERN_NODENAME=7, KERN_DOMAINNAME=8, KERN_PANIC=15, KERN_REALROOTDEV=16, KERN_SPARC_REBOOT=21, KERN_CTLALTDEL=22, KERN_PRINTK=23, KERN_NAMETRANS=24, KERN_PPC_HTABRECLAIM=25, KERN_PPC_ZEROPAGED=26, KERN_PPC_POWERSAVE_NAP=27, KERN_MODPROBE=28, KERN_SG_BIG_BUFF=29, KERN_ACCT=30, KERN_PPC_L2CR=31, KERN_RTSIGNR=32, KERN_RTSIGMAX=33, KERN_SHMMAX=34, KERN_MSGMAX=35, KERN_MSGMNB=36, KERN_MSGPOOL=37, KERN_SYSRQ=38, KERN_MAX_THREADS=39, KERN_RANDOM=40, KERN_SHMALL=41, KERN_MSGMNI=42, KERN_SEM=43, KERN_SPARC_STOP_A=44, KERN_SHMMNI=45, KERN_OVERFLOWUID=46, KERN_OVERFLOWGID=47, KERN_SHMPATH=48, KERN_HOTPLUG=49, KERN_IEEE_EMULATION_WARNINGS=50, KERN_S390_USER_DEBUG_LOGGING=51, KERN_CORE_USES_PID=52, KERN_TAINTED=53, KERN_CADPID=54, KERN_PIDMAX=55, KERN_CORE_PATTERN=56, KERN_PANIC_ON_OOPS=57, KERN_HPPA_PWRSW=58, KERN_HPPA_UNALIGNED=59, KERN_PRINTK_RATELIMIT=60, KERN_PRINTK_RATELIMIT_BURST=61, KERN_PTY=62, KERN_NGROUPS_MAX=63, KERN_SPARC_SCONS_PWROFF=64, KERN_HZ_TIMER=65, KERN_UNKNOWN_NMI_PANIC=66, KERN_BOOTLOADER_TYPE=67, KERN_RANDOMIZE=68, KERN_SETUID_DUMPABLE=69, KERN_SPIN_RETRY=70, KERN_ACPI_VIDEO_FLAGS=71, KERN_IA64_UNALIGNED=72, KERN_COMPAT_LOG=73, KERN_MAX_LOCK_DEPTH=74, KERN_NMI_WATCHDOG=75, KERN_PANIC_ON_NMI=76, }; enum { VM_UNUSED1=1, VM_UNUSED2=2, VM_UNUSED3=3, VM_UNUSED4=4, VM_OVERCOMMIT_MEMORY=5, VM_UNUSED5=6, VM_UNUSED7=7, VM_UNUSED8=8, VM_UNUSED9=9, VM_PAGE_CLUSTER=10, VM_DIRTY_BACKGROUND=11, VM_DIRTY_RATIO=12, VM_DIRTY_WB_CS=13, VM_DIRTY_EXPIRE_CS=14, VM_NR_PDFLUSH_THREADS=15, VM_OVERCOMMIT_RATIO=16, VM_PAGEBUF=17, VM_HUGETLB_PAGES=18, VM_SWAPPINESS=19, VM_LOWMEM_RESERVE_RATIO=20, VM_MIN_FREE_KBYTES=21, VM_MAX_MAP_COUNT=22, VM_LAPTOP_MODE=23, VM_BLOCK_DUMP=24, VM_HUGETLB_GROUP=25, VM_VFS_CACHE_PRESSURE=26, VM_LEGACY_VA_LAYOUT=27, VM_SWAP_TOKEN_TIMEOUT=28, VM_DROP_PAGECACHE=29, VM_PERCPU_PAGELIST_FRACTION=30, VM_ZONE_RECLAIM_MODE=31, VM_MIN_UNMAPPED=32, VM_PANIC_ON_OOM=33, VM_VDSO_ENABLED=34, VM_MIN_SLAB=35, }; enum { NET_CORE=1, NET_ETHER=2, NET_802=3, NET_UNIX=4, NET_IPV4=5, NET_IPX=6, NET_ATALK=7, NET_NETROM=8, NET_AX25=9, NET_BRIDGE=10, NET_ROSE=11, NET_IPV6=12, NET_X25=13, NET_TR=14, NET_DECNET=15, NET_ECONET=16, NET_SCTP=17, NET_LLC=18, NET_NETFILTER=19, NET_DCCP=20, NET_IRDA=412, }; enum { RANDOM_POOLSIZE=1, RANDOM_ENTROPY_COUNT=2, RANDOM_READ_THRESH=3, RANDOM_WRITE_THRESH=4, RANDOM_BOOT_ID=5, RANDOM_UUID=6 }; enum { PTY_MAX=1, PTY_NR=2 }; enum { BUS_ISA_MEM_BASE=1, BUS_ISA_PORT_BASE=2, BUS_ISA_PORT_SHIFT=3 }; enum { NET_CORE_WMEM_MAX=1, NET_CORE_RMEM_MAX=2, NET_CORE_WMEM_DEFAULT=3, NET_CORE_RMEM_DEFAULT=4, NET_CORE_MAX_BACKLOG=6, NET_CORE_FASTROUTE=7, NET_CORE_MSG_COST=8, NET_CORE_MSG_BURST=9, NET_CORE_OPTMEM_MAX=10, NET_CORE_HOT_LIST_LENGTH=11, NET_CORE_DIVERT_VERSION=12, NET_CORE_NO_CONG_THRESH=13, NET_CORE_NO_CONG=14, NET_CORE_LO_CONG=15, NET_CORE_MOD_CONG=16, NET_CORE_DEV_WEIGHT=17, NET_CORE_SOMAXCONN=18, NET_CORE_BUDGET=19, NET_CORE_AEVENT_ETIME=20, NET_CORE_AEVENT_RSEQTH=21, NET_CORE_WARNINGS=22, }; enum { NET_UNIX_DESTROY_DELAY=1, NET_UNIX_DELETE_DELAY=2, NET_UNIX_MAX_DGRAM_QLEN=3, }; enum { NET_NF_CONNTRACK_MAX=1, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_NF_CONNTRACK_UDP_TIMEOUT=10, NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_NF_CONNTRACK_BUCKETS=14, NET_NF_CONNTRACK_LOG_INVALID=15, NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_NF_CONNTRACK_TCP_LOOSE=17, NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_NF_CONNTRACK_COUNT=27, NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, NET_NF_CONNTRACK_CHECKSUM=32, }; enum { NET_IPV4_FORWARD=8, NET_IPV4_DYNADDR=9, NET_IPV4_CONF=16, NET_IPV4_NEIGH=17, NET_IPV4_ROUTE=18, NET_IPV4_FIB_HASH=19, NET_IPV4_NETFILTER=20, NET_IPV4_TCP_TIMESTAMPS=33, NET_IPV4_TCP_WINDOW_SCALING=34, NET_IPV4_TCP_SACK=35, NET_IPV4_TCP_RETRANS_COLLAPSE=36, NET_IPV4_DEFAULT_TTL=37, NET_IPV4_AUTOCONFIG=38, NET_IPV4_NO_PMTU_DISC=39, NET_IPV4_TCP_SYN_RETRIES=40, NET_IPV4_IPFRAG_HIGH_THRESH=41, NET_IPV4_IPFRAG_LOW_THRESH=42, NET_IPV4_IPFRAG_TIME=43, NET_IPV4_TCP_MAX_KA_PROBES=44, NET_IPV4_TCP_KEEPALIVE_TIME=45, NET_IPV4_TCP_KEEPALIVE_PROBES=46, NET_IPV4_TCP_RETRIES1=47, NET_IPV4_TCP_RETRIES2=48, NET_IPV4_TCP_FIN_TIMEOUT=49, NET_IPV4_IP_MASQ_DEBUG=50, NET_TCP_SYNCOOKIES=51, NET_TCP_STDURG=52, NET_TCP_RFC1337=53, NET_TCP_SYN_TAILDROP=54, NET_TCP_MAX_SYN_BACKLOG=55, NET_IPV4_LOCAL_PORT_RANGE=56, NET_IPV4_ICMP_ECHO_IGNORE_ALL=57, NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58, NET_IPV4_ICMP_SOURCEQUENCH_RATE=59, NET_IPV4_ICMP_DESTUNREACH_RATE=60, NET_IPV4_ICMP_TIMEEXCEED_RATE=61, NET_IPV4_ICMP_PARAMPROB_RATE=62, NET_IPV4_ICMP_ECHOREPLY_RATE=63, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, NET_TCP_TW_RECYCLE=66, NET_IPV4_ALWAYS_DEFRAG=67, NET_IPV4_TCP_KEEPALIVE_INTVL=68, NET_IPV4_INET_PEER_THRESHOLD=69, NET_IPV4_INET_PEER_MINTTL=70, NET_IPV4_INET_PEER_MAXTTL=71, NET_IPV4_INET_PEER_GC_MINTIME=72, NET_IPV4_INET_PEER_GC_MAXTIME=73, NET_TCP_ORPHAN_RETRIES=74, NET_TCP_ABORT_ON_OVERFLOW=75, NET_TCP_SYNACK_RETRIES=76, NET_TCP_MAX_ORPHANS=77, NET_TCP_MAX_TW_BUCKETS=78, NET_TCP_FACK=79, NET_TCP_REORDERING=80, NET_TCP_ECN=81, NET_TCP_DSACK=82, NET_TCP_MEM=83, NET_TCP_WMEM=84, NET_TCP_RMEM=85, NET_TCP_APP_WIN=86, NET_TCP_ADV_WIN_SCALE=87, NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, NET_TCP_TW_REUSE=91, NET_TCP_FRTO=92, NET_TCP_LOW_LATENCY=93, NET_IPV4_IPFRAG_SECRET_INTERVAL=94, NET_IPV4_IGMP_MAX_MSF=96, NET_TCP_NO_METRICS_SAVE=97, NET_TCP_DEFAULT_WIN_SCALE=105, NET_TCP_MODERATE_RCVBUF=106, NET_TCP_TSO_WIN_DIVISOR=107, NET_TCP_BIC_BETA=108, NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, NET_IPV4_IPFRAG_MAX_DIST=112, NET_TCP_MTU_PROBING=113, NET_TCP_BASE_MSS=114, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, NET_TCP_DMA_COPYBREAK=116, NET_TCP_SLOW_START_AFTER_IDLE=117, NET_CIPSOV4_CACHE_ENABLE=118, NET_CIPSOV4_CACHE_BUCKET_SIZE=119, NET_CIPSOV4_RBM_OPTFMT=120, NET_CIPSOV4_RBM_STRICTVALID=121, NET_TCP_AVAIL_CONG_CONTROL=122, NET_TCP_ALLOWED_CONG_CONTROL=123, NET_TCP_MAX_SSTHRESH=124, NET_TCP_FRTO_RESPONSE=125, }; enum { NET_IPV4_ROUTE_FLUSH=1, NET_IPV4_ROUTE_MIN_DELAY=2, NET_IPV4_ROUTE_MAX_DELAY=3, NET_IPV4_ROUTE_GC_THRESH=4, NET_IPV4_ROUTE_MAX_SIZE=5, NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, NET_IPV4_ROUTE_GC_TIMEOUT=7, NET_IPV4_ROUTE_GC_INTERVAL=8, NET_IPV4_ROUTE_REDIRECT_LOAD=9, NET_IPV4_ROUTE_REDIRECT_NUMBER=10, NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, NET_IPV4_ROUTE_GC_ELASTICITY=14, NET_IPV4_ROUTE_MTU_EXPIRES=15, NET_IPV4_ROUTE_MIN_PMTU=16, NET_IPV4_ROUTE_MIN_ADVMSS=17, NET_IPV4_ROUTE_SECRET_INTERVAL=18, NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, }; enum { NET_PROTO_CONF_ALL=-2, NET_PROTO_CONF_DEFAULT=-3 }; enum { NET_IPV4_CONF_FORWARDING=1, NET_IPV4_CONF_MC_FORWARDING=2, NET_IPV4_CONF_PROXY_ARP=3, NET_IPV4_CONF_ACCEPT_REDIRECTS=4, NET_IPV4_CONF_SECURE_REDIRECTS=5, NET_IPV4_CONF_SEND_REDIRECTS=6, NET_IPV4_CONF_SHARED_MEDIA=7, NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, NET_IPV4_CONF_LOG_MARTIANS=11, NET_IPV4_CONF_TAG=12, NET_IPV4_CONF_ARPFILTER=13, NET_IPV4_CONF_MEDIUM_ID=14, NET_IPV4_CONF_NOXFRM=15, NET_IPV4_CONF_NOPOLICY=16, NET_IPV4_CONF_FORCE_IGMP_VERSION=17, NET_IPV4_CONF_ARP_ANNOUNCE=18, NET_IPV4_CONF_ARP_IGNORE=19, NET_IPV4_CONF_PROMOTE_SECONDARIES=20, NET_IPV4_CONF_ARP_ACCEPT=21, NET_IPV4_CONF_ARP_NOTIFY=22, }; enum { NET_IPV4_NF_CONNTRACK_MAX=1, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_IPV4_NF_CONNTRACK_BUCKETS=14, NET_IPV4_NF_CONNTRACK_LOG_INVALID=15, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17, NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_IPV4_NF_CONNTRACK_COUNT=27, NET_IPV4_NF_CONNTRACK_CHECKSUM=28, }; enum { NET_IPV6_CONF=16, NET_IPV6_NEIGH=17, NET_IPV6_ROUTE=18, NET_IPV6_ICMP=19, NET_IPV6_BINDV6ONLY=20, NET_IPV6_IP6FRAG_HIGH_THRESH=21, NET_IPV6_IP6FRAG_LOW_THRESH=22, NET_IPV6_IP6FRAG_TIME=23, NET_IPV6_IP6FRAG_SECRET_INTERVAL=24, NET_IPV6_MLD_MAX_MSF=25, }; enum { NET_IPV6_ROUTE_FLUSH=1, NET_IPV6_ROUTE_GC_THRESH=2, NET_IPV6_ROUTE_MAX_SIZE=3, NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, NET_IPV6_ROUTE_GC_ELASTICITY=7, NET_IPV6_ROUTE_MTU_EXPIRES=8, NET_IPV6_ROUTE_MIN_ADVMSS=9, NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10 }; enum { NET_IPV6_FORWARDING=1, NET_IPV6_HOP_LIMIT=2, NET_IPV6_MTU=3, NET_IPV6_ACCEPT_RA=4, NET_IPV6_ACCEPT_REDIRECTS=5, NET_IPV6_AUTOCONF=6, NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICIT_INTERVAL=9, NET_IPV6_RTR_SOLICIT_DELAY=10, NET_IPV6_USE_TEMPADDR=11, NET_IPV6_TEMP_VALID_LFT=12, NET_IPV6_TEMP_PREFERED_LFT=13, NET_IPV6_REGEN_MAX_RETRY=14, NET_IPV6_MAX_DESYNC_FACTOR=15, NET_IPV6_MAX_ADDRESSES=16, NET_IPV6_FORCE_MLD_VERSION=17, NET_IPV6_ACCEPT_RA_DEFRTR=18, NET_IPV6_ACCEPT_RA_PINFO=19, NET_IPV6_ACCEPT_RA_RTR_PREF=20, NET_IPV6_RTR_PROBE_INTERVAL=21, NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, NET_IPV6_PROXY_NDP=23, NET_IPV6_ACCEPT_SOURCE_ROUTE=25, __NET_IPV6_MAX }; enum { NET_IPV6_ICMP_RATELIMIT=1 }; enum { NET_NEIGH_MCAST_SOLICIT=1, NET_NEIGH_UCAST_SOLICIT=2, NET_NEIGH_APP_SOLICIT=3, NET_NEIGH_RETRANS_TIME=4, NET_NEIGH_REACHABLE_TIME=5, NET_NEIGH_DELAY_PROBE_TIME=6, NET_NEIGH_GC_STALE_TIME=7, NET_NEIGH_UNRES_QLEN=8, NET_NEIGH_PROXY_QLEN=9, NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, NET_NEIGH_GC_INTERVAL=13, NET_NEIGH_GC_THRESH1=14, NET_NEIGH_GC_THRESH2=15, NET_NEIGH_GC_THRESH3=16, NET_NEIGH_RETRANS_TIME_MS=17, NET_NEIGH_REACHABLE_TIME_MS=18, }; enum { NET_DCCP_DEFAULT=1, }; enum { NET_IPX_PPROP_BROADCASTING=1, NET_IPX_FORWARDING=2 }; enum { NET_LLC2=1, NET_LLC_STATION=2, }; enum { NET_LLC2_TIMEOUT=1, }; enum { NET_LLC_STATION_ACK_TIMEOUT=1, }; enum { NET_LLC2_ACK_TIMEOUT=1, NET_LLC2_P_TIMEOUT=2, NET_LLC2_REJ_TIMEOUT=3, NET_LLC2_BUSY_TIMEOUT=4, }; enum { NET_ATALK_AARP_EXPIRY_TIME=1, NET_ATALK_AARP_TICK_TIME=2, NET_ATALK_AARP_RETRANSMIT_LIMIT=3, NET_ATALK_AARP_RESOLVE_TIME=4 }; enum { NET_NETROM_DEFAULT_PATH_QUALITY=1, NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2, NET_NETROM_NETWORK_TTL_INITIALISER=3, NET_NETROM_TRANSPORT_TIMEOUT=4, NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5, NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6, NET_NETROM_TRANSPORT_BUSY_DELAY=7, NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, NET_NETROM_ROUTING_CONTROL=10, NET_NETROM_LINK_FAILS_COUNT=11, NET_NETROM_RESET=12 }; enum { NET_AX25_IP_DEFAULT_MODE=1, NET_AX25_DEFAULT_MODE=2, NET_AX25_BACKOFF_TYPE=3, NET_AX25_CONNECT_MODE=4, NET_AX25_STANDARD_WINDOW=5, NET_AX25_EXTENDED_WINDOW=6, NET_AX25_T1_TIMEOUT=7, NET_AX25_T2_TIMEOUT=8, NET_AX25_T3_TIMEOUT=9, NET_AX25_IDLE_TIMEOUT=10, NET_AX25_N2=11, NET_AX25_PACLEN=12, NET_AX25_PROTOCOL=13, NET_AX25_DAMA_SLAVE_TIMEOUT=14 }; enum { NET_ROSE_RESTART_REQUEST_TIMEOUT=1, NET_ROSE_CALL_REQUEST_TIMEOUT=2, NET_ROSE_RESET_REQUEST_TIMEOUT=3, NET_ROSE_CLEAR_REQUEST_TIMEOUT=4, NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5, NET_ROSE_ROUTING_CONTROL=6, NET_ROSE_LINK_FAIL_TIMEOUT=7, NET_ROSE_MAX_VCS=8, NET_ROSE_WINDOW_SIZE=9, NET_ROSE_NO_ACTIVITY_TIMEOUT=10 }; enum { NET_X25_RESTART_REQUEST_TIMEOUT=1, NET_X25_CALL_REQUEST_TIMEOUT=2, NET_X25_RESET_REQUEST_TIMEOUT=3, NET_X25_CLEAR_REQUEST_TIMEOUT=4, NET_X25_ACK_HOLD_BACK_TIMEOUT=5, NET_X25_FORWARD=6 }; enum { NET_TR_RIF_TIMEOUT=1 }; enum { NET_DECNET_NODE_TYPE = 1, NET_DECNET_NODE_ADDRESS = 2, NET_DECNET_NODE_NAME = 3, NET_DECNET_DEFAULT_DEVICE = 4, NET_DECNET_TIME_WAIT = 5, NET_DECNET_DN_COUNT = 6, NET_DECNET_DI_COUNT = 7, NET_DECNET_DR_COUNT = 8, NET_DECNET_DST_GC_INTERVAL = 9, NET_DECNET_CONF = 10, NET_DECNET_NO_FC_MAX_CWND = 11, NET_DECNET_MEM = 12, NET_DECNET_RMEM = 13, NET_DECNET_WMEM = 14, NET_DECNET_DEBUG_LEVEL = 255 }; enum { NET_DECNET_CONF_LOOPBACK = -2, NET_DECNET_CONF_DDCMP = -3, NET_DECNET_CONF_PPP = -4, NET_DECNET_CONF_X25 = -5, NET_DECNET_CONF_GRE = -6, NET_DECNET_CONF_ETHER = -7 }; enum { NET_DECNET_CONF_DEV_PRIORITY = 1, NET_DECNET_CONF_DEV_T1 = 2, NET_DECNET_CONF_DEV_T2 = 3, NET_DECNET_CONF_DEV_T3 = 4, NET_DECNET_CONF_DEV_FORWARDING = 5, NET_DECNET_CONF_DEV_BLKSIZE = 6, NET_DECNET_CONF_DEV_STATE = 7 }; enum { NET_SCTP_RTO_INITIAL = 1, NET_SCTP_RTO_MIN = 2, NET_SCTP_RTO_MAX = 3, NET_SCTP_RTO_ALPHA = 4, NET_SCTP_RTO_BETA = 5, NET_SCTP_VALID_COOKIE_LIFE = 6, NET_SCTP_ASSOCIATION_MAX_RETRANS = 7, NET_SCTP_PATH_MAX_RETRANS = 8, NET_SCTP_MAX_INIT_RETRANSMITS = 9, NET_SCTP_HB_INTERVAL = 10, NET_SCTP_PRESERVE_ENABLE = 11, NET_SCTP_MAX_BURST = 12, NET_SCTP_ADDIP_ENABLE = 13, NET_SCTP_PRSCTP_ENABLE = 14, NET_SCTP_SNDBUF_POLICY = 15, NET_SCTP_SACK_TIMEOUT = 16, NET_SCTP_RCVBUF_POLICY = 17, }; enum { NET_BRIDGE_NF_CALL_ARPTABLES = 1, NET_BRIDGE_NF_CALL_IPTABLES = 2, NET_BRIDGE_NF_CALL_IP6TABLES = 3, NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, }; enum { NET_IRDA_DISCOVERY=1, NET_IRDA_DEVNAME=2, NET_IRDA_DEBUG=3, NET_IRDA_FAST_POLL=4, NET_IRDA_DISCOVERY_SLOTS=5, NET_IRDA_DISCOVERY_TIMEOUT=6, NET_IRDA_SLOT_TIMEOUT=7, NET_IRDA_MAX_BAUD_RATE=8, NET_IRDA_MIN_TX_TURN_TIME=9, NET_IRDA_MAX_TX_DATA_SIZE=10, NET_IRDA_MAX_TX_WINDOW=11, NET_IRDA_MAX_NOREPLY_TIME=12, NET_IRDA_WARN_NOREPLY_TIME=13, NET_IRDA_LAP_KEEPALIVE_TIME=14, }; enum { FS_NRINODE=1, FS_STATINODE=2, FS_MAXINODE=3, FS_NRDQUOT=4, FS_MAXDQUOT=5, FS_NRFILE=6, FS_MAXFILE=7, FS_DENTRY=8, FS_NRSUPER=9, FS_MAXSUPER=10, FS_OVERFLOWUID=11, FS_OVERFLOWGID=12, FS_LEASES=13, FS_DIR_NOTIFY=14, FS_LEASE_TIME=15, FS_DQSTATS=16, FS_XFS=17, FS_AIO_NR=18, FS_AIO_MAX_NR=19, FS_INOTIFY=20, FS_OCFS2=988, }; enum { FS_DQ_LOOKUPS = 1, FS_DQ_DROPS = 2, FS_DQ_READS = 3, FS_DQ_WRITES = 4, FS_DQ_CACHE_HITS = 5, FS_DQ_ALLOCATED = 6, FS_DQ_FREE = 7, FS_DQ_SYNCS = 8, FS_DQ_WARNINGS = 9, }; enum { DEV_CDROM=1, DEV_HWMON=2, DEV_PARPORT=3, DEV_RAID=4, DEV_MAC_HID=5, DEV_SCSI=6, DEV_IPMI=7, }; enum { DEV_CDROM_INFO=1, DEV_CDROM_AUTOCLOSE=2, DEV_CDROM_AUTOEJECT=3, DEV_CDROM_DEBUG=4, DEV_CDROM_LOCK=5, DEV_CDROM_CHECK_MEDIA=6 }; enum { DEV_PARPORT_DEFAULT=-3 }; enum { DEV_RAID_SPEED_LIMIT_MIN=1, DEV_RAID_SPEED_LIMIT_MAX=2 }; enum { DEV_PARPORT_DEFAULT_TIMESLICE=1, DEV_PARPORT_DEFAULT_SPINTIME=2 }; enum { DEV_PARPORT_SPINTIME=1, DEV_PARPORT_BASE_ADDR=2, DEV_PARPORT_IRQ=3, DEV_PARPORT_DMA=4, DEV_PARPORT_MODES=5, DEV_PARPORT_DEVICES=6, DEV_PARPORT_AUTOPROBE=16 }; enum { DEV_PARPORT_DEVICES_ACTIVE=-3, }; enum { DEV_PARPORT_DEVICE_TIMESLICE=1, }; enum { DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; enum { DEV_SCSI_LOGGING_LEVEL=1, }; enum { DEV_IPMI_POWEROFF_POWERCYCLE=1, }; enum { ABI_DEFHANDLER_COFF=1, ABI_DEFHANDLER_ELF=2, ABI_DEFHANDLER_LCALL7=3, ABI_DEFHANDLER_LIBCSO=4, ABI_TRACE=5, ABI_FAKE_UTSNAME=6, }; struct ctl_table; struct nsproxy; struct ctl_table_root; struct ctl_table_header; struct ctl_dir; typedef struct ctl_table ctl_table; typedef int proc_handler (struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); extern int proc_dostring(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_dointvec(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_dointvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_dointvec_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_doulongvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *); extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, void *, size_t *, loff_t *); extern int proc_do_large_bitmap(struct ctl_table *, int, void *, size_t *, loff_t *); struct ctl_table_poll { atomic_t event; wait_queue_head_t wait; }; static inline __attribute__((no_instrument_function)) void *proc_sys_poll_event(struct ctl_table_poll *poll) { return (void *)(unsigned long)atomic_read(&poll->event); } struct ctl_table { const char *procname; void *data; int maxlen; umode_t mode; struct ctl_table *child; proc_handler *proc_handler; struct ctl_table_poll *poll; void *extra1; void *extra2; }; struct ctl_node { struct rb_node node; struct ctl_table_header *header; }; struct ctl_table_header { union { struct { struct ctl_table *ctl_table; int used; int count; int nreg; }; struct rcu_head rcu; }; struct completion *unregistering; struct ctl_table *ctl_table_arg; struct ctl_table_root *root; struct ctl_table_set *set; struct ctl_dir *parent; struct ctl_node *node; }; struct ctl_dir { struct ctl_table_header header; struct rb_root root; }; struct ctl_table_set { int (*is_seen)(struct ctl_table_set *); struct ctl_dir dir; }; struct ctl_table_root { struct ctl_table_set default_set; struct ctl_table_set *(*lookup)(struct ctl_table_root *root, struct nsproxy *namespaces); int (*permissions)(struct ctl_table_root *root, struct nsproxy *namespaces, struct ctl_table *table); }; struct ctl_path { const char *procname; }; void proc_sys_poll_notify(struct ctl_table_poll *poll); extern void setup_sysctl_set(struct ctl_table_set *p, struct ctl_table_root *root, int (*is_seen)(struct ctl_table_set *)); extern void retire_sysctl_set(struct ctl_table_set *set); void register_sysctl_root(struct ctl_table_root *root); struct ctl_table_header *__register_sysctl_table( struct ctl_table_set *set, const char *path, struct ctl_table *table); struct ctl_table_header *__register_sysctl_paths( struct ctl_table_set *set, const struct ctl_path *path, struct ctl_table *table); struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table); struct ctl_table_header *register_sysctl_table(struct ctl_table * table); struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, struct ctl_table *table); void unregister_sysctl_table(struct ctl_table_header * table); extern int sysctl_init(void); typedef int32_t key_serial_t; typedef uint32_t key_perm_t; struct key; struct seq_file; struct user_struct; struct signal_struct; struct cred; struct key_type; struct key_owner; struct keyring_list; struct keyring_name; typedef struct __key_reference_with_attributes *key_ref_t; static inline __attribute__((no_instrument_function)) key_ref_t make_key_ref(const struct key *key, unsigned long possession) { return (key_ref_t) ((unsigned long) key | possession); } static inline __attribute__((no_instrument_function)) struct key *key_ref_to_ptr(const key_ref_t key_ref) { return (struct key *) ((unsigned long) key_ref & ~1UL); } static inline __attribute__((no_instrument_function)) unsigned long is_key_possessed(const key_ref_t key_ref) { return (unsigned long) key_ref & 1UL; } struct key { atomic_t usage; key_serial_t serial; struct rb_node serial_node; struct key_type *type; struct rw_semaphore sem; struct key_user *user; void *security; union { time_t expiry; time_t revoked_at; }; uid_t uid; gid_t gid; key_perm_t perm; unsigned short quotalen; unsigned short datalen; unsigned long flags; char *description; union { struct list_head link; unsigned long x[2]; void *p[2]; int reject_error; } type_data; union { unsigned long value; void *rcudata; void *data; struct keyring_list *subscriptions; } payload; }; extern struct key *key_alloc(struct key_type *type, const char *desc, uid_t uid, gid_t gid, const struct cred *cred, key_perm_t perm, unsigned long flags); extern void key_revoke(struct key *key); extern void key_put(struct key *key); static inline __attribute__((no_instrument_function)) struct key *key_get(struct key *key) { if (key) atomic_inc(&key->usage); return key; } static inline __attribute__((no_instrument_function)) void key_ref_put(key_ref_t key_ref) { key_put(key_ref_to_ptr(key_ref)); } extern struct key *request_key(struct key_type *type, const char *description, const char *callout_info); extern struct key *request_key_with_auxdata(struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux); extern struct key *request_key_async(struct key_type *type, const char *description, const void *callout_info, size_t callout_len); extern struct key *request_key_async_with_auxdata(struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux); extern int wait_for_key_construction(struct key *key, bool intr); extern int key_validate(struct key *key); extern key_ref_t key_create_or_update(key_ref_t keyring, const char *type, const char *description, const void *payload, size_t plen, key_perm_t perm, unsigned long flags); extern int key_update(key_ref_t key, const void *payload, size_t plen); extern int key_link(struct key *keyring, struct key *key); extern int key_unlink(struct key *keyring, struct key *key); extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, unsigned long flags, struct key *dest); extern int keyring_clear(struct key *keyring); extern key_ref_t keyring_search(key_ref_t keyring, struct key_type *type, const char *description); extern int keyring_add_key(struct key *keyring, struct key *key); extern struct key *key_lookup(key_serial_t id); static inline __attribute__((no_instrument_function)) key_serial_t key_serial(const struct key *key) { return key ? key->serial : 0; } extern void key_set_timeout(struct key *, unsigned); static inline __attribute__((no_instrument_function)) bool key_is_instantiated(const struct key *key) { return (__builtin_constant_p((0)) ? constant_test_bit((0), (&key->flags)) : variable_test_bit((0), (&key->flags))) && !(__builtin_constant_p((5)) ? constant_test_bit((5), (&key->flags)) : variable_test_bit((5), (&key->flags))); } extern ctl_table key_sysctls[]; extern void key_replace_session_keyring(void); extern int install_thread_keyring_to_cred(struct cred *cred); extern void key_fsuid_changed(struct task_struct *tsk); extern void key_fsgid_changed(struct task_struct *tsk); extern void key_init(void); struct selinux_audit_rule; struct audit_context; struct kern_ipc_perm; bool selinux_is_enabled(void); struct user_struct; struct cred; struct inode; struct group_info { atomic_t usage; int ngroups; int nblocks; gid_t small_block[32]; gid_t *blocks[0]; }; static inline __attribute__((no_instrument_function)) struct group_info *get_group_info(struct group_info *gi) { atomic_inc(&gi->usage); return gi; } extern struct group_info *groups_alloc(int); extern struct group_info init_groups; extern void groups_free(struct group_info *); extern int set_current_groups(struct group_info *); extern int set_groups(struct cred *, struct group_info *); extern int groups_search(const struct group_info *, gid_t); extern int in_group_p(gid_t); extern int in_egroup_p(gid_t); struct thread_group_cred { atomic_t usage; pid_t tgid; spinlock_t lock; struct key *session_keyring; struct key *process_keyring; struct rcu_head rcu; }; struct cred { atomic_t usage; atomic_t subscribers; void *put_addr; unsigned magic; uid_t uid; gid_t gid; uid_t suid; gid_t sgid; uid_t euid; gid_t egid; uid_t fsuid; gid_t fsgid; unsigned securebits; kernel_cap_t cap_inheritable; kernel_cap_t cap_permitted; kernel_cap_t cap_effective; kernel_cap_t cap_bset; unsigned char jit_keyring; struct key *thread_keyring; struct key *request_key_auth; struct thread_group_cred *tgcred; void *security; struct user_struct *user; struct user_namespace *user_ns; struct group_info *group_info; struct rcu_head rcu; }; extern void __put_cred(struct cred *); extern void exit_creds(struct task_struct *); extern int copy_creds(struct task_struct *, unsigned long); extern const struct cred *get_task_cred(struct task_struct *); extern struct cred *cred_alloc_blank(void); extern struct cred *prepare_creds(void); extern struct cred *prepare_exec_creds(void); extern int commit_creds(struct cred *); extern void abort_creds(struct cred *); extern const struct cred *override_creds(const struct cred *); extern void revert_creds(const struct cred *); extern struct cred *prepare_kernel_cred(struct task_struct *); extern int change_create_files_as(struct cred *, struct inode *); extern int set_security_override(struct cred *, u32); extern int set_security_override_from_ctx(struct cred *, const char *); extern int set_create_files_as(struct cred *, struct inode *); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) cred_init(void); extern void __invalid_creds(const struct cred *, const char *, unsigned); extern void __validate_process_creds(struct task_struct *, const char *, unsigned); extern bool creds_are_invalid(const struct cred *cred); static inline __attribute__((no_instrument_function)) void __validate_creds(const struct cred *cred, const char *file, unsigned line) { if (ldv__builtin_expect(!!(creds_are_invalid(cred)), 0)) __invalid_creds(cred, file, line); } extern void validate_creds_for_do_exit(struct task_struct *); static inline __attribute__((no_instrument_function)) struct cred *get_new_cred(struct cred *cred) { atomic_inc(&cred->usage); return cred; } static inline __attribute__((no_instrument_function)) const struct cred *get_cred(const struct cred *cred) { struct cred *nonconst_cred = (struct cred *) cred; do { __validate_creds((cred), "include/linux/cred.h", 241); } while(0); return get_new_cred(nonconst_cred); } static inline __attribute__((no_instrument_function)) void put_cred(const struct cred *_cred) { struct cred *cred = (struct cred *) _cred; do { __validate_creds((cred), "include/linux/cred.h", 260); } while(0); if (atomic_dec_and_test(&(cred)->usage)) __put_cred(cred); } struct llist_head { struct llist_node *first; }; struct llist_node { struct llist_node *next; }; static inline __attribute__((no_instrument_function)) void init_llist_head(struct llist_head *list) { list->first = ((void *)0); } static inline __attribute__((no_instrument_function)) bool llist_empty(const struct llist_head *head) { return (*(volatile typeof(head->first) *)&(head->first)) == ((void *)0); } static inline __attribute__((no_instrument_function)) struct llist_node *llist_next(struct llist_node *node) { return node->next; } static inline __attribute__((no_instrument_function)) bool llist_add(struct llist_node *new, struct llist_head *head) { struct llist_node *entry, *old_entry; entry = head->first; for (;;) { old_entry = entry; new->next = entry; entry = ({ __typeof__(*((&head->first))) __ret; __typeof__(*((&head->first))) __old = ((old_entry)); __typeof__(*((&head->first))) __new = ((new)); switch ((sizeof(*(&head->first)))) { case 1: { volatile u8 *__ptr = (volatile u8 *)((&head->first)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgb %2,%1" : "=a" (__ret), "+m" (*__ptr) : "q" (__new), "0" (__old) : "memory"); break; } case 2: { volatile u16 *__ptr = (volatile u16 *)((&head->first)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgw %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 4: { volatile u32 *__ptr = (volatile u32 *)((&head->first)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgl %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } case 8: { volatile u64 *__ptr = (volatile u64 *)((&head->first)); asm volatile(".section .smp_locks,\"a\"\n" ".balign 4\n" ".long 671f - .\n" ".previous\n" "671:" "\n\tlock; " "cmpxchgq %2,%1" : "=a" (__ret), "+m" (*__ptr) : "r" (__new), "0" (__old) : "memory"); break; } default: __cmpxchg_wrong_size(); } __ret; }); if (entry == old_entry) break; } return old_entry == ((void *)0); } static inline __attribute__((no_instrument_function)) struct llist_node *llist_del_all(struct llist_head *head) { return ({ __typeof__ (*((&head->first))) __ret = ((((void *)0))); switch (sizeof(*((&head->first)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&head->first))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&head->first))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&head->first))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&head->first))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; }); } extern bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, struct llist_head *head); extern struct llist_node *llist_del_first(struct llist_head *head); struct exec_domain; struct futex_pi_state; struct robust_list_head; struct bio_list; struct fs_struct; struct perf_event_context; struct blk_plug; extern unsigned long avenrun[]; extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift); extern unsigned long total_forks; extern int nr_threads; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_process_counts; extern __attribute__((section(".data..percpu" ""))) __typeof__(unsigned long) process_counts; extern int nr_processes(void); extern unsigned long nr_running(void); extern unsigned long nr_uninterruptible(void); extern unsigned long nr_iowait(void); extern unsigned long nr_iowait_cpu(int cpu); extern unsigned long this_cpu_load(void); extern void calc_global_load(unsigned long ticks); extern unsigned long get_parent_ip(unsigned long addr); struct seq_file; struct cfs_rq; struct task_group; extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); extern void proc_sched_set_task(struct task_struct *p); extern void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); extern char ___assert_task_state[1 - 2*!!( sizeof("RSDTtZXxKW")-1 != ( __builtin_constant_p(512) ? ( (512) < 1 ? ____ilog2_NaN() : (512) & (1ULL << 63) ? 63 : (512) & (1ULL << 62) ? 62 : (512) & (1ULL << 61) ? 61 : (512) & (1ULL << 60) ? 60 : (512) & (1ULL << 59) ? 59 : (512) & (1ULL << 58) ? 58 : (512) & (1ULL << 57) ? 57 : (512) & (1ULL << 56) ? 56 : (512) & (1ULL << 55) ? 55 : (512) & (1ULL << 54) ? 54 : (512) & (1ULL << 53) ? 53 : (512) & (1ULL << 52) ? 52 : (512) & (1ULL << 51) ? 51 : (512) & (1ULL << 50) ? 50 : (512) & (1ULL << 49) ? 49 : (512) & (1ULL << 48) ? 48 : (512) & (1ULL << 47) ? 47 : (512) & (1ULL << 46) ? 46 : (512) & (1ULL << 45) ? 45 : (512) & (1ULL << 44) ? 44 : (512) & (1ULL << 43) ? 43 : (512) & (1ULL << 42) ? 42 : (512) & (1ULL << 41) ? 41 : (512) & (1ULL << 40) ? 40 : (512) & (1ULL << 39) ? 39 : (512) & (1ULL << 38) ? 38 : (512) & (1ULL << 37) ? 37 : (512) & (1ULL << 36) ? 36 : (512) & (1ULL << 35) ? 35 : (512) & (1ULL << 34) ? 34 : (512) & (1ULL << 33) ? 33 : (512) & (1ULL << 32) ? 32 : (512) & (1ULL << 31) ? 31 : (512) & (1ULL << 30) ? 30 : (512) & (1ULL << 29) ? 29 : (512) & (1ULL << 28) ? 28 : (512) & (1ULL << 27) ? 27 : (512) & (1ULL << 26) ? 26 : (512) & (1ULL << 25) ? 25 : (512) & (1ULL << 24) ? 24 : (512) & (1ULL << 23) ? 23 : (512) & (1ULL << 22) ? 22 : (512) & (1ULL << 21) ? 21 : (512) & (1ULL << 20) ? 20 : (512) & (1ULL << 19) ? 19 : (512) & (1ULL << 18) ? 18 : (512) & (1ULL << 17) ? 17 : (512) & (1ULL << 16) ? 16 : (512) & (1ULL << 15) ? 15 : (512) & (1ULL << 14) ? 14 : (512) & (1ULL << 13) ? 13 : (512) & (1ULL << 12) ? 12 : (512) & (1ULL << 11) ? 11 : (512) & (1ULL << 10) ? 10 : (512) & (1ULL << 9) ? 9 : (512) & (1ULL << 8) ? 8 : (512) & (1ULL << 7) ? 7 : (512) & (1ULL << 6) ? 6 : (512) & (1ULL << 5) ? 5 : (512) & (1ULL << 4) ? 4 : (512) & (1ULL << 3) ? 3 : (512) & (1ULL << 2) ? 2 : (512) & (1ULL << 1) ? 1 : (512) & (1ULL << 0) ? 0 : ____ilog2_NaN() ) : (sizeof(512) <= 4) ? __ilog2_u32(512) : __ilog2_u64(512) )+1)]; extern rwlock_t tasklist_lock; extern spinlock_t mmlist_lock; struct task_struct; extern void sched_init(void); extern void sched_init_smp(void); extern void schedule_tail(struct task_struct *prev); extern void init_idle(struct task_struct *idle, int cpu); extern void init_idle_bootup_task(struct task_struct *idle); extern int runqueue_is_locked(int cpu); extern void select_nohz_load_balancer(int stop_tick); extern void set_cpu_sd_state_idle(void); extern int get_nohz_timer_target(void); extern void show_state_filter(unsigned long state_filter); static inline __attribute__((no_instrument_function)) void show_state(void) { show_state_filter(0); } extern void show_regs(struct pt_regs *); extern void show_stack(struct task_struct *task, unsigned long *sp); void io_schedule(void); long io_schedule_timeout(long timeout); extern void cpu_init (void); extern void trap_init(void); extern void update_process_times(int user); extern void scheduler_tick(void); extern void sched_show_task(struct task_struct *p); extern void touch_softlockup_watchdog(void); extern void touch_softlockup_watchdog_sync(void); extern void touch_all_softlockup_watchdogs(void); extern int proc_dowatchdog_thresh(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); extern unsigned int softlockup_panic; void lockup_detector_init(void); extern unsigned int sysctl_hung_task_panic; extern unsigned long sysctl_hung_task_check_count; extern unsigned long sysctl_hung_task_timeout_secs; extern unsigned long sysctl_hung_task_warnings; extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); extern char __sched_text_start[], __sched_text_end[]; extern int in_sched_functions(unsigned long addr); extern signed long schedule_timeout(signed long timeout); extern signed long schedule_timeout_interruptible(signed long timeout); extern signed long schedule_timeout_killable(signed long timeout); extern signed long schedule_timeout_uninterruptible(signed long timeout); void schedule(void); extern void schedule_preempt_disabled(void); extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); struct nsproxy; struct user_namespace; extern int sysctl_max_map_count; typedef __kernel_ulong_t aio_context_t; enum { IOCB_CMD_PREAD = 0, IOCB_CMD_PWRITE = 1, IOCB_CMD_FSYNC = 2, IOCB_CMD_FDSYNC = 3, IOCB_CMD_NOOP = 6, IOCB_CMD_PREADV = 7, IOCB_CMD_PWRITEV = 8, }; struct io_event { __u64 data; __u64 obj; __s64 res; __s64 res2; }; struct iocb { __u64 aio_data; __u32 aio_key, aio_reserved1; __u16 aio_lio_opcode; __s16 aio_reqprio; __u32 aio_fildes; __u64 aio_buf; __u64 aio_nbytes; __s64 aio_offset; __u64 aio_reserved2; __u32 aio_flags; __u32 aio_resfd; }; struct iovec { void *iov_base; __kernel_size_t iov_len; }; struct kvec { void *iov_base; size_t iov_len; }; static inline __attribute__((no_instrument_function)) size_t iov_length(const struct iovec *iov, unsigned long nr_segs) { unsigned long seg; size_t ret = 0; for (seg = 0; seg < nr_segs; seg++) ret += iov[seg].iov_len; return ret; } unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); struct kioctx; struct kiocb { struct list_head ki_run_list; unsigned long ki_flags; int ki_users; unsigned ki_key; struct file *ki_filp; struct kioctx *ki_ctx; int (*ki_cancel)(struct kiocb *, struct io_event *); ssize_t (*ki_retry)(struct kiocb *); void (*ki_dtor)(struct kiocb *); union { void *user; struct task_struct *tsk; } ki_obj; __u64 ki_user_data; loff_t ki_pos; void *private; unsigned short ki_opcode; size_t ki_nbytes; char *ki_buf; size_t ki_left; struct iovec ki_inline_vec; struct iovec *ki_iovec; unsigned long ki_nr_segs; unsigned long ki_cur_seg; struct list_head ki_list; struct list_head ki_batch; struct eventfd_ctx *ki_eventfd; }; struct aio_ring { unsigned id; unsigned nr; unsigned head; unsigned tail; unsigned magic; unsigned compat_features; unsigned incompat_features; unsigned header_length; struct io_event io_events[0]; }; struct aio_ring_info { unsigned long mmap_base; unsigned long mmap_size; struct page **ring_pages; spinlock_t ring_lock; long nr_pages; unsigned nr, tail; struct page *internal_pages[8]; }; struct kioctx { atomic_t users; int dead; struct mm_struct *mm; unsigned long user_id; struct hlist_node list; wait_queue_head_t wait; spinlock_t ctx_lock; int reqs_active; struct list_head active_reqs; struct list_head run_list; unsigned max_reqs; struct aio_ring_info ring_info; struct delayed_work wq; struct rcu_head rcu_head; }; extern unsigned aio_max_size; extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); extern int aio_put_req(struct kiocb *iocb); extern void kick_iocb(struct kiocb *iocb); extern int aio_complete(struct kiocb *iocb, long res, long res2); struct mm_struct; extern void exit_aio(struct mm_struct *mm); extern long do_io_submit(aio_context_t ctx_id, long nr, struct iocb * *iocbpp, bool compat); static inline __attribute__((no_instrument_function)) struct kiocb *list_kiocb(struct list_head *h) { return ({ const typeof( ((struct kiocb *)0)->ki_list ) *__mptr = (h); (struct kiocb *)( (char *)__mptr - __builtin_offsetof(struct kiocb,ki_list) );}); } extern unsigned long aio_nr; extern unsigned long aio_max_nr; extern void arch_pick_mmap_layout(struct mm_struct *mm); extern unsigned long arch_get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); extern unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); extern void arch_unmap_area(struct mm_struct *, unsigned long); extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); extern void set_dumpable(struct mm_struct *mm, int value); extern int get_dumpable(struct mm_struct *mm); struct sighand_struct { atomic_t count; struct k_sigaction action[64]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; }; struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; cputime_t ac_utime, ac_stime; unsigned long ac_minflt, ac_majflt; }; struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; }; struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; }; struct thread_group_cputimer { struct task_cputime cputime; int running; raw_spinlock_t lock; }; struct autogroup; struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; wait_queue_head_t wait_chldexit; struct task_struct *curr_target; struct sigpending shared_pending; int group_exit_code; int notify_count; struct task_struct *group_exit_task; int group_stop_count; unsigned int flags; unsigned int is_child_subreaper:1; unsigned int has_child_subreaper:1; struct list_head posix_timers; struct hrtimer real_timer; struct pid *leader_pid; ktime_t it_real_incr; struct cpu_itimer it[2]; struct thread_group_cputimer cputimer; struct task_cputime cputime_expires; struct list_head cpu_timers[3]; struct pid *tty_old_pgrp; int leader; struct tty_struct *tty; struct autogroup *autogroup; cputime_t utime, stime, cutime, cstime; cputime_t gtime; cputime_t cgtime; cputime_t prev_utime, prev_stime; unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; unsigned long inblock, oublock, cinblock, coublock; unsigned long maxrss, cmaxrss; struct task_io_accounting ioac; unsigned long long sum_sched_runtime; struct rlimit rlim[16]; struct pacct_struct pacct; struct taskstats *stats; unsigned audit_tty; struct tty_audit_buf *tty_audit_buf; struct rw_semaphore group_rwsem; int oom_adj; int oom_score_adj; int oom_score_adj_min; struct mutex cred_guard_mutex; }; static inline __attribute__((no_instrument_function)) int signal_group_exit(const struct signal_struct *sig) { return (sig->flags & 0x00000004) || (sig->group_exit_task != ((void *)0)); } struct user_struct { atomic_t __count; atomic_t processes; atomic_t files; atomic_t sigpending; atomic_t inotify_watches; atomic_t inotify_devs; atomic_t fanotify_listeners; atomic_long_t epoll_watches; unsigned long mq_bytes; unsigned long locked_shm; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; uid_t uid; struct user_namespace *user_ns; atomic_long_t locked_vm; }; extern int uids_sysfs_init(void); extern struct user_struct *find_user(uid_t); extern struct user_struct root_user; struct backing_dev_info; struct reclaim_state; struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival, last_queued; }; struct task_delay_info { spinlock_t lock; unsigned int flags; struct timespec blkio_start, blkio_end; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; struct timespec freepages_start, freepages_end; u64 freepages_delay; u32 freepages_count; }; static inline __attribute__((no_instrument_function)) int sched_info_on(void) { return 1; } enum cpu_idle_type { CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE, CPU_MAX_IDLE_TYPES }; enum powersavings_balance_level { POWERSAVINGS_BALANCE_NONE = 0, POWERSAVINGS_BALANCE_BASIC, POWERSAVINGS_BALANCE_WAKEUP, MAX_POWERSAVINGS_BALANCE_LEVELS }; extern int sched_mc_power_savings, sched_smt_power_savings; static inline __attribute__((no_instrument_function)) int sd_balance_for_mc_power(void) { if (sched_smt_power_savings) return 0x0100; if (!sched_mc_power_savings) return 0x1000; return 0; } static inline __attribute__((no_instrument_function)) int sd_balance_for_package_power(void) { if (sched_mc_power_savings | sched_smt_power_savings) return 0x0100; return 0x1000; } extern int __attribute__((weak)) arch_sd_sibiling_asym_packing(void); static inline __attribute__((no_instrument_function)) int sd_power_saving_flags(void) { if (sched_mc_power_savings | sched_smt_power_savings) return 0x0002; return 0; } struct sched_group_power { atomic_t ref; unsigned int power, power_orig; unsigned long next_update; atomic_t nr_busy_cpus; }; struct sched_group { struct sched_group *next; atomic_t ref; unsigned int group_weight; struct sched_group_power *sgp; unsigned long cpumask[0]; }; static inline __attribute__((no_instrument_function)) struct cpumask *sched_group_cpus(struct sched_group *sg) { return ((struct cpumask *)(1 ? (sg->cpumask) : (void *)sizeof(__check_is_bitmap(sg->cpumask)))); } static inline __attribute__((no_instrument_function)) unsigned int group_first_cpu(struct sched_group *group) { return cpumask_first(sched_group_cpus(group)); } struct sched_domain_attr { int relax_domain_level; }; extern int sched_domain_level_max; struct sched_domain { struct sched_domain *parent; struct sched_domain *child; struct sched_group *groups; unsigned long min_interval; unsigned long max_interval; unsigned int busy_factor; unsigned int imbalance_pct; unsigned int cache_nice_tries; unsigned int busy_idx; unsigned int idle_idx; unsigned int newidle_idx; unsigned int wake_idx; unsigned int forkexec_idx; unsigned int smt_gain; int flags; int level; unsigned long last_balance; unsigned int balance_interval; unsigned int nr_balance_failed; u64 last_update; unsigned int lb_count[CPU_MAX_IDLE_TYPES]; unsigned int lb_failed[CPU_MAX_IDLE_TYPES]; unsigned int lb_balanced[CPU_MAX_IDLE_TYPES]; unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES]; unsigned int lb_gained[CPU_MAX_IDLE_TYPES]; unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES]; unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES]; unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES]; unsigned int alb_count; unsigned int alb_failed; unsigned int alb_pushed; unsigned int sbe_count; unsigned int sbe_balanced; unsigned int sbe_pushed; unsigned int sbf_count; unsigned int sbf_balanced; unsigned int sbf_pushed; unsigned int ttwu_wake_remote; unsigned int ttwu_move_affine; unsigned int ttwu_move_balance; char *name; union { void *private; struct rcu_head rcu; }; unsigned int span_weight; unsigned long span[0]; }; static inline __attribute__((no_instrument_function)) struct cpumask *sched_domain_span(struct sched_domain *sd) { return ((struct cpumask *)(1 ? (sd->span) : (void *)sizeof(__check_is_bitmap(sd->span)))); } extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], struct sched_domain_attr *dattr_new); cpumask_var_t *alloc_sched_domains(unsigned int ndoms); void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); static inline __attribute__((no_instrument_function)) int test_sd_parent(struct sched_domain *sd, int flag) { if (sd->parent && (sd->parent->flags & flag)) return 1; return 0; } unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); bool cpus_share_cache(int this_cpu, int that_cpu); struct io_context; static inline __attribute__((no_instrument_function)) void prefetch_stack(struct task_struct *t) { } struct audit_context; struct mempolicy; struct pipe_inode_info; struct uts_namespace; struct rq; struct sched_domain; struct sched_class { const struct sched_class *next; void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); void (*yield_task) (struct rq *rq); bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt); void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); struct task_struct * (*pick_next_task) (struct rq *rq); void (*put_prev_task) (struct rq *rq, struct task_struct *p); int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); void (*post_schedule) (struct rq *this_rq); void (*task_waking) (struct task_struct *task); void (*task_woken) (struct rq *this_rq, struct task_struct *task); void (*set_cpus_allowed)(struct task_struct *p, const struct cpumask *newmask); void (*rq_online)(struct rq *rq); void (*rq_offline)(struct rq *rq); void (*set_curr_task) (struct rq *rq); void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); void (*task_fork) (struct task_struct *p); void (*switched_from) (struct rq *this_rq, struct task_struct *task); void (*switched_to) (struct rq *this_rq, struct task_struct *task); void (*prio_changed) (struct rq *this_rq, struct task_struct *task, int oldprio); unsigned int (*get_rr_interval) (struct rq *rq, struct task_struct *task); void (*task_move_group) (struct task_struct *p, int on_rq); }; struct load_weight { unsigned long weight, inv_weight; }; struct sched_statistics { u64 wait_start; u64 wait_max; u64 wait_count; u64 wait_sum; u64 iowait_count; u64 iowait_sum; u64 sleep_start; u64 sleep_max; s64 sum_sleep_runtime; u64 block_start; u64 block_max; u64 exec_max; u64 slice_max; u64 nr_migrations_cold; u64 nr_failed_migrations_affine; u64 nr_failed_migrations_running; u64 nr_failed_migrations_hot; u64 nr_forced_migrations; u64 nr_wakeups; u64 nr_wakeups_sync; u64 nr_wakeups_migrate; u64 nr_wakeups_local; u64 nr_wakeups_remote; u64 nr_wakeups_affine; u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; }; struct sched_entity { struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; struct sched_statistics statistics; struct sched_entity *parent; struct cfs_rq *cfs_rq; struct cfs_rq *my_q; }; struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned int time_slice; int nr_cpus_allowed; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; }; struct rcu_node; enum perf_event_task_context { perf_invalid_context = -1, perf_hw_context = 0, perf_sw_context, perf_nr_task_contexts, }; struct task_struct { volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; int on_rq; int prio, static_prio, normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; struct hlist_head preempt_notifiers; unsigned char fpu_counter; unsigned int policy; cpumask_t cpus_allowed; struct sched_info sched_info; struct list_head tasks; struct plist_node pushable_tasks; struct mm_struct *mm, *active_mm; unsigned brk_randomized:1; int exit_state; int exit_code, exit_signal; int pdeath_signal; unsigned int jobctl; unsigned int personality; unsigned did_exec:1; unsigned in_execve:1; unsigned in_iowait:1; unsigned sched_reset_on_fork:1; unsigned sched_contributes_to_load:1; unsigned irq_thread:1; pid_t pid; pid_t tgid; unsigned long stack_canary; struct task_struct *real_parent; struct task_struct *parent; struct list_head children; struct list_head sibling; struct task_struct *group_leader; struct list_head ptraced; struct list_head ptrace_entry; struct pid_link pids[PIDTYPE_MAX]; struct list_head thread_group; struct completion *vfork_done; int *set_child_tid; int *clear_child_tid; cputime_t utime, stime, utimescaled, stimescaled; cputime_t gtime; cputime_t prev_utime, prev_stime; unsigned long nvcsw, nivcsw; struct timespec start_time; struct timespec real_start_time; unsigned long min_flt, maj_flt; struct task_cputime cputime_expires; struct list_head cpu_timers[3]; const struct cred *real_cred; const struct cred *cred; struct cred *replacement_session_keyring; char comm[16]; int link_count, total_link_count; struct sysv_sem sysvsem; unsigned long last_switch_count; struct thread_struct thread; struct fs_struct *fs; struct files_struct *files; struct nsproxy *nsproxy; struct signal_struct *signal; struct sighand_struct *sighand; sigset_t blocked, real_blocked; sigset_t saved_sigmask; struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; int (*notifier)(void *priv); void *notifier_data; sigset_t *notifier_mask; struct audit_context *audit_context; uid_t loginuid; unsigned int sessionid; seccomp_t seccomp; u32 parent_exec_id; u32 self_exec_id; spinlock_t alloc_lock; raw_spinlock_t pi_lock; struct plist_head pi_waiters; struct rt_mutex_waiter *pi_blocked_on; struct mutex_waiter *blocked_on; unsigned int irq_events; unsigned long hardirq_enable_ip; unsigned long hardirq_disable_ip; unsigned int hardirq_enable_event; unsigned int hardirq_disable_event; int hardirqs_enabled; int hardirq_context; unsigned long softirq_disable_ip; unsigned long softirq_enable_ip; unsigned int softirq_disable_event; unsigned int softirq_enable_event; int softirqs_enabled; int softirq_context; void *journal_info; struct bio_list *bio_list; struct blk_plug *plug; struct reclaim_state *reclaim_state; struct backing_dev_info *backing_dev_info; struct io_context *io_context; unsigned long ptrace_message; siginfo_t *last_siginfo; struct task_io_accounting ioac; u64 acct_rss_mem1; u64 acct_vm_mem1; cputime_t acct_timexpd; nodemask_t mems_allowed; seqcount_t mems_allowed_seq; int cpuset_mem_spread_rotor; int cpuset_slab_spread_rotor; struct css_set *cgroups; struct list_head cg_list; struct robust_list_head *robust_list; struct compat_robust_list_head *compat_robust_list; struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; struct mutex perf_event_mutex; struct list_head perf_event_list; struct mempolicy *mempolicy; short il_next; short pref_node_fork; struct rcu_head rcu; struct pipe_inode_info *splice_pipe; struct task_delay_info *delays; int make_it_fail; int nr_dirtied; int nr_dirtied_pause; unsigned long dirty_paused_when; int latency_record_count; struct latency_record latency_record[32]; unsigned long timer_slack_ns; unsigned long default_timer_slack_ns; struct list_head *scm_work_list; unsigned long trace; unsigned long trace_recursion; struct memcg_batch_info { int do_batch; struct mem_cgroup *memcg; unsigned long nr_pages; unsigned long memsw_nr_pages; } memcg_batch; atomic_t ptrace_bp_refcnt; }; static inline __attribute__((no_instrument_function)) int rt_prio(int prio) { if (ldv__builtin_expect(!!(prio < 100), 0)) return 1; return 0; } static inline __attribute__((no_instrument_function)) int rt_task(struct task_struct *p) { return rt_prio(p->prio); } static inline __attribute__((no_instrument_function)) struct pid *task_pid(struct task_struct *task) { return task->pids[PIDTYPE_PID].pid; } static inline __attribute__((no_instrument_function)) struct pid *task_tgid(struct task_struct *task) { return task->group_leader->pids[PIDTYPE_PID].pid; } static inline __attribute__((no_instrument_function)) struct pid *task_pgrp(struct task_struct *task) { return task->group_leader->pids[PIDTYPE_PGID].pid; } static inline __attribute__((no_instrument_function)) struct pid *task_session(struct task_struct *task) { return task->group_leader->pids[PIDTYPE_SID].pid; } struct pid_namespace; pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns); static inline __attribute__((no_instrument_function)) pid_t task_pid_nr(struct task_struct *tsk) { return tsk->pid; } static inline __attribute__((no_instrument_function)) pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns); } static inline __attribute__((no_instrument_function)) pid_t task_pid_vnr(struct task_struct *tsk) { return __task_pid_nr_ns(tsk, PIDTYPE_PID, ((void *)0)); } static inline __attribute__((no_instrument_function)) pid_t task_tgid_nr(struct task_struct *tsk) { return tsk->tgid; } pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); static inline __attribute__((no_instrument_function)) pid_t task_tgid_vnr(struct task_struct *tsk) { return pid_vnr(task_tgid(tsk)); } static inline __attribute__((no_instrument_function)) pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); } static inline __attribute__((no_instrument_function)) pid_t task_pgrp_vnr(struct task_struct *tsk) { return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ((void *)0)); } static inline __attribute__((no_instrument_function)) pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns); } static inline __attribute__((no_instrument_function)) pid_t task_session_vnr(struct task_struct *tsk) { return __task_pid_nr_ns(tsk, PIDTYPE_SID, ((void *)0)); } static inline __attribute__((no_instrument_function)) pid_t task_pgrp_nr(struct task_struct *tsk) { return task_pgrp_nr_ns(tsk, &init_pid_ns); } static inline __attribute__((no_instrument_function)) int pid_alive(struct task_struct *p) { return p->pids[PIDTYPE_PID].pid != ((void *)0); } static inline __attribute__((no_instrument_function)) int is_global_init(struct task_struct *tsk) { return tsk->pid == 1; } extern int is_container_init(struct task_struct *tsk); extern struct pid *cad_pid; extern void free_task(struct task_struct *tsk); extern void __put_task_struct(struct task_struct *t); static inline __attribute__((no_instrument_function)) void put_task_struct(struct task_struct *t) { if (atomic_dec_and_test(&t->usage)) __put_task_struct(t); } extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); extern bool task_set_jobctl_pending(struct task_struct *task, unsigned int mask); extern void task_clear_jobctl_trapping(struct task_struct *task); extern void task_clear_jobctl_pending(struct task_struct *task, unsigned int mask); static inline __attribute__((no_instrument_function)) void rcu_copy_process(struct task_struct *p) { } extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); extern unsigned long long __attribute__((no_instrument_function)) sched_clock(void); extern u64 cpu_clock(int cpu); extern u64 local_clock(void); extern u64 sched_clock_cpu(int cpu); extern void sched_clock_init(void); extern int sched_clock_stable; extern void sched_clock_tick(void); extern void sched_clock_idle_sleep_event(void); extern void sched_clock_idle_wakeup_event(u64 delta_ns); extern void enable_sched_clock_irqtime(void); extern void disable_sched_clock_irqtime(void); extern unsigned long long task_sched_runtime(struct task_struct *task); extern void sched_exec(void); extern void sched_clock_idle_sleep_event(void); extern void sched_clock_idle_wakeup_event(u64 delta_ns); extern void idle_task_exit(void); extern void wake_up_idle_cpu(int cpu); extern unsigned int sysctl_sched_latency; extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_child_runs_first; enum sched_tunable_scaling { SCHED_TUNABLESCALING_NONE, SCHED_TUNABLESCALING_LOG, SCHED_TUNABLESCALING_LINEAR, SCHED_TUNABLESCALING_END, }; extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; extern unsigned int sysctl_sched_migration_cost; extern unsigned int sysctl_sched_nr_migrate; extern unsigned int sysctl_sched_time_avg; extern unsigned int sysctl_timer_migration; extern unsigned int sysctl_sched_shares_window; int sched_proc_update_handler(struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos); static inline __attribute__((no_instrument_function)) unsigned int get_sysctl_timer_migration(void) { return sysctl_timer_migration; } extern unsigned int sysctl_sched_rt_period; extern int sysctl_sched_rt_runtime; int sched_rt_handler(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); extern unsigned int sysctl_sched_autogroup_enabled; extern void sched_autogroup_create_attach(struct task_struct *p); extern void sched_autogroup_detach(struct task_struct *p); extern void sched_autogroup_fork(struct signal_struct *sig); extern void sched_autogroup_exit(struct signal_struct *sig); extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice); extern unsigned int sysctl_sched_cfs_bandwidth_slice; extern int rt_mutex_getprio(struct task_struct *p); extern void rt_mutex_setprio(struct task_struct *p, int prio); extern void rt_mutex_adjust_pi(struct task_struct *p); static inline __attribute__((no_instrument_function)) bool tsk_is_pi_blocked(struct task_struct *tsk) { return tsk->pi_blocked_on != ((void *)0); } extern bool yield_to(struct task_struct *p, bool preempt); extern void set_user_nice(struct task_struct *p, long nice); extern int task_prio(const struct task_struct *p); extern int task_nice(const struct task_struct *p); extern int can_nice(const struct task_struct *p, const int nice); extern int task_curr(const struct task_struct *p); extern int idle_cpu(int cpu); extern int sched_setscheduler(struct task_struct *, int, const struct sched_param *); extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sched_param *); extern struct task_struct *idle_task(int cpu); static inline __attribute__((no_instrument_function)) bool is_idle_task(const struct task_struct *p) { return p->pid == 0; } extern struct task_struct *curr_task(int cpu); extern void set_curr_task(int cpu, struct task_struct *p); void yield(void); extern struct exec_domain default_exec_domain; union thread_union { struct thread_info thread_info; unsigned long stack[(((1UL) << 12) << 1)/sizeof(long)]; }; static inline __attribute__((no_instrument_function)) int kstack_end(void *addr) { return !(((unsigned long)addr+sizeof(void*)-1) & ((((1UL) << 12) << 1)-sizeof(void*))); } extern union thread_union init_thread_union; extern struct task_struct init_task; extern struct mm_struct init_mm; extern struct pid_namespace init_pid_ns; extern struct task_struct *find_task_by_vpid(pid_t nr); extern struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns); extern void __set_special_pids(struct pid *pid); extern struct user_struct * alloc_uid(struct user_namespace *, uid_t); static inline __attribute__((no_instrument_function)) struct user_struct *get_uid(struct user_struct *u) { atomic_inc(&u->__count); return u; } extern void free_uid(struct user_struct *); extern void release_uids(struct user_namespace *ns); extern void xtime_update(unsigned long ticks); extern int wake_up_state(struct task_struct *tsk, unsigned int state); extern int wake_up_process(struct task_struct *tsk); extern void wake_up_new_task(struct task_struct *tsk); extern void kick_process(struct task_struct *tsk); extern void sched_fork(struct task_struct *p); extern void sched_dead(struct task_struct *p); extern void proc_caches_init(void); extern void flush_signals(struct task_struct *); extern void __flush_signals(struct task_struct *); extern void ignore_signals(struct task_struct *); extern void flush_signal_handlers(struct task_struct *, int force_default); extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); static inline __attribute__((no_instrument_function)) int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) { unsigned long flags; int ret; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = _raw_spin_lock_irqsave(spinlock_check(&tsk->sighand->siglock)); } while (0); } while (0); ret = dequeue_signal(tsk, mask, info); spin_unlock_irqrestore(&tsk->sighand->siglock, flags); return ret; } extern void block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask); extern void unblock_all_signals(void); extern void release_task(struct task_struct * p); extern int send_sig_info(int, struct siginfo *, struct task_struct *); extern int force_sigsegv(int, struct task_struct *); extern int force_sig_info(int, struct siginfo *, struct task_struct *); extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, const struct cred *, u32); extern int kill_pgrp(struct pid *pid, int sig, int priv); extern int kill_pid(struct pid *pid, int sig, int priv); extern int kill_proc_info(int, struct siginfo *, pid_t); extern __attribute__((warn_unused_result)) bool do_notify_parent(struct task_struct *, int); extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); extern void force_sig(int, struct task_struct *); extern int send_sig(int, struct task_struct *, int); extern int zap_other_threads(struct task_struct *p); extern struct sigqueue *sigqueue_alloc(void); extern void sigqueue_free(struct sigqueue *); extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); extern int do_sigaltstack(const stack_t *, stack_t *, unsigned long); static inline __attribute__((no_instrument_function)) int kill_cad_pid(int sig, int priv) { return kill_pid(cad_pid, sig, priv); } static inline __attribute__((no_instrument_function)) int on_sig_stack(unsigned long sp) { return sp > get_current()->sas_ss_sp && sp - get_current()->sas_ss_sp <= get_current()->sas_ss_size; } static inline __attribute__((no_instrument_function)) int sas_ss_flags(unsigned long sp) { return (get_current()->sas_ss_size == 0 ? 2 : on_sig_stack(sp) ? 1 : 0); } extern struct mm_struct * mm_alloc(void); extern void __mmdrop(struct mm_struct *); static inline __attribute__((no_instrument_function)) void mmdrop(struct mm_struct * mm) { if (ldv__builtin_expect(!!(atomic_dec_and_test(&mm->mm_count)), 0)) __mmdrop(mm); } extern void mmput(struct mm_struct *); extern struct mm_struct *get_task_mm(struct task_struct *task); extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); extern void mm_release(struct task_struct *, struct mm_struct *); extern struct mm_struct *dup_mm(struct task_struct *tsk); extern int copy_thread(unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); extern void flush_thread(void); extern void exit_thread(void); extern void exit_files(struct task_struct *); extern void __cleanup_sighand(struct sighand_struct *); extern void exit_itimers(struct signal_struct *); extern void flush_itimer_signals(void); extern void do_group_exit(int); extern void daemonize(const char *, ...); extern int allow_signal(int); extern int disallow_signal(int); extern int do_execve(const char *, const char * const *, const char * const *, struct pt_regs *); extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int *, int *); struct task_struct *fork_idle(int); extern void set_task_comm(struct task_struct *tsk, char *from); extern char *get_task_comm(char *to, struct task_struct *tsk); void scheduler_ipi(void); extern unsigned long wait_task_inactive(struct task_struct *, long match_state); extern bool current_is_single_threaded(void); static inline __attribute__((no_instrument_function)) int get_nr_threads(struct task_struct *tsk) { return tsk->signal->nr_threads; } static inline __attribute__((no_instrument_function)) bool thread_group_leader(struct task_struct *p) { return p->exit_signal >= 0; } static inline __attribute__((no_instrument_function)) int has_group_leader_pid(struct task_struct *p) { return p->pid == p->tgid; } static inline __attribute__((no_instrument_function)) int same_thread_group(struct task_struct *p1, struct task_struct *p2) { return p1->tgid == p2->tgid; } static inline __attribute__((no_instrument_function)) struct task_struct *next_thread(const struct task_struct *p) { return ({typeof (*p->thread_group.next) *__ptr = (typeof (*p->thread_group.next) *)p->thread_group.next; ({ const typeof( ((struct task_struct *)0)->thread_group ) *__mptr = ((typeof(p->thread_group.next))({ typeof(*(__ptr)) *_________p1 = (typeof(*(__ptr))* )(*(volatile typeof((__ptr)) *)&((__ptr))); do { } while (0); ; do { } while (0); ((typeof(*(__ptr)) *)(_________p1)); })); (struct task_struct *)( (char *)__mptr - __builtin_offsetof(struct task_struct,thread_group) );}); }) ; } static inline __attribute__((no_instrument_function)) int thread_group_empty(struct task_struct *p) { return list_empty(&p->thread_group); } static inline __attribute__((no_instrument_function)) void task_lock(struct task_struct *p) { spin_lock(&p->alloc_lock); } static inline __attribute__((no_instrument_function)) void task_unlock(struct task_struct *p) { spin_unlock(&p->alloc_lock); } extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, unsigned long *flags); static inline __attribute__((no_instrument_function)) struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) { struct sighand_struct *ret; ret = __lock_task_sighand(tsk, flags); (void)(ret); return ret; } static inline __attribute__((no_instrument_function)) void unlock_task_sighand(struct task_struct *tsk, unsigned long *flags) { spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); } static inline __attribute__((no_instrument_function)) void threadgroup_change_begin(struct task_struct *tsk) { down_read(&tsk->signal->group_rwsem); } static inline __attribute__((no_instrument_function)) void threadgroup_change_end(struct task_struct *tsk) { up_read(&tsk->signal->group_rwsem); } static inline __attribute__((no_instrument_function)) void threadgroup_lock(struct task_struct *tsk) { mutex_lock(&tsk->signal->cred_guard_mutex); down_write(&tsk->signal->group_rwsem); } static inline __attribute__((no_instrument_function)) void threadgroup_unlock(struct task_struct *tsk) { up_write(&tsk->signal->group_rwsem); mutex_unlock(&tsk->signal->cred_guard_mutex); } static inline __attribute__((no_instrument_function)) void setup_thread_stack(struct task_struct *p, struct task_struct *org) { *((struct thread_info *)(p)->stack) = *((struct thread_info *)(org)->stack); ((struct thread_info *)(p)->stack)->task = p; } static inline __attribute__((no_instrument_function)) unsigned long *end_of_stack(struct task_struct *p) { return (unsigned long *)(((struct thread_info *)(p)->stack) + 1); } static inline __attribute__((no_instrument_function)) int object_is_on_stack(void *obj) { void *stack = ((get_current())->stack); return (obj >= stack) && (obj < (stack + (((1UL) << 12) << 1))); } extern void thread_info_cache_init(void); static inline __attribute__((no_instrument_function)) unsigned long stack_not_used(struct task_struct *p) { unsigned long *n = end_of_stack(p); do { n++; } while (!*n); return (unsigned long)n - (unsigned long)end_of_stack(p); } static inline __attribute__((no_instrument_function)) void set_tsk_thread_flag(struct task_struct *tsk, int flag) { set_ti_thread_flag(((struct thread_info *)(tsk)->stack), flag); } static inline __attribute__((no_instrument_function)) void clear_tsk_thread_flag(struct task_struct *tsk, int flag) { clear_ti_thread_flag(((struct thread_info *)(tsk)->stack), flag); } static inline __attribute__((no_instrument_function)) int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag) { return test_and_set_ti_thread_flag(((struct thread_info *)(tsk)->stack), flag); } static inline __attribute__((no_instrument_function)) int test_and_clear_tsk_thread_flag(struct task_struct *tsk, int flag) { return test_and_clear_ti_thread_flag(((struct thread_info *)(tsk)->stack), flag); } static inline __attribute__((no_instrument_function)) int test_tsk_thread_flag(struct task_struct *tsk, int flag) { return test_ti_thread_flag(((struct thread_info *)(tsk)->stack), flag); } static inline __attribute__((no_instrument_function)) void set_tsk_need_resched(struct task_struct *tsk) { set_tsk_thread_flag(tsk,3); } static inline __attribute__((no_instrument_function)) void clear_tsk_need_resched(struct task_struct *tsk) { clear_tsk_thread_flag(tsk,3); } static inline __attribute__((no_instrument_function)) int test_tsk_need_resched(struct task_struct *tsk) { return ldv__builtin_expect(!!(test_tsk_thread_flag(tsk,3)), 0); } static inline __attribute__((no_instrument_function)) int restart_syscall(void) { set_tsk_thread_flag(get_current(), 2); return -513; } static inline __attribute__((no_instrument_function)) int signal_pending(struct task_struct *p) { return ldv__builtin_expect(!!(test_tsk_thread_flag(p,2)), 0); } static inline __attribute__((no_instrument_function)) int __fatal_signal_pending(struct task_struct *p) { return ldv__builtin_expect(!!(sigismember(&p->pending.signal, 9)), 0); } static inline __attribute__((no_instrument_function)) int fatal_signal_pending(struct task_struct *p) { return signal_pending(p) && __fatal_signal_pending(p); } static inline __attribute__((no_instrument_function)) int signal_pending_state(long state, struct task_struct *p) { if (!(state & (1 | 128))) return 0; if (!signal_pending(p)) return 0; return (state & 1) || __fatal_signal_pending(p); } static inline __attribute__((no_instrument_function)) int need_resched(void) { return ldv__builtin_expect(!!(test_ti_thread_flag(current_thread_info(), 3)), 0); } extern int _cond_resched(void); extern int __cond_resched_lock(spinlock_t *lock); extern int __cond_resched_softirq(void); static inline __attribute__((no_instrument_function)) int spin_needbreak(spinlock_t *lock) { return 0; } void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times); static inline __attribute__((no_instrument_function)) void thread_group_cputime_init(struct signal_struct *sig) { do { static struct lock_class_key __key; __raw_spin_lock_init((&sig->cputimer.lock), "&sig->cputimer.lock", &__key); } while (0); } extern void recalc_sigpending_and_wake(struct task_struct *t); extern void recalc_sigpending(void); extern void signal_wake_up(struct task_struct *t, int resume_stopped); static inline __attribute__((no_instrument_function)) unsigned int task_cpu(const struct task_struct *p) { return ((struct thread_info *)(p)->stack)->cpu; } extern void set_task_cpu(struct task_struct *p, unsigned int cpu); extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); extern long sched_getaffinity(pid_t pid, struct cpumask *mask); extern void normalize_rt_tasks(void); extern struct task_group root_task_group; extern struct task_group *sched_create_group(struct task_group *parent); extern void sched_destroy_group(struct task_group *tg); extern void sched_move_task(struct task_struct *tsk); extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); extern unsigned long sched_group_shares(struct task_group *tg); extern int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us); extern long sched_group_rt_runtime(struct task_group *tg); extern int sched_group_set_rt_period(struct task_group *tg, long rt_period_us); extern long sched_group_rt_period(struct task_group *tg); extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk); extern int task_can_switch_user(struct user_struct *up, struct task_struct *tsk); static inline __attribute__((no_instrument_function)) void add_rchar(struct task_struct *tsk, ssize_t amt) { tsk->ioac.rchar += amt; } static inline __attribute__((no_instrument_function)) void add_wchar(struct task_struct *tsk, ssize_t amt) { tsk->ioac.wchar += amt; } static inline __attribute__((no_instrument_function)) void inc_syscr(struct task_struct *tsk) { tsk->ioac.syscr++; } static inline __attribute__((no_instrument_function)) void inc_syscw(struct task_struct *tsk) { tsk->ioac.syscw++; } extern void mm_update_next_owner(struct mm_struct *mm); extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); static inline __attribute__((no_instrument_function)) unsigned long task_rlimit(const struct task_struct *tsk, unsigned int limit) { return (*(volatile typeof(tsk->signal->rlim[limit].rlim_cur) *)&(tsk->signal->rlim[limit].rlim_cur)); } static inline __attribute__((no_instrument_function)) unsigned long task_rlimit_max(const struct task_struct *tsk, unsigned int limit) { return (*(volatile typeof(tsk->signal->rlim[limit].rlim_max) *)&(tsk->signal->rlim[limit].rlim_max)); } static inline __attribute__((no_instrument_function)) unsigned long rlimit(unsigned int limit) { return task_rlimit(get_current(), limit); } static inline __attribute__((no_instrument_function)) unsigned long rlimit_max(unsigned int limit) { return task_rlimit_max(get_current(), limit); } extern struct workqueue_struct *pm_wq; extern int __pm_runtime_idle(struct device *dev, int rpmflags); extern int __pm_runtime_suspend(struct device *dev, int rpmflags); extern int __pm_runtime_resume(struct device *dev, int rpmflags); extern int pm_schedule_suspend(struct device *dev, unsigned int delay); extern int __pm_runtime_set_status(struct device *dev, unsigned int status); extern int pm_runtime_barrier(struct device *dev); extern void pm_runtime_enable(struct device *dev); extern void __pm_runtime_disable(struct device *dev, bool check_resume); extern void pm_runtime_allow(struct device *dev); extern void pm_runtime_forbid(struct device *dev); extern int pm_generic_runtime_idle(struct device *dev); extern int pm_generic_runtime_suspend(struct device *dev); extern int pm_generic_runtime_resume(struct device *dev); extern void pm_runtime_no_callbacks(struct device *dev); extern void pm_runtime_irq_safe(struct device *dev); extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); extern void pm_runtime_update_max_time_suspended(struct device *dev, s64 delta_ns); static inline __attribute__((no_instrument_function)) bool pm_children_suspended(struct device *dev) { return dev->power.ignore_children || !atomic_read(&dev->power.child_count); } static inline __attribute__((no_instrument_function)) void pm_runtime_get_noresume(struct device *dev) { atomic_inc(&dev->power.usage_count); } static inline __attribute__((no_instrument_function)) void pm_runtime_put_noidle(struct device *dev) { atomic_add_unless(&dev->power.usage_count, -1, 0); } static inline __attribute__((no_instrument_function)) bool device_run_wake(struct device *dev) { return dev->power.run_wake; } static inline __attribute__((no_instrument_function)) void device_set_run_wake(struct device *dev, bool enable) { dev->power.run_wake = enable; } static inline __attribute__((no_instrument_function)) bool pm_runtime_suspended(struct device *dev) { return dev->power.runtime_status == RPM_SUSPENDED && !dev->power.disable_depth; } static inline __attribute__((no_instrument_function)) bool pm_runtime_status_suspended(struct device *dev) { return dev->power.runtime_status == RPM_SUSPENDED; } static inline __attribute__((no_instrument_function)) bool pm_runtime_enabled(struct device *dev) { return !dev->power.disable_depth; } static inline __attribute__((no_instrument_function)) bool pm_runtime_callbacks_present(struct device *dev) { return !dev->power.no_callbacks; } static inline __attribute__((no_instrument_function)) void pm_runtime_mark_last_busy(struct device *dev) { (*(volatile typeof(dev->power.last_busy) *)&(dev->power.last_busy)) = jiffies; } static inline __attribute__((no_instrument_function)) int pm_runtime_idle(struct device *dev) { return __pm_runtime_idle(dev, 0); } static inline __attribute__((no_instrument_function)) int pm_runtime_suspend(struct device *dev) { return __pm_runtime_suspend(dev, 0); } static inline __attribute__((no_instrument_function)) int pm_runtime_autosuspend(struct device *dev) { return __pm_runtime_suspend(dev, 0x08); } static inline __attribute__((no_instrument_function)) int pm_runtime_resume(struct device *dev) { return __pm_runtime_resume(dev, 0); } static inline __attribute__((no_instrument_function)) int pm_request_idle(struct device *dev) { return __pm_runtime_idle(dev, 0x01); } static inline __attribute__((no_instrument_function)) int pm_request_resume(struct device *dev) { return __pm_runtime_resume(dev, 0x01); } static inline __attribute__((no_instrument_function)) int pm_request_autosuspend(struct device *dev) { return __pm_runtime_suspend(dev, 0x01 | 0x08); } static inline __attribute__((no_instrument_function)) int pm_runtime_get(struct device *dev) { return __pm_runtime_resume(dev, 0x04 | 0x01); } static inline __attribute__((no_instrument_function)) int pm_runtime_get_sync(struct device *dev) { return __pm_runtime_resume(dev, 0x04); } static inline __attribute__((no_instrument_function)) int pm_runtime_put(struct device *dev) { return __pm_runtime_idle(dev, 0x04 | 0x01); } static inline __attribute__((no_instrument_function)) int pm_runtime_put_autosuspend(struct device *dev) { return __pm_runtime_suspend(dev, 0x04 | 0x01 | 0x08); } static inline __attribute__((no_instrument_function)) int pm_runtime_put_sync(struct device *dev) { return __pm_runtime_idle(dev, 0x04); } static inline __attribute__((no_instrument_function)) int pm_runtime_put_sync_suspend(struct device *dev) { return __pm_runtime_suspend(dev, 0x04); } static inline __attribute__((no_instrument_function)) int pm_runtime_put_sync_autosuspend(struct device *dev) { return __pm_runtime_suspend(dev, 0x04 | 0x08); } static inline __attribute__((no_instrument_function)) int pm_runtime_set_active(struct device *dev) { return __pm_runtime_set_status(dev, RPM_ACTIVE); } static inline __attribute__((no_instrument_function)) void pm_runtime_set_suspended(struct device *dev) { __pm_runtime_set_status(dev, RPM_SUSPENDED); } static inline __attribute__((no_instrument_function)) void pm_runtime_disable(struct device *dev) { __pm_runtime_disable(dev, true); } static inline __attribute__((no_instrument_function)) void pm_runtime_use_autosuspend(struct device *dev) { __pm_runtime_use_autosuspend(dev, true); } static inline __attribute__((no_instrument_function)) void pm_runtime_dont_use_autosuspend(struct device *dev) { __pm_runtime_use_autosuspend(dev, false); } struct usb_device; struct usb_driver; struct wusb_dev; struct ep_device; struct usb_host_endpoint { struct usb_endpoint_descriptor desc; struct usb_ss_ep_comp_descriptor ss_ep_comp; struct list_head urb_list; void *hcpriv; struct ep_device *ep_dev; unsigned char *extra; int extralen; int enabled; }; struct usb_host_interface { struct usb_interface_descriptor desc; struct usb_host_endpoint *endpoint; char *string; unsigned char *extra; int extralen; }; enum usb_interface_condition { USB_INTERFACE_UNBOUND = 0, USB_INTERFACE_BINDING, USB_INTERFACE_BOUND, USB_INTERFACE_UNBINDING, }; struct usb_interface { struct usb_host_interface *altsetting; struct usb_host_interface *cur_altsetting; unsigned num_altsetting; struct usb_interface_assoc_descriptor *intf_assoc; int minor; enum usb_interface_condition condition; unsigned sysfs_files_created:1; unsigned ep_devs_created:1; unsigned unregistering:1; unsigned needs_remote_wakeup:1; unsigned needs_altsetting0:1; unsigned needs_binding:1; unsigned reset_running:1; unsigned resetting_device:1; struct device dev; struct device *usb_dev; atomic_t pm_usage_cnt; struct work_struct reset_ws; }; static inline __attribute__((no_instrument_function)) void *usb_get_intfdata(struct usb_interface *intf) { return dev_get_drvdata(&intf->dev); } static inline __attribute__((no_instrument_function)) void usb_set_intfdata(struct usb_interface *intf, void *data) { dev_set_drvdata(&intf->dev, data); } struct usb_interface *usb_get_intf(struct usb_interface *intf); void usb_put_intf(struct usb_interface *intf); struct usb_interface_cache { unsigned num_altsetting; struct kref ref; struct usb_host_interface altsetting[0]; }; struct usb_host_config { struct usb_config_descriptor desc; char *string; struct usb_interface_assoc_descriptor *intf_assoc[(32/2)]; struct usb_interface *interface[32]; struct usb_interface_cache *intf_cache[32]; unsigned char *extra; int extralen; }; struct usb_host_bos { struct usb_bos_descriptor *desc; struct usb_ext_cap_descriptor *ext_cap; struct usb_ss_cap_descriptor *ss_cap; struct usb_ss_container_id_descriptor *ss_id; }; int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr); struct usb_devmap { unsigned long devicemap[128 / (8*sizeof(unsigned long))]; }; struct usb_bus { struct device *controller; int busnum; const char *bus_name; u8 uses_dma; u8 uses_pio_for_control; u8 otg_port; unsigned is_b_host:1; unsigned b_hnp_enable:1; unsigned sg_tablesize; int devnum_next; struct usb_devmap devmap; struct usb_device *root_hub; struct usb_bus *hs_companion; struct list_head bus_list; int bandwidth_allocated; int bandwidth_int_reqs; int bandwidth_isoc_reqs; struct dentry *usbfs_dentry; struct mon_bus *mon_bus; int monitored; }; struct usb_tt; enum usb_device_removable { USB_DEVICE_REMOVABLE_UNKNOWN = 0, USB_DEVICE_REMOVABLE, USB_DEVICE_FIXED, }; struct usb_device { int devnum; char devpath[16]; u32 route; enum usb_device_state state; enum usb_device_speed speed; struct usb_tt *tt; int ttport; unsigned int toggle[2]; struct usb_device *parent; struct usb_bus *bus; struct usb_host_endpoint ep0; struct device dev; struct usb_device_descriptor descriptor; struct usb_host_bos *bos; struct usb_host_config *config; struct usb_host_config *actconfig; struct usb_host_endpoint *ep_in[16]; struct usb_host_endpoint *ep_out[16]; char **rawdescriptors; unsigned short bus_mA; u8 portnum; u8 level; unsigned can_submit:1; unsigned persist_enabled:1; unsigned have_langid:1; unsigned authorized:1; unsigned authenticated:1; unsigned wusb:1; unsigned lpm_capable:1; unsigned usb2_hw_lpm_capable:1; unsigned usb2_hw_lpm_enabled:1; int string_langid; char *product; char *manufacturer; char *serial; struct list_head filelist; struct device *usb_classdev; struct dentry *usbfs_dentry; int maxchild; struct usb_device **children; u32 quirks; atomic_t urbnum; unsigned long active_duration; unsigned long connect_time; unsigned do_remote_wakeup:1; unsigned reset_resume:1; struct wusb_dev *wusb_dev; int slot_id; enum usb_device_removable removable; }; static inline __attribute__((no_instrument_function)) struct usb_device *interface_to_usbdev(struct usb_interface *intf) { return ({ const typeof( ((struct usb_device *)0)->dev ) *__mptr = (intf->dev.parent); (struct usb_device *)( (char *)__mptr - __builtin_offsetof(struct usb_device,dev) );}); } extern struct usb_device *usb_get_dev(struct usb_device *dev); extern void usb_put_dev(struct usb_device *dev); extern int usb_lock_device_for_reset(struct usb_device *udev, const struct usb_interface *iface); extern int usb_reset_device(struct usb_device *dev); extern void usb_queue_reset_device(struct usb_interface *dev); extern void usb_enable_autosuspend(struct usb_device *udev); extern void usb_disable_autosuspend(struct usb_device *udev); extern int usb_autopm_get_interface(struct usb_interface *intf); extern void usb_autopm_put_interface(struct usb_interface *intf); extern int usb_autopm_get_interface_async(struct usb_interface *intf); extern void usb_autopm_put_interface_async(struct usb_interface *intf); extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf); extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); static inline __attribute__((no_instrument_function)) void usb_mark_last_busy(struct usb_device *udev) { pm_runtime_mark_last_busy(&udev->dev); } extern int usb_get_current_frame_number(struct usb_device *usb_dev); extern int usb_alloc_streams(struct usb_interface *interface, struct usb_host_endpoint **eps, unsigned int num_eps, unsigned int num_streams, gfp_t mem_flags); extern void usb_free_streams(struct usb_interface *interface, struct usb_host_endpoint **eps, unsigned int num_eps, gfp_t mem_flags); extern int usb_driver_claim_interface(struct usb_driver *driver, struct usb_interface *iface, void *priv); static inline __attribute__((no_instrument_function)) int usb_interface_claimed(struct usb_interface *iface) { return (iface->dev.driver != ((void *)0)); } extern void usb_driver_release_interface(struct usb_driver *driver, struct usb_interface *iface); const struct usb_device_id *usb_match_id(struct usb_interface *interface, const struct usb_device_id *id); extern int usb_match_one_id(struct usb_interface *interface, const struct usb_device_id *id); extern struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor); extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, unsigned ifnum); extern struct usb_host_interface *usb_altnum_to_altsetting( const struct usb_interface *intf, unsigned int altnum); extern struct usb_host_interface *usb_find_alt_setting( struct usb_host_config *config, unsigned int iface_num, unsigned int alt_num); static inline __attribute__((no_instrument_function)) int usb_make_path(struct usb_device *dev, char *buf, size_t size) { int actual; actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath); return (actual >= (int)size) ? -1 : actual; } struct usb_dynids { spinlock_t lock; struct list_head list; }; struct usb_dynid { struct list_head node; struct usb_device_id id; }; extern ssize_t usb_store_new_id(struct usb_dynids *dynids, struct device_driver *driver, const char *buf, size_t count); struct usbdrv_wrap { struct device_driver driver; int for_devices; }; struct usb_driver { const char *name; int (*probe) (struct usb_interface *intf, const struct usb_device_id *id); void (*disconnect) (struct usb_interface *intf); int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code, void *buf); int (*suspend) (struct usb_interface *intf, pm_message_t message); int (*resume) (struct usb_interface *intf); int (*reset_resume)(struct usb_interface *intf); int (*pre_reset)(struct usb_interface *intf); int (*post_reset)(struct usb_interface *intf); const struct usb_device_id *id_table; struct usb_dynids dynids; struct usbdrv_wrap drvwrap; unsigned int no_dynamic_id:1; unsigned int supports_autosuspend:1; unsigned int soft_unbind:1; }; struct usb_device_driver { const char *name; int (*probe) (struct usb_device *udev); void (*disconnect) (struct usb_device *udev); int (*suspend) (struct usb_device *udev, pm_message_t message); int (*resume) (struct usb_device *udev, pm_message_t message); struct usbdrv_wrap drvwrap; unsigned int supports_autosuspend:1; }; extern struct bus_type usb_bus_type; struct usb_class_driver { char *name; char *(*devnode)(struct device *dev, umode_t *mode); const struct file_operations *fops; int minor_base; }; extern int usb_register_driver(struct usb_driver *, struct module *, const char *); extern void usb_deregister(struct usb_driver *); extern int usb_register_device_driver(struct usb_device_driver *, struct module *); extern void usb_deregister_device_driver(struct usb_device_driver *); extern int usb_register_dev(struct usb_interface *intf, struct usb_class_driver *class_driver); extern void usb_deregister_dev(struct usb_interface *intf, struct usb_class_driver *class_driver); extern int usb_disabled(void); struct usb_iso_packet_descriptor { unsigned int offset; unsigned int length; unsigned int actual_length; int status; }; struct urb; struct usb_anchor { struct list_head urb_list; wait_queue_head_t wait; spinlock_t lock; unsigned int poisoned:1; }; static inline __attribute__((no_instrument_function)) void init_usb_anchor(struct usb_anchor *anchor) { INIT_LIST_HEAD(&anchor->urb_list); do { static struct lock_class_key __key; __init_waitqueue_head((&anchor->wait), "&anchor->wait", &__key); } while (0); do { spinlock_check(&anchor->lock); do { static struct lock_class_key __key; __raw_spin_lock_init((&(&anchor->lock)->rlock), "&(&anchor->lock)->rlock", &__key); } while (0); } while (0); } typedef void (*usb_complete_t)(struct urb *); struct urb { struct kref kref; void *hcpriv; atomic_t use_count; atomic_t reject; int unlinked; struct list_head urb_list; struct list_head anchor_list; struct usb_anchor *anchor; struct usb_device *dev; struct usb_host_endpoint *ep; unsigned int pipe; unsigned int stream_id; int status; unsigned int transfer_flags; void *transfer_buffer; dma_addr_t transfer_dma; struct scatterlist *sg; int num_mapped_sgs; int num_sgs; u32 transfer_buffer_length; u32 actual_length; unsigned char *setup_packet; dma_addr_t setup_dma; int start_frame; int number_of_packets; int interval; int error_count; void *context; usb_complete_t complete; struct usb_iso_packet_descriptor iso_frame_desc[0]; }; static inline __attribute__((no_instrument_function)) void usb_fill_control_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, unsigned char *setup_packet, void *transfer_buffer, int buffer_length, usb_complete_t complete_fn, void *context) { urb->dev = dev; urb->pipe = pipe; urb->setup_packet = setup_packet; urb->transfer_buffer = transfer_buffer; urb->transfer_buffer_length = buffer_length; urb->complete = complete_fn; urb->context = context; } static inline __attribute__((no_instrument_function)) void usb_fill_bulk_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, void *transfer_buffer, int buffer_length, usb_complete_t complete_fn, void *context) { urb->dev = dev; urb->pipe = pipe; urb->transfer_buffer = transfer_buffer; urb->transfer_buffer_length = buffer_length; urb->complete = complete_fn; urb->context = context; } static inline __attribute__((no_instrument_function)) void usb_fill_int_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, void *transfer_buffer, int buffer_length, usb_complete_t complete_fn, void *context, int interval) { urb->dev = dev; urb->pipe = pipe; urb->transfer_buffer = transfer_buffer; urb->transfer_buffer_length = buffer_length; urb->complete = complete_fn; urb->context = context; if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) urb->interval = 1 << (interval - 1); else urb->interval = interval; urb->start_frame = -1; } extern void usb_init_urb(struct urb *urb); extern struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags); extern void usb_free_urb(struct urb *urb); extern struct urb *usb_get_urb(struct urb *urb); extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); extern int usb_unlink_urb(struct urb *urb); extern void usb_kill_urb(struct urb *urb); extern void usb_poison_urb(struct urb *urb); extern void usb_unpoison_urb(struct urb *urb); extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); extern void usb_unanchor_urb(struct urb *urb); extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, unsigned int timeout); extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor); extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); extern int usb_anchor_empty(struct usb_anchor *anchor); static inline __attribute__((no_instrument_function)) int usb_urb_dir_in(struct urb *urb) { return (urb->transfer_flags & 0x0200) == 0x0200; } static inline __attribute__((no_instrument_function)) int usb_urb_dir_out(struct urb *urb) { return (urb->transfer_flags & 0x0200) == 0; } void *usb_alloc_coherent(struct usb_device *dev, size_t size, gfp_t mem_flags, dma_addr_t *dma); void usb_free_coherent(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma); struct scatterlist; int usb_buffer_map_sg(const struct usb_device *dev, int is_in, struct scatterlist *sg, int nents); void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in, struct scatterlist *sg, int n_hw_ents); extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout); extern int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout); extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout); extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, unsigned char descindex, void *buf, int size); extern int usb_get_status(struct usb_device *dev, int type, int target, void *data); extern int usb_string(struct usb_device *dev, int index, char *buf, size_t size); extern int usb_clear_halt(struct usb_device *dev, int pipe); extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); extern int usb_driver_set_configuration(struct usb_device *udev, int config); struct usb_sg_request { int status; size_t bytes; spinlock_t lock; struct usb_device *dev; int pipe; int entries; struct urb **urbs; int count; struct completion complete; }; int usb_sg_init( struct usb_sg_request *io, struct usb_device *dev, unsigned pipe, unsigned period, struct scatterlist *sg, int nents, size_t length, gfp_t mem_flags ); void usb_sg_cancel(struct usb_sg_request *io); void usb_sg_wait(struct usb_sg_request *io); static inline __attribute__((no_instrument_function)) unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint) { return (dev->devnum << 8) | (endpoint << 15); } static inline __attribute__((no_instrument_function)) struct usb_host_endpoint * usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) { struct usb_host_endpoint **eps; eps = ((pipe) & 0x80) ? dev->ep_in : dev->ep_out; return eps[(((pipe) >> 15) & 0xf)]; } static inline __attribute__((no_instrument_function)) __u16 usb_maxpacket(struct usb_device *udev, int pipe, int is_out) { struct usb_host_endpoint *ep; unsigned epnum = (((pipe) >> 15) & 0xf); if (is_out) { ({ int __ret_warn_on = !!(((pipe) & 0x80)); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/usb.h", 1608); ldv__builtin_expect(!!(__ret_warn_on), 0); }); ep = udev->ep_out[epnum]; } else { ({ int __ret_warn_on = !!((!((pipe) & 0x80))); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/usb.h", 1611); ldv__builtin_expect(!!(__ret_warn_on), 0); }); ep = udev->ep_in[epnum]; } if (!ep) return 0; return usb_endpoint_maxp(&ep->desc); } static inline __attribute__((no_instrument_function)) int usb_translate_errors(int error_code) { switch (error_code) { case 0: case -12: case -19: return error_code; default: return -5; } } extern void usb_register_notify(struct notifier_block *nb); extern void usb_unregister_notify(struct notifier_block *nb); extern struct dentry *usb_debug_root; struct device; void __iowrite32_copy(void *to, const void *from, size_t count); void __iowrite64_copy(void *to, const void *from, size_t count); int ioremap_page_range(unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot); void * devm_ioport_map(struct device *dev, unsigned long port, unsigned int nr); void devm_ioport_unmap(struct device *dev, void *addr); void *devm_ioremap(struct device *dev, resource_size_t offset, unsigned long size); void *devm_ioremap_nocache(struct device *dev, resource_size_t offset, unsigned long size); void devm_iounmap(struct device *dev, void *addr); int check_signature(const volatile void *io_addr, const unsigned char *signature, int length); void devm_ioremap_release(struct device *dev, void *res); struct pci_slot { struct pci_bus *bus; struct list_head list; struct hotplug_slot *hotplug; unsigned char number; struct kobject kobj; }; static inline __attribute__((no_instrument_function)) const char *pci_slot_name(const struct pci_slot *slot) { return kobject_name(&slot->kobj); } enum pci_mmap_state { pci_mmap_io, pci_mmap_mem }; enum { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END = 5, PCI_ROM_RESOURCE, PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + 6 - 1, PCI_BRIDGE_RESOURCES, PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES + 4 - 1, PCI_NUM_RESOURCES, DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, }; typedef int pci_power_t; extern const char *pci_power_names[]; static inline __attribute__((no_instrument_function)) const char *pci_power_name(pci_power_t state) { return pci_power_names[1 + (int) state]; } typedef unsigned int pci_channel_state_t; enum pci_channel_state { pci_channel_io_normal = ( pci_channel_state_t) 1, pci_channel_io_frozen = ( pci_channel_state_t) 2, pci_channel_io_perm_failure = ( pci_channel_state_t) 3, }; typedef unsigned int pcie_reset_state_t; enum pcie_reset_state { pcie_deassert_reset = ( pcie_reset_state_t) 1, pcie_warm_reset = ( pcie_reset_state_t) 2, pcie_hot_reset = ( pcie_reset_state_t) 3 }; typedef unsigned short pci_dev_flags_t; enum pci_dev_flags { PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = ( pci_dev_flags_t) 1, PCI_DEV_FLAGS_NO_D3 = ( pci_dev_flags_t) 2, PCI_DEV_FLAGS_ASSIGNED = ( pci_dev_flags_t) 4, }; enum pci_irq_reroute_variant { INTEL_IRQ_REROUTE_VARIANT = 1, MAX_IRQ_REROUTE_VARIANTS = 3 }; typedef unsigned short pci_bus_flags_t; enum pci_bus_flags { PCI_BUS_FLAGS_NO_MSI = ( pci_bus_flags_t) 1, PCI_BUS_FLAGS_NO_MMRBC = ( pci_bus_flags_t) 2, }; enum pci_bus_speed { PCI_SPEED_33MHz = 0x00, PCI_SPEED_66MHz = 0x01, PCI_SPEED_66MHz_PCIX = 0x02, PCI_SPEED_100MHz_PCIX = 0x03, PCI_SPEED_133MHz_PCIX = 0x04, PCI_SPEED_66MHz_PCIX_ECC = 0x05, PCI_SPEED_100MHz_PCIX_ECC = 0x06, PCI_SPEED_133MHz_PCIX_ECC = 0x07, PCI_SPEED_66MHz_PCIX_266 = 0x09, PCI_SPEED_100MHz_PCIX_266 = 0x0a, PCI_SPEED_133MHz_PCIX_266 = 0x0b, AGP_UNKNOWN = 0x0c, AGP_1X = 0x0d, AGP_2X = 0x0e, AGP_4X = 0x0f, AGP_8X = 0x10, PCI_SPEED_66MHz_PCIX_533 = 0x11, PCI_SPEED_100MHz_PCIX_533 = 0x12, PCI_SPEED_133MHz_PCIX_533 = 0x13, PCIE_SPEED_2_5GT = 0x14, PCIE_SPEED_5_0GT = 0x15, PCIE_SPEED_8_0GT = 0x16, PCI_SPEED_UNKNOWN = 0xff, }; struct pci_cap_saved_data { char cap_nr; unsigned int size; u32 data[0]; }; struct pci_cap_saved_state { struct hlist_node next; struct pci_cap_saved_data cap; }; struct pcie_link_state; struct pci_vpd; struct pci_sriov; struct pci_ats; struct pci_dev { struct list_head bus_list; struct pci_bus *bus; struct pci_bus *subordinate; void *sysdata; struct proc_dir_entry *procent; struct pci_slot *slot; unsigned int devfn; unsigned short vendor; unsigned short device; unsigned short subsystem_vendor; unsigned short subsystem_device; unsigned int class; u8 revision; u8 hdr_type; u8 pcie_cap; u8 pcie_type:4; u8 pcie_mpss:3; u8 rom_base_reg; u8 pin; struct pci_driver *driver; u64 dma_mask; struct device_dma_parameters dma_parms; pci_power_t current_state; int pm_cap; unsigned int pme_support:5; unsigned int pme_interrupt:1; unsigned int pme_poll:1; unsigned int d1_support:1; unsigned int d2_support:1; unsigned int no_d1d2:1; unsigned int mmio_always_on:1; unsigned int wakeup_prepared:1; unsigned int d3_delay; struct pcie_link_state *link_state; pci_channel_state_t error_state; struct device dev; int cfg_size; unsigned int irq; struct resource resource[DEVICE_COUNT_RESOURCE]; unsigned int transparent:1; unsigned int multifunction:1; unsigned int is_added:1; unsigned int is_busmaster:1; unsigned int no_msi:1; unsigned int block_cfg_access:1; unsigned int broken_parity_status:1; unsigned int irq_reroute_variant:2; unsigned int msi_enabled:1; unsigned int msix_enabled:1; unsigned int ari_enabled:1; unsigned int is_managed:1; unsigned int is_pcie:1; unsigned int needs_freset:1; unsigned int state_saved:1; unsigned int is_physfn:1; unsigned int is_virtfn:1; unsigned int reset_fn:1; unsigned int is_hotplug_bridge:1; unsigned int __aer_firmware_first_valid:1; unsigned int __aer_firmware_first:1; pci_dev_flags_t dev_flags; atomic_t enable_cnt; u32 saved_config_space[16]; struct hlist_head saved_cap_space; struct bin_attribute *rom_attr; int rom_attr_enabled; struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; struct list_head msi_list; struct kset *msi_kset; struct pci_vpd *vpd; union { struct pci_sriov *sriov; struct pci_dev *physfn; }; struct pci_ats *ats; }; static inline __attribute__((no_instrument_function)) struct pci_dev *pci_physfn(struct pci_dev *dev) { if (dev->is_virtfn) dev = dev->physfn; return dev; } extern struct pci_dev *alloc_pci_dev(void); static inline __attribute__((no_instrument_function)) int pci_channel_offline(struct pci_dev *pdev) { return (pdev->error_state != pci_channel_io_normal); } struct pci_host_bridge_window { struct list_head list; struct resource *res; resource_size_t offset; }; struct pci_host_bridge { struct list_head list; struct pci_bus *bus; struct list_head windows; }; struct pci_bus_resource { struct list_head list; struct resource *res; unsigned int flags; }; struct pci_bus { struct list_head node; struct pci_bus *parent; struct list_head children; struct list_head devices; struct pci_dev *self; struct list_head slots; struct resource *resource[4]; struct list_head resources; struct pci_ops *ops; void *sysdata; struct proc_dir_entry *procdir; unsigned char number; unsigned char primary; unsigned char secondary; unsigned char subordinate; unsigned char max_bus_speed; unsigned char cur_bus_speed; char name[48]; unsigned short bridge_ctl; pci_bus_flags_t bus_flags; struct device *bridge; struct device dev; struct bin_attribute *legacy_io; struct bin_attribute *legacy_mem; unsigned int is_added:1; }; static inline __attribute__((no_instrument_function)) bool pci_is_root_bus(struct pci_bus *pbus) { return !(pbus->parent); } static inline __attribute__((no_instrument_function)) bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return pci_dev->msi_enabled || pci_dev->msix_enabled; } struct pci_ops { int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); }; extern int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 *val); extern int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 val); struct pci_bus_region { resource_size_t start; resource_size_t end; }; struct pci_dynids { spinlock_t lock; struct list_head list; }; typedef unsigned int pci_ers_result_t; enum pci_ers_result { PCI_ERS_RESULT_NONE = ( pci_ers_result_t) 1, PCI_ERS_RESULT_CAN_RECOVER = ( pci_ers_result_t) 2, PCI_ERS_RESULT_NEED_RESET = ( pci_ers_result_t) 3, PCI_ERS_RESULT_DISCONNECT = ( pci_ers_result_t) 4, PCI_ERS_RESULT_RECOVERED = ( pci_ers_result_t) 5, }; struct pci_error_handlers { pci_ers_result_t (*error_detected)(struct pci_dev *dev, enum pci_channel_state error); pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); pci_ers_result_t (*link_reset)(struct pci_dev *dev); pci_ers_result_t (*slot_reset)(struct pci_dev *dev); void (*resume)(struct pci_dev *dev); }; struct module; struct pci_driver { struct list_head node; const char *name; const struct pci_device_id *id_table; int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); void (*remove) (struct pci_dev *dev); int (*suspend) (struct pci_dev *dev, pm_message_t state); int (*suspend_late) (struct pci_dev *dev, pm_message_t state); int (*resume_early) (struct pci_dev *dev); int (*resume) (struct pci_dev *dev); void (*shutdown) (struct pci_dev *dev); struct pci_error_handlers *err_handler; struct device_driver driver; struct pci_dynids dynids; }; extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); enum pcie_bus_config_types { PCIE_BUS_TUNE_OFF, PCIE_BUS_SAFE, PCIE_BUS_PERFORMANCE, PCIE_BUS_PEER2PEER, }; extern enum pcie_bus_config_types pcie_bus_config; extern struct bus_type pci_bus_type; extern struct list_head pci_root_buses; extern int no_pci_devices(void); void pcibios_fixup_bus(struct pci_bus *); int __attribute__((warn_unused_result)) pcibios_enable_device(struct pci_dev *, int mask); char *pcibios_setup(char *str); resource_size_t pcibios_align_resource(void *, const struct resource *, resource_size_t, resource_size_t); void pcibios_update_irq(struct pci_dev *, int irq); void pci_fixup_cardbus(struct pci_bus *); void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); void pcibios_scan_specific_bus(int busn); extern struct pci_bus *pci_find_bus(int domain, int busnr); void pci_bus_add_devices(const struct pci_bus *bus); struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); struct pci_bus *pci_create_root_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources); struct pci_bus * __attribute__ ((__section__(".devinit.text"))) __attribute__((no_instrument_function)) pci_scan_root_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources); struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, const char *name, struct hotplug_slot *hotplug); void pci_destroy_slot(struct pci_slot *slot); void pci_renumber_slot(struct pci_slot *slot, int slot_nr); int pci_scan_slot(struct pci_bus *bus, int devfn); struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); unsigned int pci_scan_child_bus(struct pci_bus *bus); int __attribute__((warn_unused_result)) pci_bus_add_device(struct pci_dev *dev); void pci_read_bridge_bases(struct pci_bus *child); struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin); int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); extern struct pci_dev *pci_dev_get(struct pci_dev *dev); extern void pci_dev_put(struct pci_dev *dev); extern void pci_remove_bus(struct pci_bus *b); extern void __pci_remove_bus_device(struct pci_dev *dev); extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); extern void pci_stop_bus_device(struct pci_dev *dev); void pci_setup_cardbus(struct pci_bus *bus); extern void pci_sort_breadthfirst(void); enum pci_lost_interrupt_reason { PCI_LOST_IRQ_NO_INFORMATION = 0, PCI_LOST_IRQ_DISABLE_MSI, PCI_LOST_IRQ_DISABLE_MSIX, PCI_LOST_IRQ_DISABLE_ACPI, }; enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); int pci_find_capability(struct pci_dev *dev, int cap); int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); int pci_find_ext_capability(struct pci_dev *dev, int cap); int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn, int cap); int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); struct pci_bus *pci_find_next_bus(const struct pci_bus *from); struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from); struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from); struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, unsigned int devfn); static inline __attribute__((no_instrument_function)) struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) { return pci_get_domain_bus_and_slot(0, bus, devfn); } struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); int pci_dev_present(const struct pci_device_id *ids); int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val); int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 *val); int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 *val); int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val); int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val); int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val); struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); static inline __attribute__((no_instrument_function)) int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) { return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); } static inline __attribute__((no_instrument_function)) int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) { return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); } static inline __attribute__((no_instrument_function)) int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val) { return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); } static inline __attribute__((no_instrument_function)) int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) { return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); } static inline __attribute__((no_instrument_function)) int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) { return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); } static inline __attribute__((no_instrument_function)) int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val) { return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); } int __attribute__((warn_unused_result)) pci_enable_device(struct pci_dev *dev); int __attribute__((warn_unused_result)) pci_enable_device_io(struct pci_dev *dev); int __attribute__((warn_unused_result)) pci_enable_device_mem(struct pci_dev *dev); int __attribute__((warn_unused_result)) pci_reenable_device(struct pci_dev *); int __attribute__((warn_unused_result)) pcim_enable_device(struct pci_dev *pdev); void pcim_pin_device(struct pci_dev *pdev); static inline __attribute__((no_instrument_function)) int pci_is_enabled(struct pci_dev *pdev) { return (atomic_read(&pdev->enable_cnt) > 0); } static inline __attribute__((no_instrument_function)) int pci_is_managed(struct pci_dev *pdev) { return pdev->is_managed; } void pci_disable_device(struct pci_dev *dev); extern unsigned int pcibios_max_latency; void pci_set_master(struct pci_dev *dev); void pci_clear_master(struct pci_dev *dev); int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); int pci_set_cacheline_size(struct pci_dev *dev); int __attribute__((warn_unused_result)) pci_set_mwi(struct pci_dev *dev); int pci_try_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); void pci_intx(struct pci_dev *dev, int enable); bool pci_intx_mask_supported(struct pci_dev *dev); bool pci_check_and_mask_intx(struct pci_dev *dev); bool pci_check_and_unmask_intx(struct pci_dev *dev); void pci_msi_off(struct pci_dev *dev); int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); int pcix_get_max_mmrbc(struct pci_dev *dev); int pcix_get_mmrbc(struct pci_dev *dev); int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); int pcie_get_readrq(struct pci_dev *dev); int pcie_set_readrq(struct pci_dev *dev, int rq); int pcie_get_mps(struct pci_dev *dev); int pcie_set_mps(struct pci_dev *dev, int mps); int __pci_reset_function(struct pci_dev *dev); int __pci_reset_function_locked(struct pci_dev *dev); int pci_reset_function(struct pci_dev *dev); void pci_update_resource(struct pci_dev *dev, int resno); int __attribute__((warn_unused_result)) pci_assign_resource(struct pci_dev *dev, int i); int __attribute__((warn_unused_result)) pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); int pci_select_bars(struct pci_dev *dev, unsigned long flags); int pci_enable_rom(struct pci_dev *pdev); void pci_disable_rom(struct pci_dev *pdev); void __attribute__((warn_unused_result)) *pci_map_rom(struct pci_dev *pdev, size_t *size); void pci_unmap_rom(struct pci_dev *pdev, void *rom); size_t pci_get_rom_size(struct pci_dev *pdev, void *rom, size_t size); int pci_save_state(struct pci_dev *dev); void pci_restore_state(struct pci_dev *dev); struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state); int pci_load_and_free_saved_state(struct pci_dev *dev, struct pci_saved_state **state); int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); int pci_set_power_state(struct pci_dev *dev, pci_power_t state); pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); void pci_pme_active(struct pci_dev *dev, bool enable); int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool runtime, bool enable); int pci_wake_from_d3(struct pci_dev *dev, bool enable); pci_power_t pci_target_state(struct pci_dev *dev); int pci_prepare_to_sleep(struct pci_dev *dev); int pci_back_from_sleep(struct pci_dev *dev); bool pci_dev_run_wake(struct pci_dev *dev); bool pci_check_pme_status(struct pci_dev *dev); void pci_pme_wakeup_bus(struct pci_bus *bus); static inline __attribute__((no_instrument_function)) int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable) { return __pci_enable_wake(dev, state, false, enable); } void pci_enable_ido(struct pci_dev *dev, unsigned long type); void pci_disable_ido(struct pci_dev *dev, unsigned long type); enum pci_obff_signal_type { PCI_EXP_OBFF_SIGNAL_L0 = 0, PCI_EXP_OBFF_SIGNAL_ALWAYS = 1, }; int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); void pci_disable_obff(struct pci_dev *dev); bool pci_ltr_supported(struct pci_dev *dev); int pci_enable_ltr(struct pci_dev *dev); void pci_disable_ltr(struct pci_dev *dev); int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); void set_pcie_port_type(struct pci_dev *pdev); void set_pcie_hotplug_bridge(struct pci_dev *pdev); int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); unsigned int pci_rescan_bus(struct pci_bus *bus); ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); int pci_vpd_truncate(struct pci_dev *dev, size_t size); resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); void pci_bus_assign_resources(const struct pci_bus *bus); void pci_bus_size_bridges(struct pci_bus *bus); int pci_claim_resource(struct pci_dev *, int); void pci_assign_unassigned_resources(void); void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); void pdev_enable_device(struct pci_dev *); int pci_enable_resources(struct pci_dev *, int mask); void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), int (*)(const struct pci_dev *, u8, u8)); int __attribute__((warn_unused_result)) pci_request_regions(struct pci_dev *, const char *); int __attribute__((warn_unused_result)) pci_request_regions_exclusive(struct pci_dev *, const char *); void pci_release_regions(struct pci_dev *); int __attribute__((warn_unused_result)) pci_request_region(struct pci_dev *, int, const char *); int __attribute__((warn_unused_result)) pci_request_region_exclusive(struct pci_dev *, int, const char *); void pci_release_region(struct pci_dev *, int); int pci_request_selected_regions(struct pci_dev *, int, const char *); int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); void pci_release_selected_regions(struct pci_dev *, int); void pci_add_resource(struct list_head *resources, struct resource *res); void pci_add_resource_offset(struct list_head *resources, struct resource *res, resource_size_t offset); void pci_free_resource_list(struct list_head *resources); void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); void pci_bus_remove_resources(struct pci_bus *bus); int __attribute__((warn_unused_result)) pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, resource_size_t size, resource_size_t align, resource_size_t min, unsigned int type_mask, resource_size_t (*alignf)(void *, const struct resource *, resource_size_t, resource_size_t), void *alignf_data); void pci_enable_bridges(struct pci_bus *bus); int __attribute__((warn_unused_result)) __pci_register_driver(struct pci_driver *, struct module *, const char *mod_name); void pci_unregister_driver(struct pci_driver *dev); void pci_stop_and_remove_behind_bridge(struct pci_dev *dev); struct pci_driver *pci_dev_driver(const struct pci_dev *dev); int pci_add_dynid(struct pci_driver *drv, unsigned int vendor, unsigned int device, unsigned int subvendor, unsigned int subdevice, unsigned int class, unsigned int class_mask, unsigned long driver_data); const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass); void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata); int pci_cfg_space_size_ext(struct pci_dev *dev); int pci_cfg_space_size(struct pci_dev *dev); unsigned char pci_bus_max_busnr(struct pci_bus *bus); void pci_setup_bridge(struct pci_bus *bus); int pci_set_vga_state(struct pci_dev *pdev, bool decode, unsigned int command_bits, u32 flags); struct scatterlist { unsigned long sg_magic; unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; unsigned int dma_length; }; struct dma_pool *dma_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); void dma_pool_destroy(struct dma_pool *pool); void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle); void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); struct dma_pool *dmam_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); void dmam_pool_destroy(struct dma_pool *pool); enum pci_dma_burst_strategy { PCI_DMA_BURST_INFINITY, PCI_DMA_BURST_BOUNDARY, PCI_DMA_BURST_MULTIPLE, }; struct msix_entry { u32 vector; u16 entry; }; extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); extern void pci_msi_shutdown(struct pci_dev *dev); extern void pci_disable_msi(struct pci_dev *dev); extern int pci_msix_table_size(struct pci_dev *dev); extern int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); extern void pci_msix_shutdown(struct pci_dev *dev); extern void pci_disable_msix(struct pci_dev *dev); extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); extern void pci_restore_msi_state(struct pci_dev *dev); extern int pci_msi_enabled(void); extern bool pcie_ports_disabled; extern bool pcie_ports_auto; extern int pcie_aspm_enabled(void); extern bool pcie_aspm_support_enabled(void); void pci_no_aer(void); bool pci_aer_available(void); extern void pcie_set_ecrc_checking(struct pci_dev *dev); extern void pcie_ecrc_get_policy(char *str); int ht_create_irq(struct pci_dev *dev, int idx); void ht_destroy_irq(unsigned int irq); extern void pci_cfg_access_lock(struct pci_dev *dev); extern bool pci_cfg_access_trylock(struct pci_dev *dev); extern void pci_cfg_access_unlock(struct pci_dev *dev); extern int pci_domains_supported; typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, unsigned int command_bits, u32 flags); extern void pci_register_set_vga_state(arch_set_vga_state_t func); struct task_struct; extern int debug_locks; extern int debug_locks_silent; static inline __attribute__((no_instrument_function)) int __debug_locks_off(void) { return ({ __typeof__ (*((&debug_locks))) __ret = ((0)); switch (sizeof(*((&debug_locks)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&debug_locks))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&debug_locks))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&debug_locks))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&debug_locks))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; }); } extern int debug_locks_off(void); extern void locking_selftest(void); struct task_struct; static inline __attribute__((no_instrument_function)) void debug_show_all_locks(void) { } static inline __attribute__((no_instrument_function)) void debug_show_held_locks(struct task_struct *task) { } static inline __attribute__((no_instrument_function)) void debug_check_no_locks_freed(const void *from, unsigned long len) { } static inline __attribute__((no_instrument_function)) void debug_check_no_locks_held(struct task_struct *task) { } struct range { u64 start; u64 end; }; int add_range(struct range *range, int az, int nr_range, u64 start, u64 end); int add_range_with_merge(struct range *range, int az, int nr_range, u64 start, u64 end); void subtract_range(struct range *range, int az, u64 start, u64 end); int clean_sort_range(struct range *range, int az); void sort_range(struct range *range, int nr_range); static inline __attribute__((no_instrument_function)) resource_size_t cap_resource(u64 val) { if (val > ((resource_size_t)~0)) return ((resource_size_t)~0); return val; } struct mempolicy; struct anon_vma; struct file_ra_state; struct user_struct; struct writeback_control; extern unsigned long max_mapnr; extern unsigned long num_physpages; extern unsigned long totalram_pages; extern void * high_memory; extern int page_cluster; extern int sysctl_legacy_va_layout; extern unsigned long empty_zero_page[((1UL) << 12) / sizeof(unsigned long)]; extern spinlock_t pgd_lock; extern struct list_head pgd_list; extern struct mm_struct *pgd_page_get_mm(struct page *page); static inline __attribute__((no_instrument_function)) int pte_dirty(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 6); } static inline __attribute__((no_instrument_function)) int pte_young(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 5); } static inline __attribute__((no_instrument_function)) int pmd_young(pmd_t pmd) { return pmd_flags(pmd) & (((pteval_t)(1)) << 5); } static inline __attribute__((no_instrument_function)) int pte_write(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 1); } static inline __attribute__((no_instrument_function)) int pte_file(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 6); } static inline __attribute__((no_instrument_function)) int pte_huge(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 7); } static inline __attribute__((no_instrument_function)) int pte_global(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 8); } static inline __attribute__((no_instrument_function)) int pte_exec(pte_t pte) { return !(pte_flags(pte) & (((pteval_t)(1)) << 63)); } static inline __attribute__((no_instrument_function)) int pte_special(pte_t pte) { return pte_flags(pte) & (((pteval_t)(1)) << 9); } static inline __attribute__((no_instrument_function)) unsigned long pte_pfn(pte_t pte) { return (pte_val(pte) & ((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))) >> 12; } static inline __attribute__((no_instrument_function)) unsigned long pmd_pfn(pmd_t pmd) { return (pmd_val(pmd) & ((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1))))) >> 12; } static inline __attribute__((no_instrument_function)) int pmd_large(pmd_t pte) { return (pmd_flags(pte) & ((((pteval_t)(1)) << 7) | (((pteval_t)(1)) << 0))) == ((((pteval_t)(1)) << 7) | (((pteval_t)(1)) << 0)); } static inline __attribute__((no_instrument_function)) int pmd_trans_splitting(pmd_t pmd) { return pmd_val(pmd) & (((pteval_t)(1)) << 9); } static inline __attribute__((no_instrument_function)) int pmd_trans_huge(pmd_t pmd) { return pmd_val(pmd) & (((pteval_t)(1)) << 7); } static inline __attribute__((no_instrument_function)) int has_transparent_hugepage(void) { return (__builtin_constant_p((0*32+ 3)) && ( ((((0*32+ 3))>>5)==0 && (1UL<<(((0*32+ 3))&31) & ((1<<((0*32+ 0) & 31))|0|(1<<((0*32+ 5) & 31))|(1<<((0*32+ 6) & 31))| (1<<((0*32+ 8) & 31))|0|(1<<((0*32+24) & 31))|(1<<((0*32+15) & 31))| (1<<((0*32+25) & 31))|(1<<((0*32+26) & 31))))) || ((((0*32+ 3))>>5)==1 && (1UL<<(((0*32+ 3))&31) & ((1<<((1*32+29) & 31))|0))) || ((((0*32+ 3))>>5)==2 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==3 && (1UL<<(((0*32+ 3))&31) & ((1<<((3*32+20) & 31))))) || ((((0*32+ 3))>>5)==4 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==5 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==6 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==7 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==8 && (1UL<<(((0*32+ 3))&31) & 0)) || ((((0*32+ 3))>>5)==9 && (1UL<<(((0*32+ 3))&31) & 0)) ) ? 1 : (__builtin_constant_p(((0*32+ 3))) ? constant_test_bit(((0*32+ 3)), ((unsigned long *)((&boot_cpu_data)->x86_capability))) : variable_test_bit(((0*32+ 3)), ((unsigned long *)((&boot_cpu_data)->x86_capability))))); } static inline __attribute__((no_instrument_function)) pte_t pte_set_flags(pte_t pte, pteval_t set) { pteval_t v = native_pte_val(pte); return native_make_pte(v | set); } static inline __attribute__((no_instrument_function)) pte_t pte_clear_flags(pte_t pte, pteval_t clear) { pteval_t v = native_pte_val(pte); return native_make_pte(v & ~clear); } static inline __attribute__((no_instrument_function)) pte_t pte_mkclean(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 6)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkold(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 5)); } static inline __attribute__((no_instrument_function)) pte_t pte_wrprotect(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 1)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkexec(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 63)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkdirty(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 6)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkyoung(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 5)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkwrite(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 1)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkhuge(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 7)); } static inline __attribute__((no_instrument_function)) pte_t pte_clrhuge(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 7)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkglobal(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 8)); } static inline __attribute__((no_instrument_function)) pte_t pte_clrglobal(pte_t pte) { return pte_clear_flags(pte, (((pteval_t)(1)) << 8)); } static inline __attribute__((no_instrument_function)) pte_t pte_mkspecial(pte_t pte) { return pte_set_flags(pte, (((pteval_t)(1)) << 9)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_set_flags(pmd_t pmd, pmdval_t set) { pmdval_t v = native_pmd_val(pmd); return __pmd(v | set); } static inline __attribute__((no_instrument_function)) pmd_t pmd_clear_flags(pmd_t pmd, pmdval_t clear) { pmdval_t v = native_pmd_val(pmd); return __pmd(v & ~clear); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mkold(pmd_t pmd) { return pmd_clear_flags(pmd, (((pteval_t)(1)) << 5)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_wrprotect(pmd_t pmd) { return pmd_clear_flags(pmd, (((pteval_t)(1)) << 1)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mkdirty(pmd_t pmd) { return pmd_set_flags(pmd, (((pteval_t)(1)) << 6)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mkhuge(pmd_t pmd) { return pmd_set_flags(pmd, (((pteval_t)(1)) << 7)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mkyoung(pmd_t pmd) { return pmd_set_flags(pmd, (((pteval_t)(1)) << 5)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mkwrite(pmd_t pmd) { return pmd_set_flags(pmd, (((pteval_t)(1)) << 1)); } static inline __attribute__((no_instrument_function)) pmd_t pmd_mknotpresent(pmd_t pmd) { return pmd_clear_flags(pmd, (((pteval_t)(1)) << 0)); } static inline __attribute__((no_instrument_function)) pgprotval_t massage_pgprot(pgprot_t pgprot) { pgprotval_t protval = ((pgprot).pgprot); if (protval & (((pteval_t)(1)) << 0)) protval &= __supported_pte_mask; return protval; } static inline __attribute__((no_instrument_function)) pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) { return __pte(((phys_addr_t)page_nr << 12) | massage_pgprot(pgprot)); } static inline __attribute__((no_instrument_function)) pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) { return __pmd(((phys_addr_t)page_nr << 12) | massage_pgprot(pgprot)); } static inline __attribute__((no_instrument_function)) pte_t pte_modify(pte_t pte, pgprot_t newprot) { pteval_t val = pte_val(pte); val &= (((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))) | (((pteval_t)(1)) << 4) | (((pteval_t)(1)) << 3) | (((pteval_t)(1)) << 9) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)); val |= massage_pgprot(newprot) & ~(((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))) | (((pteval_t)(1)) << 4) | (((pteval_t)(1)) << 3) | (((pteval_t)(1)) << 9) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)); return __pte(val); } static inline __attribute__((no_instrument_function)) pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) { pmdval_t val = pmd_val(pmd); val &= ((((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))) | (((pteval_t)(1)) << 4) | (((pteval_t)(1)) << 3) | (((pteval_t)(1)) << 9) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)) | (((pteval_t)(1)) << 7)); val |= massage_pgprot(newprot) & ~((((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))) | (((pteval_t)(1)) << 4) | (((pteval_t)(1)) << 3) | (((pteval_t)(1)) << 9) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)) | (((pteval_t)(1)) << 7)); return __pmd(val); } static inline __attribute__((no_instrument_function)) pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) { pgprotval_t preservebits = ((oldprot).pgprot) & (((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))) | (((pteval_t)(1)) << 4) | (((pteval_t)(1)) << 3) | (((pteval_t)(1)) << 9) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)); pgprotval_t addbits = ((newprot).pgprot); return ((pgprot_t) { (preservebits | addbits) } ); } static inline __attribute__((no_instrument_function)) int is_new_memtype_allowed(u64 paddr, unsigned long size, unsigned long flags, unsigned long new_flags) { if (x86_platform.is_untracked_pat_range(paddr, paddr + size)) return 1; if ((flags == ((((pteval_t)(1)) << 4)) && new_flags == (0)) || (flags == ((((pteval_t)(1)) << 3)) && new_flags == (0))) { return 0; } return 1; } pmd_t *populate_extra_pmd(unsigned long vaddr); pte_t *populate_extra_pte(unsigned long vaddr); extern pud_t level3_kernel_pgt[512]; extern pud_t level3_ident_pgt[512]; extern pmd_t level2_kernel_pgt[512]; extern pmd_t level2_fixmap_pgt[512]; extern pmd_t level2_ident_pgt[512]; extern pgd_t init_level4_pgt[]; extern void paging_init(void); struct mm_struct; void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte); static inline __attribute__((no_instrument_function)) void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { *ptep = native_make_pte(0); } static inline __attribute__((no_instrument_function)) void native_set_pte(pte_t *ptep, pte_t pte) { *ptep = pte; } static inline __attribute__((no_instrument_function)) void native_set_pte_atomic(pte_t *ptep, pte_t pte) { native_set_pte(ptep, pte); } static inline __attribute__((no_instrument_function)) void native_set_pmd(pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; } static inline __attribute__((no_instrument_function)) void native_pmd_clear(pmd_t *pmd) { native_set_pmd(pmd, native_make_pmd(0)); } static inline __attribute__((no_instrument_function)) pte_t native_ptep_get_and_clear(pte_t *xp) { return native_make_pte(({ __typeof__ (*((&xp->pte))) __ret = ((0)); switch (sizeof(*((&xp->pte)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&xp->pte))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&xp->pte))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&xp->pte))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&xp->pte))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; })); } static inline __attribute__((no_instrument_function)) pmd_t native_pmdp_get_and_clear(pmd_t *xp) { return native_make_pmd(({ __typeof__ (*((&xp->pmd))) __ret = ((0)); switch (sizeof(*((&xp->pmd)))) { case 1: asm volatile ("" "xchg" "b %b0, %1\n" : "+q" (__ret), "+m" (*((&xp->pmd))) : : "memory", "cc"); break; case 2: asm volatile ("" "xchg" "w %w0, %1\n" : "+r" (__ret), "+m" (*((&xp->pmd))) : : "memory", "cc"); break; case 4: asm volatile ("" "xchg" "l %0, %1\n" : "+r" (__ret), "+m" (*((&xp->pmd))) : : "memory", "cc"); break; case 8: asm volatile ("" "xchg" "q %q0, %1\n" : "+r" (__ret), "+m" (*((&xp->pmd))) : : "memory", "cc"); break; default: __xchg_wrong_size(); } __ret; })); } static inline __attribute__((no_instrument_function)) void native_set_pud(pud_t *pudp, pud_t pud) { *pudp = pud; } static inline __attribute__((no_instrument_function)) void native_pud_clear(pud_t *pud) { native_set_pud(pud, native_make_pud(0)); } static inline __attribute__((no_instrument_function)) void native_set_pgd(pgd_t *pgdp, pgd_t pgd) { *pgdp = pgd; } static inline __attribute__((no_instrument_function)) void native_pgd_clear(pgd_t *pgd) { native_set_pgd(pgd, native_make_pgd(0)); } extern void sync_global_pgds(unsigned long start, unsigned long end); static inline __attribute__((no_instrument_function)) int pgd_large(pgd_t pgd) { return 0; } extern int kern_addr_valid(unsigned long addr); extern void cleanup_highmap(void); static inline __attribute__((no_instrument_function)) int pte_none(pte_t pte) { return !pte.pte; } static inline __attribute__((no_instrument_function)) int pte_same(pte_t a, pte_t b) { return a.pte == b.pte; } static inline __attribute__((no_instrument_function)) int pte_present(pte_t a) { return pte_flags(a) & ((((pteval_t)(1)) << 0) | (((pteval_t)(1)) << 8)); } static inline __attribute__((no_instrument_function)) int pte_hidden(pte_t pte) { return pte_flags(pte) & (((pteval_t)(0))); } static inline __attribute__((no_instrument_function)) int pmd_present(pmd_t pmd) { return pmd_flags(pmd) & (((pteval_t)(1)) << 0); } static inline __attribute__((no_instrument_function)) int pmd_none(pmd_t pmd) { return (unsigned long)native_pmd_val(pmd) == 0; } static inline __attribute__((no_instrument_function)) unsigned long pmd_page_vaddr(pmd_t pmd) { return (unsigned long)((void *)((unsigned long)(pmd_val(pmd) & ((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))))+((unsigned long)(0xffff880000000000UL)))); } static inline __attribute__((no_instrument_function)) unsigned long pmd_index(unsigned long address) { return (address >> 21) & (512 - 1); } static inline __attribute__((no_instrument_function)) unsigned long pte_index(unsigned long address) { return (address >> 12) & (512 - 1); } static inline __attribute__((no_instrument_function)) pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address) { return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(address); } static inline __attribute__((no_instrument_function)) int pmd_bad(pmd_t pmd) { return (pmd_flags(pmd) & ~(((pteval_t)(1)) << 2)) != ((((pteval_t)(1)) << 0) | (((pteval_t)(1)) << 1) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)); } static inline __attribute__((no_instrument_function)) unsigned long pages_to_mb(unsigned long npg) { return npg >> (20 - 12); } static inline __attribute__((no_instrument_function)) int pud_none(pud_t pud) { return native_pud_val(pud) == 0; } static inline __attribute__((no_instrument_function)) int pud_present(pud_t pud) { return pud_flags(pud) & (((pteval_t)(1)) << 0); } static inline __attribute__((no_instrument_function)) unsigned long pud_page_vaddr(pud_t pud) { return (unsigned long)((void *)((unsigned long)((unsigned long)pud_val(pud) & ((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))))+((unsigned long)(0xffff880000000000UL)))); } static inline __attribute__((no_instrument_function)) pmd_t *pmd_offset(pud_t *pud, unsigned long address) { return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address); } static inline __attribute__((no_instrument_function)) int pud_large(pud_t pud) { return (pud_val(pud) & ((((pteval_t)(1)) << 7) | (((pteval_t)(1)) << 0))) == ((((pteval_t)(1)) << 7) | (((pteval_t)(1)) << 0)); } static inline __attribute__((no_instrument_function)) int pud_bad(pud_t pud) { return (pud_flags(pud) & ~(((((pteval_t)(1)) << 0) | (((pteval_t)(1)) << 1) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)) | (((pteval_t)(1)) << 2))) != 0; } static inline __attribute__((no_instrument_function)) int pgd_present(pgd_t pgd) { return pgd_flags(pgd) & (((pteval_t)(1)) << 0); } static inline __attribute__((no_instrument_function)) unsigned long pgd_page_vaddr(pgd_t pgd) { return (unsigned long)((void *)((unsigned long)((unsigned long)pgd_val(pgd) & ((pteval_t)(((signed long)(~(((1UL) << 12)-1))) & ((phys_addr_t)((1ULL << 46) - 1)))))+((unsigned long)(0xffff880000000000UL)))); } static inline __attribute__((no_instrument_function)) unsigned long pud_index(unsigned long address) { return (address >> 30) & (512 - 1); } static inline __attribute__((no_instrument_function)) pud_t *pud_offset(pgd_t *pgd, unsigned long address) { return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address); } static inline __attribute__((no_instrument_function)) int pgd_bad(pgd_t pgd) { return (pgd_flags(pgd) & ~(((pteval_t)(1)) << 2)) != ((((pteval_t)(1)) << 0) | (((pteval_t)(1)) << 1) | (((pteval_t)(1)) << 5) | (((pteval_t)(1)) << 6)); } static inline __attribute__((no_instrument_function)) int pgd_none(pgd_t pgd) { return !native_pgd_val(pgd); } extern int direct_gbpages; static inline __attribute__((no_instrument_function)) pte_t native_local_ptep_get_and_clear(pte_t *ptep) { pte_t res = *ptep; native_pte_clear(((void *)0), 0, ptep); return res; } static inline __attribute__((no_instrument_function)) pmd_t native_local_pmdp_get_and_clear(pmd_t *pmdp) { pmd_t res = *pmdp; native_pmd_clear(pmdp); return res; } static inline __attribute__((no_instrument_function)) void native_set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep , pte_t pte) { native_set_pte(ptep, pte); } static inline __attribute__((no_instrument_function)) void native_set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp , pmd_t pmd) { native_set_pmd(pmdp, pmd); } struct vm_area_struct; extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry, int dirty); extern int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep); extern int ptep_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pte_t *ptep); static inline __attribute__((no_instrument_function)) pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t pte = native_ptep_get_and_clear(ptep); pte_update(mm, addr, ptep); return pte; } static inline __attribute__((no_instrument_function)) pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) { pte_t pte; if (full) { pte = native_local_ptep_get_and_clear(ptep); } else { pte = ptep_get_and_clear(mm, addr, ptep); } return pte; } static inline __attribute__((no_instrument_function)) void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { clear_bit(1, (unsigned long *)&ptep->pte); pte_update(mm, addr, ptep); } extern int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp, pmd_t entry, int dirty); extern int pmdp_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp); extern int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp); extern void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp); static inline __attribute__((no_instrument_function)) int pmd_write(pmd_t pmd) { return pmd_flags(pmd) & (((pteval_t)(1)) << 1); } static inline __attribute__((no_instrument_function)) pmd_t pmdp_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) { pmd_t pmd = native_pmdp_get_and_clear(pmdp); pmd_update(mm, addr, pmdp); return pmd; } static inline __attribute__((no_instrument_function)) void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) { clear_bit(1, (unsigned long *)pmdp); pmd_update(mm, addr, pmdp); } static inline __attribute__((no_instrument_function)) void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) { ({ size_t __len = (count * sizeof(pgd_t)); void *__ret; if (__builtin_constant_p(count * sizeof(pgd_t)) && __len >= 64) __ret = __memcpy((dst), (src), __len); else __ret = __builtin_memcpy((dst), (src), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void pte_clear_not_present_full(struct mm_struct *mm, unsigned long address, pte_t *ptep, int full) { pte_clear(mm, address, ptep); } extern pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address, pte_t *ptep); extern pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp); static inline __attribute__((no_instrument_function)) int pmd_same(pmd_t pmd_a, pmd_t pmd_b) { return pmd_val(pmd_a) == pmd_val(pmd_b); } void pgd_clear_bad(pgd_t *); void pud_clear_bad(pud_t *); void pmd_clear_bad(pmd_t *); static inline __attribute__((no_instrument_function)) int pgd_none_or_clear_bad(pgd_t *pgd) { if (pgd_none(*pgd)) return 1; if (ldv__builtin_expect(!!(pgd_bad(*pgd)), 0)) { pgd_clear_bad(pgd); return 1; } return 0; } static inline __attribute__((no_instrument_function)) int pud_none_or_clear_bad(pud_t *pud) { if (pud_none(*pud)) return 1; if (ldv__builtin_expect(!!(pud_bad(*pud)), 0)) { pud_clear_bad(pud); return 1; } return 0; } static inline __attribute__((no_instrument_function)) int pmd_none_or_clear_bad(pmd_t *pmd) { if (pmd_none(*pmd)) return 1; if (ldv__builtin_expect(!!(pmd_bad(*pmd)), 0)) { pmd_clear_bad(pmd); return 1; } return 0; } static inline __attribute__((no_instrument_function)) pte_t __ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { return ptep_get_and_clear(mm, addr, ptep); } static inline __attribute__((no_instrument_function)) void __ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { set_pte_at(mm, addr, ptep, pte); } extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, unsigned long pfn, unsigned long size); extern int track_pfn_vma_copy(struct vm_area_struct *vma); extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, unsigned long size); static inline __attribute__((no_instrument_function)) int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) { pmd_t pmdval = *pmd; __asm__ __volatile__("": : :"memory"); if (pmd_none(pmdval)) return 1; if (ldv__builtin_expect(!!(pmd_bad(pmdval)), 0)) { if (!pmd_trans_huge(pmdval)) pmd_clear_bad(pmd); return 1; } return 0; } static inline __attribute__((no_instrument_function)) int pmd_trans_unstable(pmd_t *pmd) { return pmd_none_or_trans_huge_or_clear_bad(pmd); } extern struct kmem_cache *vm_area_cachep; extern pgprot_t protection_map[16]; static inline __attribute__((no_instrument_function)) int is_linear_pfn_mapping(struct vm_area_struct *vma) { return !!(vma->vm_flags & 0x40000000); } static inline __attribute__((no_instrument_function)) int is_pfn_mapping(struct vm_area_struct *vma) { return !!(vma->vm_flags & 0x00000400); } struct vm_fault { unsigned int flags; unsigned long pgoff; void *virtual_address; struct page *page; }; struct vm_operations_struct { void (*open)(struct vm_area_struct * area); void (*close)(struct vm_area_struct * area); int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf); int (*access)(struct vm_area_struct *vma, unsigned long addr, void *buf, int len, int write); int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); struct mempolicy *(*get_policy)(struct vm_area_struct *vma, unsigned long addr); int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, const nodemask_t *to, unsigned long flags); }; struct mmu_gather; struct inode; enum pageflags { PG_locked, PG_error, PG_referenced, PG_uptodate, PG_dirty, PG_lru, PG_active, PG_slab, PG_owner_priv_1, PG_arch_1, PG_reserved, PG_private, PG_private_2, PG_writeback, PG_head, PG_tail, PG_swapcache, PG_mappedtodisk, PG_reclaim, PG_swapbacked, PG_unevictable, PG_mlocked, PG_uncached, PG_hwpoison, PG_compound_lock, __NR_PAGEFLAGS, PG_checked = PG_owner_priv_1, PG_fscache = PG_private_2, PG_pinned = PG_owner_priv_1, PG_savepinned = PG_dirty, PG_slob_free = PG_private, }; struct page; static inline __attribute__((no_instrument_function)) int PageLocked(const struct page *page) { return (__builtin_constant_p((PG_locked)) ? constant_test_bit((PG_locked), (&page->flags)) : variable_test_bit((PG_locked), (&page->flags))); } static inline __attribute__((no_instrument_function)) int PageError(const struct page *page) { return (__builtin_constant_p((PG_error)) ? constant_test_bit((PG_error), (&page->flags)) : variable_test_bit((PG_error), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageError(struct page *page) { set_bit(PG_error, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageError(struct page *page) { clear_bit(PG_error, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageError(struct page *page) { return test_and_clear_bit(PG_error, &page->flags); } static inline __attribute__((no_instrument_function)) int PageReferenced(const struct page *page) { return (__builtin_constant_p((PG_referenced)) ? constant_test_bit((PG_referenced), (&page->flags)) : variable_test_bit((PG_referenced), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageReferenced(struct page *page) { set_bit(PG_referenced, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageReferenced(struct page *page) { clear_bit(PG_referenced, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageReferenced(struct page *page) { return test_and_clear_bit(PG_referenced, &page->flags); } static inline __attribute__((no_instrument_function)) int PageDirty(const struct page *page) { return (__builtin_constant_p((PG_dirty)) ? constant_test_bit((PG_dirty), (&page->flags)) : variable_test_bit((PG_dirty), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageDirty(struct page *page) { set_bit(PG_dirty, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageDirty(struct page *page) { clear_bit(PG_dirty, &page->flags); } static inline __attribute__((no_instrument_function)) int TestSetPageDirty(struct page *page) { return test_and_set_bit(PG_dirty, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageDirty(struct page *page) { return test_and_clear_bit(PG_dirty, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageDirty(struct page *page) { __clear_bit(PG_dirty, &page->flags); } static inline __attribute__((no_instrument_function)) int PageLRU(const struct page *page) { return (__builtin_constant_p((PG_lru)) ? constant_test_bit((PG_lru), (&page->flags)) : variable_test_bit((PG_lru), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageLRU(struct page *page) { set_bit(PG_lru, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageLRU(struct page *page) { clear_bit(PG_lru, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageLRU(struct page *page) { __clear_bit(PG_lru, &page->flags); } static inline __attribute__((no_instrument_function)) int PageActive(const struct page *page) { return (__builtin_constant_p((PG_active)) ? constant_test_bit((PG_active), (&page->flags)) : variable_test_bit((PG_active), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageActive(struct page *page) { set_bit(PG_active, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageActive(struct page *page) { clear_bit(PG_active, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageActive(struct page *page) { __clear_bit(PG_active, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageActive(struct page *page) { return test_and_clear_bit(PG_active, &page->flags); } static inline __attribute__((no_instrument_function)) int PageSlab(const struct page *page) { return (__builtin_constant_p((PG_slab)) ? constant_test_bit((PG_slab), (&page->flags)) : variable_test_bit((PG_slab), (&page->flags))); } static inline __attribute__((no_instrument_function)) void __SetPageSlab(struct page *page) { __set_bit(PG_slab, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageSlab(struct page *page) { __clear_bit(PG_slab, &page->flags); } static inline __attribute__((no_instrument_function)) int PageChecked(const struct page *page) { return (__builtin_constant_p((PG_checked)) ? constant_test_bit((PG_checked), (&page->flags)) : variable_test_bit((PG_checked), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageChecked(struct page *page) { set_bit(PG_checked, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageChecked(struct page *page) { clear_bit(PG_checked, &page->flags); } static inline __attribute__((no_instrument_function)) int PagePinned(const struct page *page) { return (__builtin_constant_p((PG_pinned)) ? constant_test_bit((PG_pinned), (&page->flags)) : variable_test_bit((PG_pinned), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPagePinned(struct page *page) { set_bit(PG_pinned, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPagePinned(struct page *page) { clear_bit(PG_pinned, &page->flags); } static inline __attribute__((no_instrument_function)) int TestSetPagePinned(struct page *page) { return test_and_set_bit(PG_pinned, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPagePinned(struct page *page) { return test_and_clear_bit(PG_pinned, &page->flags); } static inline __attribute__((no_instrument_function)) int PageSavePinned(const struct page *page) { return (__builtin_constant_p((PG_savepinned)) ? constant_test_bit((PG_savepinned), (&page->flags)) : variable_test_bit((PG_savepinned), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageSavePinned(struct page *page) { set_bit(PG_savepinned, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageSavePinned(struct page *page) { clear_bit(PG_savepinned, &page->flags); }; static inline __attribute__((no_instrument_function)) int PageReserved(const struct page *page) { return (__builtin_constant_p((PG_reserved)) ? constant_test_bit((PG_reserved), (&page->flags)) : variable_test_bit((PG_reserved), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageReserved(struct page *page) { set_bit(PG_reserved, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageReserved(struct page *page) { clear_bit(PG_reserved, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageReserved(struct page *page) { __clear_bit(PG_reserved, &page->flags); } static inline __attribute__((no_instrument_function)) int PageSwapBacked(const struct page *page) { return (__builtin_constant_p((PG_swapbacked)) ? constant_test_bit((PG_swapbacked), (&page->flags)) : variable_test_bit((PG_swapbacked), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageSwapBacked(struct page *page) { set_bit(PG_swapbacked, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageSwapBacked(struct page *page) { clear_bit(PG_swapbacked, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageSwapBacked(struct page *page) { __clear_bit(PG_swapbacked, &page->flags); } static inline __attribute__((no_instrument_function)) int PageSlobFree(const struct page *page) { return (__builtin_constant_p((PG_slob_free)) ? constant_test_bit((PG_slob_free), (&page->flags)) : variable_test_bit((PG_slob_free), (&page->flags))); } static inline __attribute__((no_instrument_function)) void __SetPageSlobFree(struct page *page) { __set_bit(PG_slob_free, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageSlobFree(struct page *page) { __clear_bit(PG_slob_free, &page->flags); } static inline __attribute__((no_instrument_function)) int PagePrivate(const struct page *page) { return (__builtin_constant_p((PG_private)) ? constant_test_bit((PG_private), (&page->flags)) : variable_test_bit((PG_private), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPagePrivate(struct page *page) { set_bit(PG_private, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPagePrivate(struct page *page) { clear_bit(PG_private, &page->flags); } static inline __attribute__((no_instrument_function)) void __SetPagePrivate(struct page *page) { __set_bit(PG_private, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPagePrivate(struct page *page) { __clear_bit(PG_private, &page->flags); } static inline __attribute__((no_instrument_function)) int PagePrivate2(const struct page *page) { return (__builtin_constant_p((PG_private_2)) ? constant_test_bit((PG_private_2), (&page->flags)) : variable_test_bit((PG_private_2), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPagePrivate2(struct page *page) { set_bit(PG_private_2, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPagePrivate2(struct page *page) { clear_bit(PG_private_2, &page->flags); } static inline __attribute__((no_instrument_function)) int TestSetPagePrivate2(struct page *page) { return test_and_set_bit(PG_private_2, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPagePrivate2(struct page *page) { return test_and_clear_bit(PG_private_2, &page->flags); } static inline __attribute__((no_instrument_function)) int PageOwnerPriv1(const struct page *page) { return (__builtin_constant_p((PG_owner_priv_1)) ? constant_test_bit((PG_owner_priv_1), (&page->flags)) : variable_test_bit((PG_owner_priv_1), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageOwnerPriv1(struct page *page) { set_bit(PG_owner_priv_1, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageOwnerPriv1(struct page *page) { clear_bit(PG_owner_priv_1, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageOwnerPriv1(struct page *page) { return test_and_clear_bit(PG_owner_priv_1, &page->flags); } static inline __attribute__((no_instrument_function)) int PageWriteback(const struct page *page) { return (__builtin_constant_p((PG_writeback)) ? constant_test_bit((PG_writeback), (&page->flags)) : variable_test_bit((PG_writeback), (&page->flags))); } static inline __attribute__((no_instrument_function)) int TestSetPageWriteback(struct page *page) { return test_and_set_bit(PG_writeback, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageWriteback(struct page *page) { return test_and_clear_bit(PG_writeback, &page->flags); } static inline __attribute__((no_instrument_function)) int PageMappedToDisk(const struct page *page) { return (__builtin_constant_p((PG_mappedtodisk)) ? constant_test_bit((PG_mappedtodisk), (&page->flags)) : variable_test_bit((PG_mappedtodisk), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageMappedToDisk(struct page *page) { set_bit(PG_mappedtodisk, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageMappedToDisk(struct page *page) { clear_bit(PG_mappedtodisk, &page->flags); } static inline __attribute__((no_instrument_function)) int PageReclaim(const struct page *page) { return (__builtin_constant_p((PG_reclaim)) ? constant_test_bit((PG_reclaim), (&page->flags)) : variable_test_bit((PG_reclaim), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageReclaim(struct page *page) { set_bit(PG_reclaim, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageReclaim(struct page *page) { clear_bit(PG_reclaim, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageReclaim(struct page *page) { return test_and_clear_bit(PG_reclaim, &page->flags); } static inline __attribute__((no_instrument_function)) int PageReadahead(const struct page *page) { return (__builtin_constant_p((PG_reclaim)) ? constant_test_bit((PG_reclaim), (&page->flags)) : variable_test_bit((PG_reclaim), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageReadahead(struct page *page) { set_bit(PG_reclaim, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageReadahead(struct page *page) { clear_bit(PG_reclaim, &page->flags); } static inline __attribute__((no_instrument_function)) int PageHighMem(const struct page *page) { return 0; } static inline __attribute__((no_instrument_function)) int PageSwapCache(const struct page *page) { return (__builtin_constant_p((PG_swapcache)) ? constant_test_bit((PG_swapcache), (&page->flags)) : variable_test_bit((PG_swapcache), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageSwapCache(struct page *page) { set_bit(PG_swapcache, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageSwapCache(struct page *page) { clear_bit(PG_swapcache, &page->flags); } static inline __attribute__((no_instrument_function)) int PageUnevictable(const struct page *page) { return (__builtin_constant_p((PG_unevictable)) ? constant_test_bit((PG_unevictable), (&page->flags)) : variable_test_bit((PG_unevictable), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageUnevictable(struct page *page) { set_bit(PG_unevictable, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageUnevictable(struct page *page) { clear_bit(PG_unevictable, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageUnevictable(struct page *page) { __clear_bit(PG_unevictable, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageUnevictable(struct page *page) { return test_and_clear_bit(PG_unevictable, &page->flags); } static inline __attribute__((no_instrument_function)) int PageMlocked(const struct page *page) { return (__builtin_constant_p((PG_mlocked)) ? constant_test_bit((PG_mlocked), (&page->flags)) : variable_test_bit((PG_mlocked), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageMlocked(struct page *page) { set_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageMlocked(struct page *page) { clear_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageMlocked(struct page *page) { __clear_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) int TestSetPageMlocked(struct page *page) { return test_and_set_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageMlocked(struct page *page) { return test_and_clear_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) int __TestClearPageMlocked(struct page *page) { return __test_and_clear_bit(PG_mlocked, &page->flags); } static inline __attribute__((no_instrument_function)) int PageUncached(const struct page *page) { return (__builtin_constant_p((PG_uncached)) ? constant_test_bit((PG_uncached), (&page->flags)) : variable_test_bit((PG_uncached), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageUncached(struct page *page) { set_bit(PG_uncached, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageUncached(struct page *page) { clear_bit(PG_uncached, &page->flags); } static inline __attribute__((no_instrument_function)) int PageHWPoison(const struct page *page) { return (__builtin_constant_p((PG_hwpoison)) ? constant_test_bit((PG_hwpoison), (&page->flags)) : variable_test_bit((PG_hwpoison), (&page->flags))); } static inline __attribute__((no_instrument_function)) void SetPageHWPoison(struct page *page) { set_bit(PG_hwpoison, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageHWPoison(struct page *page) { clear_bit(PG_hwpoison, &page->flags); } static inline __attribute__((no_instrument_function)) int TestSetPageHWPoison(struct page *page) { return test_and_set_bit(PG_hwpoison, &page->flags); } static inline __attribute__((no_instrument_function)) int TestClearPageHWPoison(struct page *page) { return test_and_clear_bit(PG_hwpoison, &page->flags); } u64 stable_page_flags(struct page *page); static inline __attribute__((no_instrument_function)) int PageUptodate(struct page *page) { int ret = (__builtin_constant_p((PG_uptodate)) ? constant_test_bit((PG_uptodate), (&(page)->flags)) : variable_test_bit((PG_uptodate), (&(page)->flags))); if (ret) __asm__ __volatile__("": : :"memory"); return ret; } static inline __attribute__((no_instrument_function)) void __SetPageUptodate(struct page *page) { __asm__ __volatile__("": : :"memory"); __set_bit(PG_uptodate, &(page)->flags); } static inline __attribute__((no_instrument_function)) void SetPageUptodate(struct page *page) { __asm__ __volatile__("": : :"memory"); set_bit(PG_uptodate, &(page)->flags); } static inline __attribute__((no_instrument_function)) void ClearPageUptodate(struct page *page) { clear_bit(PG_uptodate, &page->flags); } extern void cancel_dirty_page(struct page *page, unsigned int account_size); int test_clear_page_writeback(struct page *page); int test_set_page_writeback(struct page *page); static inline __attribute__((no_instrument_function)) void set_page_writeback(struct page *page) { test_set_page_writeback(page); } static inline __attribute__((no_instrument_function)) int PageHead(const struct page *page) { return (__builtin_constant_p((PG_head)) ? constant_test_bit((PG_head), (&page->flags)) : variable_test_bit((PG_head), (&page->flags))); } static inline __attribute__((no_instrument_function)) void __SetPageHead(struct page *page) { __set_bit(PG_head, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageHead(struct page *page) { __clear_bit(PG_head, &page->flags); } static inline __attribute__((no_instrument_function)) void ClearPageHead(struct page *page) { clear_bit(PG_head, &page->flags); } static inline __attribute__((no_instrument_function)) int PageTail(const struct page *page) { return (__builtin_constant_p((PG_tail)) ? constant_test_bit((PG_tail), (&page->flags)) : variable_test_bit((PG_tail), (&page->flags))); } static inline __attribute__((no_instrument_function)) void __SetPageTail(struct page *page) { __set_bit(PG_tail, &page->flags); } static inline __attribute__((no_instrument_function)) void __ClearPageTail(struct page *page) { __clear_bit(PG_tail, &page->flags); } static inline __attribute__((no_instrument_function)) int PageCompound(struct page *page) { return page->flags & ((1L << PG_head) | (1L << PG_tail)); } static inline __attribute__((no_instrument_function)) void ClearPageCompound(struct page *page) { do { if (ldv__builtin_expect(!!(!PageHead(page)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/page-flags.h"), "i" (352), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); ClearPageHead(page); } static inline __attribute__((no_instrument_function)) int PageTransHuge(struct page *page) { do { if (ldv__builtin_expect(!!(PageTail(page)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/page-flags.h"), "i" (414), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return PageHead(page); } static inline __attribute__((no_instrument_function)) int PageTransCompound(struct page *page) { return PageCompound(page); } static inline __attribute__((no_instrument_function)) int PageTransTail(struct page *page) { return PageTail(page); } static inline __attribute__((no_instrument_function)) int page_has_private(struct page *page) { return !!(page->flags & (1 << PG_private | 1 << PG_private_2)); } extern int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, unsigned int flags); extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, struct vm_area_struct *vma); extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pmd_t orig_pmd); extern pgtable_t get_pmd_huge_pte(struct mm_struct *mm); extern struct page *follow_trans_huge_pmd(struct mm_struct *mm, unsigned long addr, pmd_t *pmd, unsigned int flags); extern int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr); extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, unsigned long end, unsigned char *vec); extern int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, unsigned long old_addr, unsigned long new_addr, unsigned long old_end, pmd_t *old_pmd, pmd_t *new_pmd); extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, pgprot_t newprot); enum transparent_hugepage_flag { TRANSPARENT_HUGEPAGE_FLAG, TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG, }; enum page_check_address_pmd_flag { PAGE_CHECK_ADDRESS_PMD_FLAG, PAGE_CHECK_ADDRESS_PMD_NOTSPLITTING_FLAG, PAGE_CHECK_ADDRESS_PMD_SPLITTING_FLAG, }; extern pmd_t *page_check_address_pmd(struct page *page, struct mm_struct *mm, unsigned long address, enum page_check_address_pmd_flag flag); extern unsigned long transparent_hugepage_flags; extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma, unsigned long addr, unsigned long end); extern int handle_pte_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *pte, pmd_t *pmd, unsigned int flags); extern int split_huge_page(struct page *page); extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd); extern int hugepage_madvise(struct vm_area_struct *vma, unsigned long *vm_flags, int advice); extern void __vma_adjust_trans_huge(struct vm_area_struct *vma, unsigned long start, unsigned long end, long adjust_next); extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma); static inline __attribute__((no_instrument_function)) int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) { do { if (ldv__builtin_expect(!!(!rwsem_is_locked(&vma->vm_mm->mmap_sem)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/huge_mm.h"), "i" (123), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (pmd_trans_huge(*pmd)) return __pmd_trans_huge_lock(pmd, vma); else return 0; } static inline __attribute__((no_instrument_function)) void vma_adjust_trans_huge(struct vm_area_struct *vma, unsigned long start, unsigned long end, long adjust_next) { if (!vma->anon_vma || vma->vm_ops) return; __vma_adjust_trans_huge(vma, start, end, adjust_next); } static inline __attribute__((no_instrument_function)) int hpage_nr_pages(struct page *page) { if (ldv__builtin_expect(!!(PageTransHuge(page)), 0)) return (1<<(21 -12)); return 1; } static inline __attribute__((no_instrument_function)) struct page *compound_trans_head(struct page *page) { if (PageTail(page)) { struct page *head; head = page->first_page; __asm__ __volatile__("": : :"memory"); if (PageTail(page)) return head; } return page; } static inline __attribute__((no_instrument_function)) int put_page_testzero(struct page *page) { do { if (ldv__builtin_expect(!!(atomic_read(&page->_count) == 0), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (277), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return atomic_dec_and_test(&page->_count); } static inline __attribute__((no_instrument_function)) int get_page_unless_zero(struct page *page) { return atomic_add_unless((&page->_count), 1, 0); } extern int page_is_ram(unsigned long pfn); struct page *vmalloc_to_page(const void *addr); unsigned long vmalloc_to_pfn(const void *addr); static inline __attribute__((no_instrument_function)) int is_vmalloc_addr(const void *x) { unsigned long addr = (unsigned long)x; return addr >= (0xffffc90000000000UL) && addr < (0xffffe8ffffffffffUL); } extern int is_vmalloc_or_module_addr(const void *x); static inline __attribute__((no_instrument_function)) void compound_lock(struct page *page) { bit_spin_lock(PG_compound_lock, &page->flags); } static inline __attribute__((no_instrument_function)) void compound_unlock(struct page *page) { bit_spin_unlock(PG_compound_lock, &page->flags); } static inline __attribute__((no_instrument_function)) unsigned long compound_lock_irqsave(struct page *page) { unsigned long flags = flags; do { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0); trace_hardirqs_off(); } while (0); compound_lock(page); return flags; } static inline __attribute__((no_instrument_function)) void compound_unlock_irqrestore(struct page *page, unsigned long flags) { compound_unlock(page); do { if (({ ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(flags); })) { do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); trace_hardirqs_off(); } else { trace_hardirqs_on(); do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0); } } while (0); } static inline __attribute__((no_instrument_function)) struct page *compound_head(struct page *page) { if (ldv__builtin_expect(!!(PageTail(page)), 0)) return page->first_page; return page; } static inline __attribute__((no_instrument_function)) void reset_page_mapcount(struct page *page) { atomic_set(&(page)->_mapcount, -1); } static inline __attribute__((no_instrument_function)) int page_mapcount(struct page *page) { return atomic_read(&(page)->_mapcount) + 1; } static inline __attribute__((no_instrument_function)) int page_count(struct page *page) { return atomic_read(&compound_head(page)->_count); } static inline __attribute__((no_instrument_function)) void get_huge_page_tail(struct page *page) { do { if (ldv__builtin_expect(!!(page_mapcount(page) < 0), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (387), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(atomic_read(&page->_count) != 0), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (388), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); atomic_inc(&page->_mapcount); } extern bool __get_page_tail(struct page *page); static inline __attribute__((no_instrument_function)) void get_page(struct page *page) { if (ldv__builtin_expect(!!(PageTail(page)), 0)) if (ldv__builtin_expect(!!(__get_page_tail(page)), 1)) return; do { if (ldv__builtin_expect(!!(atomic_read(&page->_count) <= 0), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (403), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); atomic_inc(&page->_count); } static inline __attribute__((no_instrument_function)) struct page *virt_to_head_page(const void *x) { struct page *page = (((struct page *)(0xffffea0000000000UL)) + (__phys_addr((unsigned long)(x)) >> 12)); return compound_head(page); } static inline __attribute__((no_instrument_function)) void init_page_count(struct page *page) { atomic_set(&page->_count, 1); } static inline __attribute__((no_instrument_function)) int PageBuddy(struct page *page) { return atomic_read(&page->_mapcount) == (-128); } static inline __attribute__((no_instrument_function)) void __SetPageBuddy(struct page *page) { do { if (ldv__builtin_expect(!!(atomic_read(&page->_mapcount) != -1), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (440), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); atomic_set(&page->_mapcount, (-128)); } static inline __attribute__((no_instrument_function)) void __ClearPageBuddy(struct page *page) { do { if (ldv__builtin_expect(!!(!PageBuddy(page)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (446), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); atomic_set(&page->_mapcount, -1); } void put_page(struct page *page); void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); int split_free_page(struct page *page); typedef void compound_page_dtor(struct page *); static inline __attribute__((no_instrument_function)) void set_compound_page_dtor(struct page *page, compound_page_dtor *dtor) { page[1].lru.next = (void *)dtor; } static inline __attribute__((no_instrument_function)) compound_page_dtor *get_compound_page_dtor(struct page *page) { return (compound_page_dtor *)page[1].lru.next; } static inline __attribute__((no_instrument_function)) int compound_order(struct page *page) { if (!PageHead(page)) return 0; return (unsigned long)page[1].lru.prev; } static inline __attribute__((no_instrument_function)) int compound_trans_order(struct page *page) { int order; unsigned long flags; if (!PageHead(page)) return 0; flags = compound_lock_irqsave(page); order = compound_order(page); compound_unlock_irqrestore(page, flags); return order; } static inline __attribute__((no_instrument_function)) void set_compound_order(struct page *page, unsigned long order) { page[1].lru.prev = (void *)order; } static inline __attribute__((no_instrument_function)) pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma) { if (ldv__builtin_expect(!!(vma->vm_flags & 0x00000002), 1)) pte = pte_mkwrite(pte); return pte; } static inline __attribute__((no_instrument_function)) enum zone_type page_zonenum(const struct page *page) { return (page->flags >> (((((sizeof(unsigned long)*8) - 0) - 10) - 2) * (2 != 0))) & ((1UL << 2) - 1); } static inline __attribute__((no_instrument_function)) int page_zone_id(struct page *page) { return (page->flags >> ((((((sizeof(unsigned long)*8) - 0) - 10) < ((((sizeof(unsigned long)*8) - 0) - 10) - 2))? (((sizeof(unsigned long)*8) - 0) - 10) : ((((sizeof(unsigned long)*8) - 0) - 10) - 2)) * ((10 + 2) != 0))) & ((1UL << (10 + 2)) - 1); } static inline __attribute__((no_instrument_function)) int zone_to_nid(struct zone *zone) { return zone->node; } static inline __attribute__((no_instrument_function)) int page_to_nid(const struct page *page) { return (page->flags >> ((((sizeof(unsigned long)*8) - 0) - 10) * (10 != 0))) & ((1UL << 10) - 1); } static inline __attribute__((no_instrument_function)) struct zone *page_zone(const struct page *page) { return &(node_data[page_to_nid(page)])->node_zones[page_zonenum(page)]; } static inline __attribute__((no_instrument_function)) void set_page_zone(struct page *page, enum zone_type zone) { page->flags &= ~(((1UL << 2) - 1) << (((((sizeof(unsigned long)*8) - 0) - 10) - 2) * (2 != 0))); page->flags |= (zone & ((1UL << 2) - 1)) << (((((sizeof(unsigned long)*8) - 0) - 10) - 2) * (2 != 0)); } static inline __attribute__((no_instrument_function)) void set_page_node(struct page *page, unsigned long node) { page->flags &= ~(((1UL << 10) - 1) << ((((sizeof(unsigned long)*8) - 0) - 10) * (10 != 0))); page->flags |= (node & ((1UL << 10) - 1)) << ((((sizeof(unsigned long)*8) - 0) - 10) * (10 != 0)); } static inline __attribute__((no_instrument_function)) void set_page_links(struct page *page, enum zone_type zone, unsigned long node, unsigned long pfn) { set_page_zone(page, zone); set_page_node(page, node); } enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, PGALLOC_DMA, PGALLOC_DMA32, PGALLOC_NORMAL , PGALLOC_MOVABLE, PGFREE, PGACTIVATE, PGDEACTIVATE, PGFAULT, PGMAJFAULT, PGREFILL_DMA, PGREFILL_DMA32, PGREFILL_NORMAL , PGREFILL_MOVABLE, PGSTEAL_KSWAPD_DMA, PGSTEAL_KSWAPD_DMA32, PGSTEAL_KSWAPD_NORMAL , PGSTEAL_KSWAPD_MOVABLE, PGSTEAL_DIRECT_DMA, PGSTEAL_DIRECT_DMA32, PGSTEAL_DIRECT_NORMAL , PGSTEAL_DIRECT_MOVABLE, PGSCAN_KSWAPD_DMA, PGSCAN_KSWAPD_DMA32, PGSCAN_KSWAPD_NORMAL , PGSCAN_KSWAPD_MOVABLE, PGSCAN_DIRECT_DMA, PGSCAN_DIRECT_DMA32, PGSCAN_DIRECT_NORMAL , PGSCAN_DIRECT_MOVABLE, PGSCAN_ZONE_RECLAIM_FAILED, PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, KSWAPD_SKIP_CONGESTION_WAIT, PAGEOUTRUN, ALLOCSTALL, PGROTATED, COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED, COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS, HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, UNEVICTABLE_PGCULLED, UNEVICTABLE_PGSCANNED, UNEVICTABLE_PGRESCUED, UNEVICTABLE_PGMLOCKED, UNEVICTABLE_PGMUNLOCKED, UNEVICTABLE_PGCLEARED, UNEVICTABLE_PGSTRANDED, UNEVICTABLE_MLOCKFREED, THP_FAULT_ALLOC, THP_FAULT_FALLBACK, THP_COLLAPSE_ALLOC, THP_COLLAPSE_ALLOC_FAILED, THP_SPLIT, NR_VM_EVENT_ITEMS }; extern int sysctl_stat_interval; struct vm_event_state { unsigned long event[NR_VM_EVENT_ITEMS]; }; extern __attribute__((section(".discard"), unused)) char __pcpu_scope_vm_event_states; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct vm_event_state) vm_event_states; static inline __attribute__((no_instrument_function)) void __count_vm_event(enum vm_event_item item) { do { do { const void *__vpp_verify = (typeof(&(((vm_event_states.event[item])))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof(((vm_event_states.event[item])))) { case 1: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } static inline __attribute__((no_instrument_function)) void count_vm_event(enum vm_event_item item) { do { do { const void *__vpp_verify = (typeof(&(((vm_event_states.event[item])))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof(((vm_event_states.event[item])))) { case 1: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof((((vm_event_states.event[item])))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((vm_event_states.event[item]))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item]))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((vm_event_states.event[item])))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } static inline __attribute__((no_instrument_function)) void __count_vm_events(enum vm_event_item item, long delta) { do { do { const void *__vpp_verify = (typeof(&((vm_event_states.event[item]))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof((vm_event_states.event[item]))) { case 1: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } static inline __attribute__((no_instrument_function)) void count_vm_events(enum vm_event_item item, long delta) { do { do { const void *__vpp_verify = (typeof(&((vm_event_states.event[item]))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof((vm_event_states.event[item]))) { case 1: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof(((vm_event_states.event[item]))) pao_T__; const int pao_ID__ = (__builtin_constant_p((delta)) && (((delta)) == 1 || ((delta)) == -1)) ? ((delta)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((delta)); (void)pao_tmp__; } switch (sizeof(((vm_event_states.event[item])))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "qi" ((pao_T__)((delta)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "ri" ((pao_T__)((delta)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item])))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((vm_event_states.event[item]))) : "re" ((pao_T__)((delta)))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } extern void all_vm_events(unsigned long *); extern void vm_events_fold_cpu(int cpu); extern atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; static inline __attribute__((no_instrument_function)) void zone_page_state_add(long x, struct zone *zone, enum zone_stat_item item) { atomic_long_add(x, &zone->vm_stat[item]); atomic_long_add(x, &vm_stat[item]); } static inline __attribute__((no_instrument_function)) unsigned long global_page_state(enum zone_stat_item item) { long x = atomic_long_read(&vm_stat[item]); if (x < 0) x = 0; return x; } static inline __attribute__((no_instrument_function)) unsigned long zone_page_state(struct zone *zone, enum zone_stat_item item) { long x = atomic_long_read(&zone->vm_stat[item]); if (x < 0) x = 0; return x; } static inline __attribute__((no_instrument_function)) unsigned long zone_page_state_snapshot(struct zone *zone, enum zone_stat_item item) { long x = atomic_long_read(&zone->vm_stat[item]); int cpu; for (((cpu)) = -1; ((cpu)) = cpumask_next(((cpu)), (cpu_online_mask)), ((cpu)) < nr_cpu_ids;) x += ({ do { const void *__vpp_verify = (typeof(((zone->pageset))))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"((typeof(*((zone->pageset))) *)((zone->pageset)))); (typeof((typeof(*((zone->pageset))) *)((zone->pageset)))) (__ptr + (((__per_cpu_offset[(cpu)])))); }); })->vm_stat_diff[item]; if (x < 0) x = 0; return x; } extern unsigned long global_reclaimable_pages(void); extern unsigned long zone_reclaimable_pages(struct zone *zone); static inline __attribute__((no_instrument_function)) unsigned long node_page_state(int node, enum zone_stat_item item) { struct zone *zones = (node_data[node])->node_zones; return zone_page_state(&zones[ZONE_DMA], item) + zone_page_state(&zones[ZONE_DMA32], item) + zone_page_state(&zones[ZONE_NORMAL], item) + zone_page_state(&zones[ZONE_MOVABLE], item); } extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp); static inline __attribute__((no_instrument_function)) void zap_zone_vm_stats(struct zone *zone) { memset(zone->vm_stat, 0, sizeof(zone->vm_stat)); } extern void inc_zone_state(struct zone *, enum zone_stat_item); void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int); void __inc_zone_page_state(struct page *, enum zone_stat_item); void __dec_zone_page_state(struct page *, enum zone_stat_item); void mod_zone_page_state(struct zone *, enum zone_stat_item, int); void inc_zone_page_state(struct page *, enum zone_stat_item); void dec_zone_page_state(struct page *, enum zone_stat_item); extern void inc_zone_state(struct zone *, enum zone_stat_item); extern void __inc_zone_state(struct zone *, enum zone_stat_item); extern void dec_zone_state(struct zone *, enum zone_stat_item); extern void __dec_zone_state(struct zone *, enum zone_stat_item); void refresh_cpu_vm_stats(int); void refresh_zone_stat_thresholds(void); int calculate_pressure_threshold(struct zone *zone); int calculate_normal_threshold(struct zone *zone); void set_pgdat_percpu_threshold(pg_data_t *pgdat, int (*calculate_pressure)(struct zone *)); extern const char * const vmstat_text[]; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void *lowmem_page_address(const struct page *page) { return ((void *)((unsigned long)(((phys_addr_t)((unsigned long)((page) - ((struct page *)(0xffffea0000000000UL)))) << 12))+((unsigned long)(0xffff880000000000UL)))); } extern struct address_space swapper_space; static inline __attribute__((no_instrument_function)) struct address_space *page_mapping(struct page *page) { struct address_space *mapping = page->mapping; do { if (ldv__builtin_expect(!!(PageSlab(page)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/mm.h"), "i" (792), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ldv__builtin_expect(!!(PageSwapCache(page)), 0)) mapping = &swapper_space; else if ((unsigned long)mapping & 1) mapping = ((void *)0); return mapping; } static inline __attribute__((no_instrument_function)) void *page_rmapping(struct page *page) { return (void *)((unsigned long)page->mapping & ~(1 | 2)); } static inline __attribute__((no_instrument_function)) int PageAnon(struct page *page) { return ((unsigned long)page->mapping & 1) != 0; } static inline __attribute__((no_instrument_function)) unsigned long page_index(struct page *page) { if (ldv__builtin_expect(!!(PageSwapCache(page)), 0)) return ((page)->private); return page->index; } static inline __attribute__((no_instrument_function)) int page_mapped(struct page *page) { return atomic_read(&(page)->_mapcount) >= 0; } extern void pagefault_out_of_memory(void); extern void show_free_areas(unsigned int flags); extern bool skip_free_areas_node(unsigned int flags, int nid); int shmem_lock(struct file *file, int lock, struct user_struct *user); struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); int shmem_zero_setup(struct vm_area_struct *); extern int can_do_mlock(void); extern int user_shm_lock(size_t, struct user_struct *); extern void user_shm_unlock(size_t, struct user_struct *); struct zap_details { struct vm_area_struct *nonlinear_vma; struct address_space *check_mapping; unsigned long first_index; unsigned long last_index; }; struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_t pte); int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, unsigned long size); void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size, struct zap_details *); void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, unsigned long start_addr, unsigned long end_addr, unsigned long *nr_accounted, struct zap_details *); struct mm_walk { int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *); int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *); int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); int (*hugetlb_entry)(pte_t *, unsigned long, unsigned long, unsigned long, struct mm_walk *); struct mm_struct *mm; void *private; }; int walk_page_range(unsigned long addr, unsigned long end, struct mm_walk *walk); void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma); void unmap_mapping_range(struct address_space *mapping, loff_t const holebegin, loff_t const holelen, int even_cows); int follow_pfn(struct vm_area_struct *vma, unsigned long address, unsigned long *pfn); int follow_phys(struct vm_area_struct *vma, unsigned long address, unsigned int flags, unsigned long *prot, resource_size_t *phys); int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, void *buf, int len, int write); static inline __attribute__((no_instrument_function)) void unmap_shared_mapping_range(struct address_space *mapping, loff_t const holebegin, loff_t const holelen) { unmap_mapping_range(mapping, holebegin, holelen, 0); } extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); extern void truncate_setsize(struct inode *inode, loff_t newsize); extern int vmtruncate(struct inode *inode, loff_t offset); extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); int truncate_inode_page(struct address_space *mapping, struct page *page); int generic_error_remove_page(struct address_space *mapping, struct page *page); int invalidate_inode_page(struct page *page); extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags); extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, unsigned long address, unsigned int fault_flags); extern int make_pages_present(unsigned long addr, unsigned long end); extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, int len, int write); int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, int len, unsigned int foll_flags, struct page **pages, struct vm_area_struct **vmas, int *nonblocking); int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, int nr_pages, int write, int force, struct page **pages, struct vm_area_struct **vmas); int get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages); struct page *get_dump_page(unsigned long addr); extern int try_to_release_page(struct page * page, gfp_t gfp_mask); extern void do_invalidatepage(struct page *page, unsigned long offset); int __set_page_dirty_nobuffers(struct page *page); int __set_page_dirty_no_writeback(struct page *page); int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page); void account_page_dirtied(struct page *page, struct address_space *mapping); void account_page_writeback(struct page *page); int set_page_dirty(struct page *page); int set_page_dirty_lock(struct page *page); int clear_page_dirty_for_io(struct page *page); static inline __attribute__((no_instrument_function)) int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) { return vma && (vma->vm_end == addr) && (vma->vm_flags & 0x00000100); } static inline __attribute__((no_instrument_function)) int stack_guard_page_start(struct vm_area_struct *vma, unsigned long addr) { return (vma->vm_flags & 0x00000100) && (vma->vm_start == addr) && !vma_growsdown(vma->vm_prev, addr); } static inline __attribute__((no_instrument_function)) int vma_growsup(struct vm_area_struct *vma, unsigned long addr) { return vma && (vma->vm_start == addr) && (vma->vm_flags & 0x00000000); } static inline __attribute__((no_instrument_function)) int stack_guard_page_end(struct vm_area_struct *vma, unsigned long addr) { return (vma->vm_flags & 0x00000000) && (vma->vm_end == addr) && !vma_growsup(vma->vm_next, addr); } extern pid_t vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); extern unsigned long move_page_tables(struct vm_area_struct *vma, unsigned long old_addr, struct vm_area_struct *new_vma, unsigned long new_addr, unsigned long len); extern unsigned long do_mremap(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr); extern int mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, unsigned long start, unsigned long end, unsigned long newflags); int __get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages); static inline __attribute__((no_instrument_function)) unsigned long get_mm_counter(struct mm_struct *mm, int member) { long val = atomic_long_read(&mm->rss_stat.count[member]); return (unsigned long)val; } static inline __attribute__((no_instrument_function)) void add_mm_counter(struct mm_struct *mm, int member, long value) { atomic_long_add(value, &mm->rss_stat.count[member]); } static inline __attribute__((no_instrument_function)) void inc_mm_counter(struct mm_struct *mm, int member) { atomic_long_inc(&mm->rss_stat.count[member]); } static inline __attribute__((no_instrument_function)) void dec_mm_counter(struct mm_struct *mm, int member) { atomic_long_dec(&mm->rss_stat.count[member]); } static inline __attribute__((no_instrument_function)) unsigned long get_mm_rss(struct mm_struct *mm) { return get_mm_counter(mm, MM_FILEPAGES) + get_mm_counter(mm, MM_ANONPAGES); } static inline __attribute__((no_instrument_function)) unsigned long get_mm_hiwater_rss(struct mm_struct *mm) { return ({ typeof(mm->hiwater_rss) _max1 = (mm->hiwater_rss); typeof(get_mm_rss(mm)) _max2 = (get_mm_rss(mm)); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }); } static inline __attribute__((no_instrument_function)) unsigned long get_mm_hiwater_vm(struct mm_struct *mm) { return ({ typeof(mm->hiwater_vm) _max1 = (mm->hiwater_vm); typeof(mm->total_vm) _max2 = (mm->total_vm); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }); } static inline __attribute__((no_instrument_function)) void update_hiwater_rss(struct mm_struct *mm) { unsigned long _rss = get_mm_rss(mm); if ((mm)->hiwater_rss < _rss) (mm)->hiwater_rss = _rss; } static inline __attribute__((no_instrument_function)) void update_hiwater_vm(struct mm_struct *mm) { if (mm->hiwater_vm < mm->total_vm) mm->hiwater_vm = mm->total_vm; } static inline __attribute__((no_instrument_function)) void setmax_mm_hiwater_rss(unsigned long *maxrss, struct mm_struct *mm) { unsigned long hiwater_rss = get_mm_hiwater_rss(mm); if (*maxrss < hiwater_rss) *maxrss = hiwater_rss; } static inline __attribute__((no_instrument_function)) void sync_mm_rss(struct mm_struct *mm) { } int vma_wants_writenotify(struct vm_area_struct *vma); extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl); static inline __attribute__((no_instrument_function)) pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl) { pte_t *ptep; (ptep = __get_locked_pte(mm, addr, ptl)); return ptep; } int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, pmd_t *pmd, unsigned long address); int __pte_alloc_kernel(pmd_t *pmd, unsigned long address); static inline __attribute__((no_instrument_function)) pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) { return (ldv__builtin_expect(!!(pgd_none(*pgd)), 0) && __pud_alloc(mm, pgd, address))? ((void *)0): pud_offset(pgd, address); } static inline __attribute__((no_instrument_function)) pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) { return (ldv__builtin_expect(!!(pud_none(*pud)), 0) && __pmd_alloc(mm, pud, address))? ((void *)0): pmd_offset(pud, address); } static inline __attribute__((no_instrument_function)) void pgtable_page_ctor(struct page *page) { do {} while (0); inc_zone_page_state(page, NR_PAGETABLE); } static inline __attribute__((no_instrument_function)) void pgtable_page_dtor(struct page *page) { do {} while (0); dec_zone_page_state(page, NR_PAGETABLE); } extern void free_area_init(unsigned long * zones_size); extern void free_area_init_node(int nid, unsigned long * zones_size, unsigned long zone_start_pfn, unsigned long *zholes_size); extern void free_initmem(void); extern void free_area_init_nodes(unsigned long *max_zone_pfn); unsigned long node_map_pfn_alignment(void); unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, unsigned long end_pfn); extern unsigned long absent_pages_in_range(unsigned long start_pfn, unsigned long end_pfn); extern void get_pfn_range_for_nid(unsigned int nid, unsigned long *start_pfn, unsigned long *end_pfn); extern unsigned long find_min_pfn_with_active_regions(void); extern void free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn); extern void sparse_memory_present_with_active_regions(int nid); extern int __attribute__ ((__section__(".meminit.text"))) __attribute__((no_instrument_function)) early_pfn_to_nid(unsigned long pfn); extern void set_dma_reserve(unsigned long new_dma_reserve); extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long, enum memmap_context); extern void setup_per_zone_wmarks(void); extern int __attribute__ ((__section__(".meminit.text"))) __attribute__((no_instrument_function)) init_per_zone_wmark_min(void); extern void mem_init(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) mmap_init(void); extern void show_mem(unsigned int flags); extern void si_meminfo(struct sysinfo * val); extern void si_meminfo_node(struct sysinfo *val, int nid); extern int after_bootmem; extern __attribute__((format(printf, 3, 4))) void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...); extern void setup_per_cpu_pageset(void); extern void zone_pcp_update(struct zone *zone); extern atomic_long_t mmap_pages_allocated; extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); void vma_prio_tree_remove(struct vm_area_struct *, struct prio_tree_root *); struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma, struct prio_tree_iter *iter); static inline __attribute__((no_instrument_function)) void vma_nonlinear_insert(struct vm_area_struct *vma, struct list_head *list) { vma->shared.vm_set.parent = ((void *)0); list_add_tail(&vma->shared.vm_set.list, list); } extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); extern int vma_adjust(struct vm_area_struct *vma, unsigned long start, unsigned long end, unsigned long pgoff, struct vm_area_struct *insert); extern struct vm_area_struct *vma_merge(struct mm_struct *, struct vm_area_struct *prev, unsigned long addr, unsigned long end, unsigned long vm_flags, struct anon_vma *, struct file *, unsigned long, struct mempolicy *); extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *); extern int split_vma(struct mm_struct *, struct vm_area_struct *, unsigned long addr, int new_below); extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *, struct rb_node **, struct rb_node *); extern void unlink_file_vma(struct vm_area_struct *); extern struct vm_area_struct *copy_vma(struct vm_area_struct **, unsigned long addr, unsigned long len, unsigned long pgoff); extern void exit_mmap(struct mm_struct *); extern int mm_take_all_locks(struct mm_struct *mm); extern void mm_drop_all_locks(struct mm_struct *mm); extern void added_exe_file_vma(struct mm_struct *mm); extern void removed_exe_file_vma(struct mm_struct *mm); extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); extern struct file *get_mm_exe_file(struct mm_struct *mm); extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); extern int install_special_mapping(struct mm_struct *mm, unsigned long addr, unsigned long len, unsigned long flags, struct page **pages); extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); extern unsigned long mmap_region(struct file *file, unsigned long addr, unsigned long len, unsigned long flags, vm_flags_t vm_flags, unsigned long pgoff); extern unsigned long do_mmap(struct file *, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern int do_munmap(struct mm_struct *, unsigned long, size_t); extern unsigned long vm_brk(unsigned long, unsigned long); extern int vm_munmap(unsigned long, size_t); extern unsigned long vm_mmap(struct file *, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern void truncate_inode_pages(struct address_space *, loff_t); extern void truncate_inode_pages_range(struct address_space *, loff_t lstart, loff_t lend); extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); int write_one_page(struct page *page, int wait); void task_dirty_inc(struct task_struct *tsk); int force_page_cache_readahead(struct address_space *mapping, struct file *filp, unsigned long offset, unsigned long nr_to_read); void page_cache_sync_readahead(struct address_space *mapping, struct file_ra_state *ra, struct file *filp, unsigned long offset, unsigned long size); void page_cache_async_readahead(struct address_space *mapping, struct file_ra_state *ra, struct file *filp, struct page *pg, unsigned long offset, unsigned long size); unsigned long max_sane_readahead(unsigned long nr); unsigned long ra_submit(struct file_ra_state *ra, struct address_space *mapping, struct file *filp); extern int expand_stack(struct vm_area_struct *vma, unsigned long address); extern int expand_downwards(struct vm_area_struct *vma, unsigned long address); extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr); extern struct vm_area_struct * find_vma_prev(struct mm_struct * mm, unsigned long addr, struct vm_area_struct **pprev); static inline __attribute__((no_instrument_function)) struct vm_area_struct * find_vma_intersection(struct mm_struct * mm, unsigned long start_addr, unsigned long end_addr) { struct vm_area_struct * vma = find_vma(mm,start_addr); if (vma && end_addr <= vma->vm_start) vma = ((void *)0); return vma; } static inline __attribute__((no_instrument_function)) unsigned long vma_pages(struct vm_area_struct *vma) { return (vma->vm_end - vma->vm_start) >> 12; } static inline __attribute__((no_instrument_function)) struct vm_area_struct *find_exact_vma(struct mm_struct *mm, unsigned long vm_start, unsigned long vm_end) { struct vm_area_struct *vma = find_vma(mm, vm_start); if (vma && (vma->vm_start != vm_start || vma->vm_end != vm_end)) vma = ((void *)0); return vma; } pgprot_t vm_get_page_prot(unsigned long vm_flags); struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); int remap_pfn_range(struct vm_area_struct *, unsigned long addr, unsigned long pfn, unsigned long size, pgprot_t); int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); struct page *follow_page(struct vm_area_struct *, unsigned long address, unsigned int foll_flags); typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, void *data); extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, unsigned long size, pte_fn_t fn, void *data); void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long); extern void kernel_map_pages(struct page *page, int numpages, int enable); extern bool kernel_page_present(struct page *page); extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); int in_gate_area_no_mm(unsigned long addr); int in_gate_area(struct mm_struct *mm, unsigned long addr); int drop_caches_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *); unsigned long shrink_slab(struct shrink_control *shrink, unsigned long nr_pages_scanned, unsigned long lru_pages); extern int randomize_va_space; const char * arch_vma_name(struct vm_area_struct *vma); void print_vma_addr(char *prefix, unsigned long rip); void sparse_mem_maps_populate_node(struct page **map_map, unsigned long pnum_begin, unsigned long pnum_end, unsigned long map_count, int nodeid); struct page *sparse_mem_map_populate(unsigned long pnum, int nid); pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); void *vmemmap_alloc_block(unsigned long size, int node); void *vmemmap_alloc_block_buf(unsigned long size, int node); void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); int vmemmap_populate_basepages(struct page *start_page, unsigned long pages, int node); int vmemmap_populate(struct page *start_page, unsigned long pages, int node); void vmemmap_populate_print_last(void); enum mf_flags { MF_COUNT_INCREASED = 1 << 0, MF_ACTION_REQUIRED = 1 << 1, }; extern int memory_failure(unsigned long pfn, int trapno, int flags); extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); extern int unpoison_memory(unsigned long pfn); extern int sysctl_memory_failure_early_kill; extern int sysctl_memory_failure_recovery; extern void shake_page(struct page *p, int access); extern atomic_long_t mce_bad_pages; extern int soft_offline_page(struct page *page, int flags); extern void dump_page(struct page *page); extern void clear_huge_page(struct page *page, unsigned long addr, unsigned int pages_per_huge_page); extern void copy_user_huge_page(struct page *dst, struct page *src, unsigned long addr, struct vm_area_struct *vma, unsigned int pages_per_huge_page); extern unsigned int _debug_guardpage_minorder; static inline __attribute__((no_instrument_function)) unsigned int debug_guardpage_minorder(void) { return _debug_guardpage_minorder; } static inline __attribute__((no_instrument_function)) bool page_is_guard(struct page *page) { return (__builtin_constant_p((PAGE_DEBUG_FLAG_GUARD)) ? constant_test_bit((PAGE_DEBUG_FLAG_GUARD), (&page->debug_flags)) : variable_test_bit((PAGE_DEBUG_FLAG_GUARD), (&page->debug_flags))); } void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) kmem_cache_init(void); int slab_is_available(void); struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, unsigned long, void (*)(void *)); void kmem_cache_destroy(struct kmem_cache *); int kmem_cache_shrink(struct kmem_cache *); void kmem_cache_free(struct kmem_cache *, void *); unsigned int kmem_cache_size(struct kmem_cache *); void * __attribute__((warn_unused_result)) __krealloc(const void *, size_t, gfp_t); void * __attribute__((warn_unused_result)) krealloc(const void *, size_t, gfp_t); void kfree(const void *); void kzfree(const void *); size_t ksize(const void *); extern void kmemleak_init(void) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, gfp_t gfp) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_alloc_percpu(const void *ptr, size_t size) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_free(const void *ptr) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_free_part(const void *ptr, size_t size) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_free_percpu(const void *ptr) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_padding(const void *ptr, unsigned long offset, size_t size) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_not_leak(const void *ptr) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_ignore(const void *ptr) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); extern void kmemleak_no_scan(const void *ptr) __attribute__ ((__section__(".ref.text"))) __attribute__((noinline)); static inline __attribute__((no_instrument_function)) void kmemleak_alloc_recursive(const void *ptr, size_t size, int min_count, unsigned long flags, gfp_t gfp) { if (!(flags & 0x00800000UL)) kmemleak_alloc(ptr, size, min_count, gfp); } static inline __attribute__((no_instrument_function)) void kmemleak_free_recursive(const void *ptr, unsigned long flags) { if (!(flags & 0x00800000UL)) kmemleak_free(ptr); } static inline __attribute__((no_instrument_function)) void kmemleak_erase(void **ptr) { *ptr = ((void *)0); } enum stat_item { ALLOC_FASTPATH, ALLOC_SLOWPATH, FREE_FASTPATH, FREE_SLOWPATH, FREE_FROZEN, FREE_ADD_PARTIAL, FREE_REMOVE_PARTIAL, ALLOC_FROM_PARTIAL, ALLOC_SLAB, ALLOC_REFILL, ALLOC_NODE_MISMATCH, FREE_SLAB, CPUSLAB_FLUSH, DEACTIVATE_FULL, DEACTIVATE_EMPTY, DEACTIVATE_TO_HEAD, DEACTIVATE_TO_TAIL, DEACTIVATE_REMOTE_FREES, DEACTIVATE_BYPASS, ORDER_FALLBACK, CMPXCHG_DOUBLE_CPU_FAIL, CMPXCHG_DOUBLE_FAIL, CPU_PARTIAL_ALLOC, CPU_PARTIAL_FREE, CPU_PARTIAL_NODE, CPU_PARTIAL_DRAIN, NR_SLUB_STAT_ITEMS }; struct kmem_cache_cpu { void **freelist; unsigned long tid; struct page *page; struct page *partial; int node; unsigned stat[NR_SLUB_STAT_ITEMS]; }; struct kmem_cache_node { spinlock_t list_lock; unsigned long nr_partial; struct list_head partial; atomic_long_t nr_slabs; atomic_long_t total_objects; struct list_head full; }; struct kmem_cache_order_objects { unsigned long x; }; struct kmem_cache { struct kmem_cache_cpu *cpu_slab; unsigned long flags; unsigned long min_partial; int size; int objsize; int offset; int cpu_partial; struct kmem_cache_order_objects oo; struct kmem_cache_order_objects max; struct kmem_cache_order_objects min; gfp_t allocflags; int refcount; void (*ctor)(void *); int inuse; int align; int reserved; const char *name; struct list_head list; struct kobject kobj; int remote_node_defrag_ratio; struct kmem_cache_node *node[(1 << 10)]; }; extern struct kmem_cache *kmalloc_caches[(12 + 2)]; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) int kmalloc_index(size_t size) { if (!size) return 0; if (size <= 8) return ( __builtin_constant_p(8) ? ( (8) < 1 ? ____ilog2_NaN() : (8) & (1ULL << 63) ? 63 : (8) & (1ULL << 62) ? 62 : (8) & (1ULL << 61) ? 61 : (8) & (1ULL << 60) ? 60 : (8) & (1ULL << 59) ? 59 : (8) & (1ULL << 58) ? 58 : (8) & (1ULL << 57) ? 57 : (8) & (1ULL << 56) ? 56 : (8) & (1ULL << 55) ? 55 : (8) & (1ULL << 54) ? 54 : (8) & (1ULL << 53) ? 53 : (8) & (1ULL << 52) ? 52 : (8) & (1ULL << 51) ? 51 : (8) & (1ULL << 50) ? 50 : (8) & (1ULL << 49) ? 49 : (8) & (1ULL << 48) ? 48 : (8) & (1ULL << 47) ? 47 : (8) & (1ULL << 46) ? 46 : (8) & (1ULL << 45) ? 45 : (8) & (1ULL << 44) ? 44 : (8) & (1ULL << 43) ? 43 : (8) & (1ULL << 42) ? 42 : (8) & (1ULL << 41) ? 41 : (8) & (1ULL << 40) ? 40 : (8) & (1ULL << 39) ? 39 : (8) & (1ULL << 38) ? 38 : (8) & (1ULL << 37) ? 37 : (8) & (1ULL << 36) ? 36 : (8) & (1ULL << 35) ? 35 : (8) & (1ULL << 34) ? 34 : (8) & (1ULL << 33) ? 33 : (8) & (1ULL << 32) ? 32 : (8) & (1ULL << 31) ? 31 : (8) & (1ULL << 30) ? 30 : (8) & (1ULL << 29) ? 29 : (8) & (1ULL << 28) ? 28 : (8) & (1ULL << 27) ? 27 : (8) & (1ULL << 26) ? 26 : (8) & (1ULL << 25) ? 25 : (8) & (1ULL << 24) ? 24 : (8) & (1ULL << 23) ? 23 : (8) & (1ULL << 22) ? 22 : (8) & (1ULL << 21) ? 21 : (8) & (1ULL << 20) ? 20 : (8) & (1ULL << 19) ? 19 : (8) & (1ULL << 18) ? 18 : (8) & (1ULL << 17) ? 17 : (8) & (1ULL << 16) ? 16 : (8) & (1ULL << 15) ? 15 : (8) & (1ULL << 14) ? 14 : (8) & (1ULL << 13) ? 13 : (8) & (1ULL << 12) ? 12 : (8) & (1ULL << 11) ? 11 : (8) & (1ULL << 10) ? 10 : (8) & (1ULL << 9) ? 9 : (8) & (1ULL << 8) ? 8 : (8) & (1ULL << 7) ? 7 : (8) & (1ULL << 6) ? 6 : (8) & (1ULL << 5) ? 5 : (8) & (1ULL << 4) ? 4 : (8) & (1ULL << 3) ? 3 : (8) & (1ULL << 2) ? 2 : (8) & (1ULL << 1) ? 1 : (8) & (1ULL << 0) ? 0 : ____ilog2_NaN() ) : (sizeof(8) <= 4) ? __ilog2_u32(8) : __ilog2_u64(8) ); if (8 <= 32 && size > 64 && size <= 96) return 1; if (8 <= 64 && size > 128 && size <= 192) return 2; if (size <= 8) return 3; if (size <= 16) return 4; if (size <= 32) return 5; if (size <= 64) return 6; if (size <= 128) return 7; if (size <= 256) return 8; if (size <= 512) return 9; if (size <= 1024) return 10; if (size <= 2 * 1024) return 11; if (size <= 4 * 1024) return 12; if (size <= 8 * 1024) return 13; if (size <= 16 * 1024) return 14; if (size <= 32 * 1024) return 15; if (size <= 64 * 1024) return 16; if (size <= 128 * 1024) return 17; if (size <= 256 * 1024) return 18; if (size <= 512 * 1024) return 19; if (size <= 1024 * 1024) return 20; if (size <= 2 * 1024 * 1024) return 21; do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/slub_def.h"), "i" (192), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); return -1; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) struct kmem_cache *kmalloc_slab(size_t size) { int index = kmalloc_index(size); if (index == 0) return ((void *)0); return kmalloc_caches[index]; } void *kmem_cache_alloc(struct kmem_cache *, gfp_t); void *__kmalloc(size_t size, gfp_t flags); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void * kmalloc_order(size_t size, gfp_t flags, unsigned int order) { void *ret = (void *) __get_free_pages(flags | (( gfp_t)0x4000u), order); kmemleak_alloc(ret, size, 1, flags); return ret; } extern bool verify_mem_not_deleted(const void *x); extern void * kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size); extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void *kmalloc_large(size_t size, gfp_t flags) { unsigned int order = ( __builtin_constant_p(size) ? ( ((size) == 0UL) ? 64 - 12 : (((size) < (1UL << 12)) ? 0 : ( __builtin_constant_p((size) - 1) ? ( ((size) - 1) < 1 ? ____ilog2_NaN() : ((size) - 1) & (1ULL << 63) ? 63 : ((size) - 1) & (1ULL << 62) ? 62 : ((size) - 1) & (1ULL << 61) ? 61 : ((size) - 1) & (1ULL << 60) ? 60 : ((size) - 1) & (1ULL << 59) ? 59 : ((size) - 1) & (1ULL << 58) ? 58 : ((size) - 1) & (1ULL << 57) ? 57 : ((size) - 1) & (1ULL << 56) ? 56 : ((size) - 1) & (1ULL << 55) ? 55 : ((size) - 1) & (1ULL << 54) ? 54 : ((size) - 1) & (1ULL << 53) ? 53 : ((size) - 1) & (1ULL << 52) ? 52 : ((size) - 1) & (1ULL << 51) ? 51 : ((size) - 1) & (1ULL << 50) ? 50 : ((size) - 1) & (1ULL << 49) ? 49 : ((size) - 1) & (1ULL << 48) ? 48 : ((size) - 1) & (1ULL << 47) ? 47 : ((size) - 1) & (1ULL << 46) ? 46 : ((size) - 1) & (1ULL << 45) ? 45 : ((size) - 1) & (1ULL << 44) ? 44 : ((size) - 1) & (1ULL << 43) ? 43 : ((size) - 1) & (1ULL << 42) ? 42 : ((size) - 1) & (1ULL << 41) ? 41 : ((size) - 1) & (1ULL << 40) ? 40 : ((size) - 1) & (1ULL << 39) ? 39 : ((size) - 1) & (1ULL << 38) ? 38 : ((size) - 1) & (1ULL << 37) ? 37 : ((size) - 1) & (1ULL << 36) ? 36 : ((size) - 1) & (1ULL << 35) ? 35 : ((size) - 1) & (1ULL << 34) ? 34 : ((size) - 1) & (1ULL << 33) ? 33 : ((size) - 1) & (1ULL << 32) ? 32 : ((size) - 1) & (1ULL << 31) ? 31 : ((size) - 1) & (1ULL << 30) ? 30 : ((size) - 1) & (1ULL << 29) ? 29 : ((size) - 1) & (1ULL << 28) ? 28 : ((size) - 1) & (1ULL << 27) ? 27 : ((size) - 1) & (1ULL << 26) ? 26 : ((size) - 1) & (1ULL << 25) ? 25 : ((size) - 1) & (1ULL << 24) ? 24 : ((size) - 1) & (1ULL << 23) ? 23 : ((size) - 1) & (1ULL << 22) ? 22 : ((size) - 1) & (1ULL << 21) ? 21 : ((size) - 1) & (1ULL << 20) ? 20 : ((size) - 1) & (1ULL << 19) ? 19 : ((size) - 1) & (1ULL << 18) ? 18 : ((size) - 1) & (1ULL << 17) ? 17 : ((size) - 1) & (1ULL << 16) ? 16 : ((size) - 1) & (1ULL << 15) ? 15 : ((size) - 1) & (1ULL << 14) ? 14 : ((size) - 1) & (1ULL << 13) ? 13 : ((size) - 1) & (1ULL << 12) ? 12 : ((size) - 1) & (1ULL << 11) ? 11 : ((size) - 1) & (1ULL << 10) ? 10 : ((size) - 1) & (1ULL << 9) ? 9 : ((size) - 1) & (1ULL << 8) ? 8 : ((size) - 1) & (1ULL << 7) ? 7 : ((size) - 1) & (1ULL << 6) ? 6 : ((size) - 1) & (1ULL << 5) ? 5 : ((size) - 1) & (1ULL << 4) ? 4 : ((size) - 1) & (1ULL << 3) ? 3 : ((size) - 1) & (1ULL << 2) ? 2 : ((size) - 1) & (1ULL << 1) ? 1 : ((size) - 1) & (1ULL << 0) ? 0 : ____ilog2_NaN() ) : (sizeof((size) - 1) <= 4) ? __ilog2_u32((size) - 1) : __ilog2_u64((size) - 1) ) - 12 + 1) ) : __get_order(size) ); return kmalloc_order_trace(size, flags, order); } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void *kmalloc(size_t size, gfp_t flags) { if (__builtin_constant_p(size)) { if (size > (2 * ((1UL) << 12))) return kmalloc_large(size, flags); if (!(flags & (( gfp_t)0x01u))) { struct kmem_cache *s = kmalloc_slab(size); if (!s) return ((void *)16); return kmem_cache_alloc_trace(s, flags, size); } } return __kmalloc(size, flags); } void *__kmalloc_node(size_t size, gfp_t flags, int node); void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s, gfp_t gfpflags, int node, size_t size); static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void *kmalloc_node(size_t size, gfp_t flags, int node) { if (__builtin_constant_p(size) && size <= (2 * ((1UL) << 12)) && !(flags & (( gfp_t)0x01u))) { struct kmem_cache *s = kmalloc_slab(size); if (!s) return ((void *)16); return kmem_cache_alloc_node_trace(s, flags, node, size); } return __kmalloc_node(size, flags, node); } static inline __attribute__((no_instrument_function)) void *kmalloc_array(size_t n, size_t size, gfp_t flags) { if (size != 0 && n > (~0UL) / size) return ((void *)0); return __kmalloc(n * size, flags); } static inline __attribute__((no_instrument_function)) void *kcalloc(size_t n, size_t size, gfp_t flags) { return kmalloc_array(n, size, flags | (( gfp_t)0x8000u)); } extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); static inline __attribute__((no_instrument_function)) void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags) { return kmem_cache_alloc(k, flags | (( gfp_t)0x8000u)); } static inline __attribute__((no_instrument_function)) void *kzalloc(size_t size, gfp_t flags) { return kmalloc(size, flags | (( gfp_t)0x8000u)); } static inline __attribute__((no_instrument_function)) void *kzalloc_node(size_t size, gfp_t flags, int node) { return kmalloc_node(size, flags | (( gfp_t)0x8000u), node); } void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) kmem_cache_init_late(void); struct pci_sysdata { int domain; int node; void *iommu; }; extern int pci_routeirq; extern int noioapicquirk; extern int noioapicreroute; extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node); extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); static inline __attribute__((no_instrument_function)) int pci_domain_nr(struct pci_bus *bus) { struct pci_sysdata *sd = bus->sysdata; return sd->domain; } static inline __attribute__((no_instrument_function)) int pci_proc_domain(struct pci_bus *bus) { return pci_domain_nr(bus); } extern unsigned int pcibios_assign_all_busses(void); extern int pci_legacy_init(void); extern unsigned long pci_mem_start; extern int pcibios_enabled; void pcibios_config_init(void); struct pci_bus *pcibios_scan_root(int bus); void pcibios_set_master(struct pci_dev *dev); void pcibios_penalize_isa_irq(int irq, int active); struct irq_routing_table *pcibios_get_irq_routing_table(void); int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine); extern void early_quirks(void); static inline __attribute__((no_instrument_function)) void pci_dma_burst_advice(struct pci_dev *pdev, enum pci_dma_burst_strategy *strat, unsigned long *strategy_parameter) { *strat = PCI_DMA_BURST_INFINITY; *strategy_parameter = ~0UL; } extern void pci_iommu_alloc(void); static inline __attribute__((no_instrument_function)) int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { return x86_msi.setup_msi_irqs(dev, nvec, type); } static inline __attribute__((no_instrument_function)) void x86_teardown_msi_irqs(struct pci_dev *dev) { x86_msi.teardown_msi_irqs(dev); } static inline __attribute__((no_instrument_function)) void x86_teardown_msi_irq(unsigned int irq) { x86_msi.teardown_msi_irq(irq); } static inline __attribute__((no_instrument_function)) void x86_restore_msi_irqs(struct pci_dev *dev, int irq) { x86_msi.restore_msi_irqs(dev, irq); } int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); void native_teardown_msi_irq(unsigned int irq); void native_restore_msi_irqs(struct pci_dev *dev, int irq); void default_teardown_msi_irqs(struct pci_dev *dev); void default_restore_msi_irqs(struct pci_dev *dev, int irq); static inline __attribute__((no_instrument_function)) void *pci_iommu(struct pci_bus *bus) { struct pci_sysdata *sd = bus->sysdata; return sd->iommu; } static inline __attribute__((no_instrument_function)) void set_pci_iommu(struct pci_bus *bus, void *val) { struct pci_sysdata *sd = bus->sysdata; sd->iommu = val; } extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); enum dma_attr { DMA_ATTR_WRITE_BARRIER, DMA_ATTR_WEAK_ORDERING, DMA_ATTR_WRITE_COMBINE, DMA_ATTR_NON_CONSISTENT, DMA_ATTR_MAX, }; struct dma_attrs { unsigned long flags[(((DMA_ATTR_MAX) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; }; static inline __attribute__((no_instrument_function)) void init_dma_attrs(struct dma_attrs *attrs) { bitmap_zero(attrs->flags, (((DMA_ATTR_MAX) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))); } static inline __attribute__((no_instrument_function)) void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs) { if (attrs == ((void *)0)) return; do { if (ldv__builtin_expect(!!(attr >= DMA_ATTR_MAX), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dma-attrs.h"), "i" (51), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); __set_bit(attr, attrs->flags); } static inline __attribute__((no_instrument_function)) int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs) { if (attrs == ((void *)0)) return 0; do { if (ldv__builtin_expect(!!(attr >= DMA_ATTR_MAX), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dma-attrs.h"), "i" (64), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return (__builtin_constant_p((attr)) ? constant_test_bit((attr), (attrs->flags)) : variable_test_bit((attr), (attrs->flags))); } enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3, }; struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; }; static inline __attribute__((no_instrument_function)) void sg_assign_page(struct scatterlist *sg, struct page *page) { unsigned long page_link = sg->page_link & 0x3; do { if (ldv__builtin_expect(!!((unsigned long) page & 0x03), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (65), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(sg->sg_magic != 0x87654321), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (67), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(((sg)->page_link & 0x01)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (68), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); sg->page_link = page_link | (unsigned long) page; } static inline __attribute__((no_instrument_function)) void sg_set_page(struct scatterlist *sg, struct page *page, unsigned int len, unsigned int offset) { sg_assign_page(sg, page); sg->offset = offset; sg->length = len; } static inline __attribute__((no_instrument_function)) struct page *sg_page(struct scatterlist *sg) { do { if (ldv__builtin_expect(!!(sg->sg_magic != 0x87654321), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (98), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); do { if (ldv__builtin_expect(!!(((sg)->page_link & 0x01)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (99), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return (struct page *)((sg)->page_link & ~0x3); } static inline __attribute__((no_instrument_function)) void sg_set_buf(struct scatterlist *sg, const void *buf, unsigned int buflen) { sg_set_page(sg, (((struct page *)(0xffffea0000000000UL)) + (__phys_addr((unsigned long)(buf)) >> 12)), buflen, ((unsigned long)(buf) & ~(~(((1UL) << 12)-1)))); } static inline __attribute__((no_instrument_function)) void sg_chain(struct scatterlist *prv, unsigned int prv_nents, struct scatterlist *sgl) { prv[prv_nents - 1].offset = 0; prv[prv_nents - 1].length = 0; prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02; } static inline __attribute__((no_instrument_function)) void sg_mark_end(struct scatterlist *sg) { do { if (ldv__builtin_expect(!!(sg->sg_magic != 0x87654321), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/scatterlist.h"), "i" (165), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); sg->page_link |= 0x02; sg->page_link &= ~0x01; } static inline __attribute__((no_instrument_function)) dma_addr_t sg_phys(struct scatterlist *sg) { return ((dma_addr_t)(unsigned long)((sg_page(sg)) - ((struct page *)(0xffffea0000000000UL))) << 12) + sg->offset; } static inline __attribute__((no_instrument_function)) void *sg_virt(struct scatterlist *sg) { return lowmem_page_address(sg_page(sg)) + sg->offset; } struct scatterlist *sg_next(struct scatterlist *); struct scatterlist *sg_last(struct scatterlist *s, unsigned int); void sg_init_table(struct scatterlist *, unsigned int); void sg_init_one(struct scatterlist *, const void *, unsigned int); typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); typedef void (sg_free_fn)(struct scatterlist *, unsigned int); void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *); void sg_free_table(struct sg_table *); int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, sg_alloc_fn *); int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen); size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen); struct sg_mapping_iter { struct page *page; void *addr; size_t length; size_t consumed; struct scatterlist *__sg; unsigned int __nents; unsigned int __offset; unsigned int __flags; }; void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, unsigned int nents, unsigned int flags); bool sg_miter_next(struct sg_mapping_iter *miter); void sg_miter_stop(struct sg_mapping_iter *miter); struct dma_map_ops { void* (*alloc)(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs); void (*free)(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t, size_t, struct dma_attrs *attrs); dma_addr_t (*map_page)(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs); void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs); void (*sync_single_for_cpu)(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir); void (*sync_single_for_device)(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir); void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir); void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir); int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); int (*dma_supported)(struct device *dev, u64 mask); int (*set_dma_mask)(struct device *dev, u64 mask); int is_phys; }; static inline __attribute__((no_instrument_function)) int valid_dma_direction(int dma_direction) { return ((dma_direction == DMA_BIDIRECTIONAL) || (dma_direction == DMA_TO_DEVICE) || (dma_direction == DMA_FROM_DEVICE)); } static inline __attribute__((no_instrument_function)) int is_device_dma_capable(struct device *dev) { return dev->dma_mask != ((void *)0) && *dev->dma_mask != 0x0ULL; } static inline __attribute__((no_instrument_function)) void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node) { } static inline __attribute__((no_instrument_function)) void kmemcheck_free_shadow(struct page *page, int order) { } static inline __attribute__((no_instrument_function)) void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, size_t size) { } static inline __attribute__((no_instrument_function)) void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size) { } static inline __attribute__((no_instrument_function)) void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order, gfp_t gfpflags) { } static inline __attribute__((no_instrument_function)) bool kmemcheck_page_is_tracked(struct page *p) { return false; } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_unallocated(void *address, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_uninitialized(void *address, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_initialized(void *address, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_freed(void *address, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n) { } static inline __attribute__((no_instrument_function)) void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n) { } static inline __attribute__((no_instrument_function)) bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) { return true; } struct device; struct scatterlist; struct bus_type; extern void dma_debug_add_bus(struct bus_type *bus); extern void dma_debug_init(u32 num_entries); extern int dma_debug_resize_entries(u32 num_entries); extern void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, int direction, dma_addr_t dma_addr, bool map_single); extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, size_t size, int direction, bool map_single); extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int mapped_ents, int direction); extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, int nelems, int dir); extern void debug_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t dma_addr, void *virt); extern void debug_dma_free_coherent(struct device *dev, size_t size, void *virt, dma_addr_t addr); extern void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, int direction); extern void debug_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, int direction); extern void debug_dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, int direction); extern void debug_dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, int direction); extern void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, int direction); extern void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, int direction); extern void debug_dma_dump_mappings(struct device *dev); struct device; struct dma_attrs; struct scatterlist; extern int swiotlb_force; extern void swiotlb_init(int verbose); extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); extern unsigned long swiotlb_nr_tbl(void); enum dma_sync_target { SYNC_FOR_CPU = 0, SYNC_FOR_DEVICE = 1, }; extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, phys_addr_t phys, size_t size, enum dma_data_direction dir); extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size, enum dma_data_direction dir); extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size, enum dma_data_direction dir, enum dma_sync_target target); extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size, enum dma_data_direction dir); extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, gfp_t flags); extern void swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, enum dma_data_direction dir); extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, enum dma_data_direction dir); extern int swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, struct dma_attrs *attrs); extern void swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, struct dma_attrs *attrs); extern void swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir); extern void swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, int nelems, enum dma_data_direction dir); extern void swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir); extern void swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, int nelems, enum dma_data_direction dir); extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) swiotlb_free(void); extern void swiotlb_print_info(void); extern int swiotlb; extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_swiotlb_detect_override(void); extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_swiotlb_detect_4gb(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_swiotlb_init(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_swiotlb_late_init(void); static inline __attribute__((no_instrument_function)) void dma_mark_clean(void *addr, size_t size) {} extern int iommu_merge; extern struct device x86_dma_fallback_dev; extern int panic_on_overflow; extern struct dma_map_ops *dma_ops; static inline __attribute__((no_instrument_function)) struct dma_map_ops *get_dma_ops(struct device *dev) { if (ldv__builtin_expect(!!(!dev), 0) || !dev->archdata.dma_ops) return dma_ops; else return dev->archdata.dma_ops; } static inline __attribute__((no_instrument_function)) dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); dma_addr_t addr; kmemcheck_mark_initialized(ptr, size); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (19), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); addr = ops->map_page(dev, (((struct page *)(0xffffea0000000000UL)) + (__phys_addr((unsigned long)(ptr)) >> 12)), (unsigned long)ptr & ~(~(((1UL) << 12)-1)), size, dir, attrs); debug_dma_map_page(dev, (((struct page *)(0xffffea0000000000UL)) + (__phys_addr((unsigned long)(ptr)) >> 12)), (unsigned long)ptr & ~(~(((1UL) << 12)-1)), size, dir, addr, true); return addr; } static inline __attribute__((no_instrument_function)) void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (36), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->unmap_page) ops->unmap_page(dev, addr, size, dir, attrs); debug_dma_unmap_page(dev, addr, size, dir, true); } static inline __attribute__((no_instrument_function)) int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); int i, ents; struct scatterlist *s; for (i = 0, s = (sg); i < (nents); i++, s = sg_next(s)) kmemcheck_mark_initialized(sg_virt(s), s->length); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (52), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); ents = ops->map_sg(dev, sg, nents, dir, attrs); debug_dma_map_sg(dev, sg, nents, ents, dir); return ents; } static inline __attribute__((no_instrument_function)) void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (65), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); debug_dma_unmap_sg(dev, sg, nents, dir); if (ops->unmap_sg) ops->unmap_sg(dev, sg, nents, dir, attrs); } static inline __attribute__((no_instrument_function)) dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); dma_addr_t addr; kmemcheck_mark_initialized(lowmem_page_address(page) + offset, size); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (79), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); addr = ops->map_page(dev, page, offset, size, dir, ((void *)0)); debug_dma_map_page(dev, page, offset, size, dir, addr, false); return addr; } static inline __attribute__((no_instrument_function)) void dma_unmap_page(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (91), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->unmap_page) ops->unmap_page(dev, addr, size, dir, ((void *)0)); debug_dma_unmap_page(dev, addr, size, dir, false); } static inline __attribute__((no_instrument_function)) void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (103), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_single_for_cpu) ops->sync_single_for_cpu(dev, addr, size, dir); debug_dma_sync_single_for_cpu(dev, addr, size, dir); } static inline __attribute__((no_instrument_function)) void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (115), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_single_for_device) ops->sync_single_for_device(dev, addr, size, dir); debug_dma_sync_single_for_device(dev, addr, size, dir); } static inline __attribute__((no_instrument_function)) void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t addr, unsigned long offset, size_t size, enum dma_data_direction dir) { const struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (129), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_single_for_cpu) ops->sync_single_for_cpu(dev, addr + offset, size, dir); debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); } static inline __attribute__((no_instrument_function)) void dma_sync_single_range_for_device(struct device *dev, dma_addr_t addr, unsigned long offset, size_t size, enum dma_data_direction dir) { const struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (143), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_single_for_device) ops->sync_single_for_device(dev, addr + offset, size, dir); debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); } static inline __attribute__((no_instrument_function)) void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (155), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_sg_for_cpu) ops->sync_sg_for_cpu(dev, sg, nelems, dir); debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); } static inline __attribute__((no_instrument_function)) void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { struct dma_map_ops *ops = get_dma_ops(dev); do { if (ldv__builtin_expect(!!(!valid_dma_direction(dir)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/asm-generic/dma-mapping-common.h"), "i" (167), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (ops->sync_sg_for_device) ops->sync_sg_for_device(dev, sg, nelems, dir); debug_dma_sync_sg_for_device(dev, sg, nelems, dir); } static inline __attribute__((no_instrument_function)) int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *ops = get_dma_ops(dev); if (ops->mapping_error) return ops->mapping_error(dev, dma_addr); return (dma_addr == 0); } extern int dma_supported(struct device *hwdev, u64 mask); extern int dma_set_mask(struct device *dev, u64 mask); extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, gfp_t flag, struct dma_attrs *attrs); static inline __attribute__((no_instrument_function)) bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) { if (!dev->dma_mask) return 0; return addr + size - 1 <= *dev->dma_mask; } static inline __attribute__((no_instrument_function)) dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) { return paddr; } static inline __attribute__((no_instrument_function)) phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) { return daddr; } static inline __attribute__((no_instrument_function)) void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction dir) { flush_write_buffers(); } static inline __attribute__((no_instrument_function)) unsigned long dma_alloc_coherent_mask(struct device *dev, gfp_t gfp) { unsigned long dma_mask = 0; dma_mask = dev->coherent_dma_mask; if (!dma_mask) dma_mask = (gfp & (( gfp_t)0x01u)) ? (((24) == 64) ? ~0ULL : ((1ULL<<(24))-1)) : (((32) == 64) ? ~0ULL : ((1ULL<<(32))-1)); return dma_mask; } static inline __attribute__((no_instrument_function)) gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) { unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp); if (dma_mask <= (((24) == 64) ? ~0ULL : ((1ULL<<(24))-1))) gfp |= (( gfp_t)0x01u); if (dma_mask <= (((32) == 64) ? ~0ULL : ((1ULL<<(32))-1)) && !(gfp & (( gfp_t)0x01u))) gfp |= (( gfp_t)0x04u); return gfp; } static inline __attribute__((no_instrument_function)) void * dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); void *memory; gfp &= ~((( gfp_t)0x01u) | (( gfp_t)0x02u) | (( gfp_t)0x04u)); if ((0)) return memory; if (!dev) dev = &x86_dma_fallback_dev; if (!is_device_dma_capable(dev)) return ((void *)0); if (!ops->alloc) return ((void *)0); memory = ops->alloc(dev, size, dma_handle, dma_alloc_coherent_gfp_flags(dev, gfp), attrs); debug_dma_alloc_coherent(dev, size, *dma_handle, memory); return memory; } static inline __attribute__((no_instrument_function)) void dma_free_attrs(struct device *dev, size_t size, void *vaddr, dma_addr_t bus, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); ({ int __ret_warn_on = !!(({ unsigned long _flags; do { ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); _flags = arch_local_save_flags(); } while (0); ({ ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(_flags); }); })); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("/home/zakharov/launch/inst/current/envs/linux-3.4/linux-3.4/arch/x86/include/asm/dma-mapping.h", 153); ldv__builtin_expect(!!(__ret_warn_on), 0); }); if ((0)) return; debug_dma_free_coherent(dev, size, vaddr, bus); if (ops->free) ops->free(dev, size, vaddr, bus, attrs); } static inline __attribute__((no_instrument_function)) u64 dma_get_mask(struct device *dev) { if (dev && dev->dma_mask && *dev->dma_mask) return *dev->dma_mask; return (((32) == 64) ? ~0ULL : ((1ULL<<(32))-1)); } static inline __attribute__((no_instrument_function)) int dma_set_coherent_mask(struct device *dev, u64 mask) { if (!dma_supported(dev, mask)) return -5; dev->coherent_dma_mask = mask; return 0; } extern u64 dma_get_required_mask(struct device *dev); static inline __attribute__((no_instrument_function)) unsigned int dma_get_max_seg_size(struct device *dev) { return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; } static inline __attribute__((no_instrument_function)) unsigned int dma_set_max_seg_size(struct device *dev, unsigned int size) { if (dev->dma_parms) { dev->dma_parms->max_segment_size = size; return 0; } else return -5; } static inline __attribute__((no_instrument_function)) unsigned long dma_get_seg_boundary(struct device *dev) { return dev->dma_parms ? dev->dma_parms->segment_boundary_mask : 0xffffffff; } static inline __attribute__((no_instrument_function)) int dma_set_seg_boundary(struct device *dev, unsigned long mask) { if (dev->dma_parms) { dev->dma_parms->segment_boundary_mask = mask; return 0; } else return -5; } static inline __attribute__((no_instrument_function)) void *dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { void *ret = dma_alloc_attrs(dev,size,dma_handle,flag,((void *)0)); if (ret) memset(ret, 0, size); return ret; } static inline __attribute__((no_instrument_function)) int dma_get_cache_alignment(void) { return 1; } static inline __attribute__((no_instrument_function)) int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, dma_addr_t device_addr, size_t size, int flags) { return 0; } static inline __attribute__((no_instrument_function)) void dma_release_declared_memory(struct device *dev) { } static inline __attribute__((no_instrument_function)) void * dma_mark_declared_memory_occupied(struct device *dev, dma_addr_t device_addr, size_t size) { return ERR_PTR(-16); } extern void *dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp); extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); extern void *dmam_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp); extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); static inline __attribute__((no_instrument_function)) int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, dma_addr_t device_addr, size_t size, gfp_t gfp) { return 0; } static inline __attribute__((no_instrument_function)) void dmam_release_declared_memory(struct device *dev) { } static inline __attribute__((no_instrument_function)) int pci_dma_supported(struct pci_dev *hwdev, u64 mask) { return dma_supported(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, mask); } static inline __attribute__((no_instrument_function)) void * pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) { return dma_alloc_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev,size,dma_handle,((( gfp_t)0x20u)),((void *)0)); } static inline __attribute__((no_instrument_function)) void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) { dma_free_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev,size,vaddr,dma_handle,((void *)0)); } static inline __attribute__((no_instrument_function)) dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) { return dma_map_single_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, ptr, size, (enum dma_data_direction)direction, ((void *)0)); } static inline __attribute__((no_instrument_function)) void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction) { dma_unmap_single_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction, ((void *)0)); } static inline __attribute__((no_instrument_function)) dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page, unsigned long offset, size_t size, int direction) { return dma_map_page(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) void pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address, size_t size, int direction) { dma_unmap_page(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { return dma_map_sg_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, sg, nents, (enum dma_data_direction)direction, ((void *)0)); } static inline __attribute__((no_instrument_function)) void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { dma_unmap_sg_attrs(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, sg, nents, (enum dma_data_direction)direction, ((void *)0)); } static inline __attribute__((no_instrument_function)) void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction) { dma_sync_single_for_cpu(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction) { dma_sync_single_for_device(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction) { dma_sync_sg_for_cpu(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction) { dma_sync_sg_for_device(hwdev == ((void *)0) ? ((void *)0) : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); } static inline __attribute__((no_instrument_function)) int pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr) { return dma_mapping_error(&pdev->dev, dma_addr); } static inline __attribute__((no_instrument_function)) int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return dma_set_mask(&dev->dev, mask); } static inline __attribute__((no_instrument_function)) int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) { return dma_set_coherent_mask(&dev->dev, mask); } static inline __attribute__((no_instrument_function)) struct resource * pcibios_select_root(struct pci_dev *pdev, struct resource *res) { struct resource *root = ((void *)0); if (res->flags & 0x00000100) root = &ioport_resource; if (res->flags & 0x00000200) root = &iomem_resource; return root; } static inline __attribute__((no_instrument_function)) int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) { return channel ? 15 : 14; } static inline __attribute__((no_instrument_function)) int __pcibus_to_node(const struct pci_bus *bus) { const struct pci_sysdata *sd = bus->sysdata; return sd->node; } static inline __attribute__((no_instrument_function)) const struct cpumask * cpumask_of_pcibus(const struct pci_bus *bus) { int node; node = __pcibus_to_node(bus); return (node == -1) ? cpu_online_mask : cpumask_of_node(node); } static inline __attribute__((no_instrument_function)) void *pci_get_drvdata(struct pci_dev *pdev) { return dev_get_drvdata(&pdev->dev); } static inline __attribute__((no_instrument_function)) void pci_set_drvdata(struct pci_dev *pdev, void *data) { dev_set_drvdata(&pdev->dev, data); } static inline __attribute__((no_instrument_function)) const char *pci_name(const struct pci_dev *pdev) { return dev_name(&pdev->dev); } static inline __attribute__((no_instrument_function)) void pci_resource_to_user(const struct pci_dev *dev, int bar, const struct resource *rsrc, resource_size_t *start, resource_size_t *end) { *start = rsrc->start; *end = rsrc->end; } struct pci_fixup { u16 vendor; u16 device; u32 class; unsigned int class_shift; void (*hook)(struct pci_dev *dev); }; enum pci_fixup_pass { pci_fixup_early, pci_fixup_header, pci_fixup_final, pci_fixup_enable, pci_fixup_resume, pci_fixup_suspend, pci_fixup_resume_early, }; void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); void *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); void pcim_iounmap(struct pci_dev *pdev, void *addr); void * const *pcim_iomap_table(struct pci_dev *pdev); int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, const char *name); void pcim_iounmap_regions(struct pci_dev *pdev, int mask); extern int pci_pci_problems; extern unsigned long pci_cardbus_io_size; extern unsigned long pci_cardbus_mem_size; extern u8 __attribute__ ((__section__(".devinit.data"))) pci_dfl_cache_line_size; extern u8 pci_cache_line_size; extern unsigned long pci_hotplug_io_size; extern unsigned long pci_hotplug_mem_size; int pcibios_add_platform_entries(struct pci_dev *dev); void pcibios_disable_device(struct pci_dev *dev); void pcibios_set_master(struct pci_dev *dev); int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_mmcfg_early_init(void); extern void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) pci_mmcfg_late_init(void); int pci_ext_cfg_avail(struct pci_dev *dev); void *pci_ioremap_bar(struct pci_dev *pdev, int bar); extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); extern void pci_disable_sriov(struct pci_dev *dev); extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); extern int pci_num_vf(struct pci_dev *dev); extern void pci_hp_create_module_link(struct pci_slot *pci_slot); extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); static inline __attribute__((no_instrument_function)) int pci_pcie_cap(struct pci_dev *dev) { return dev->pcie_cap; } static inline __attribute__((no_instrument_function)) bool pci_is_pcie(struct pci_dev *dev) { return !!pci_pcie_cap(dev); } void pci_request_acs(void); static inline __attribute__((no_instrument_function)) u16 pci_vpd_lrdt_size(const u8 *lrdt) { return (u16)lrdt[1] + ((u16)lrdt[2] << 8); } static inline __attribute__((no_instrument_function)) u8 pci_vpd_srdt_size(const u8 *srdt) { return (*srdt) & 0x07; } static inline __attribute__((no_instrument_function)) u8 pci_vpd_info_field_size(const u8 *info_field) { return info_field[2]; } int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt); int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, unsigned int len, const char *kw); static inline __attribute__((no_instrument_function)) void pci_set_of_node(struct pci_dev *dev) { } static inline __attribute__((no_instrument_function)) void pci_release_of_node(struct pci_dev *dev) { } static inline __attribute__((no_instrument_function)) void pci_set_bus_of_node(struct pci_bus *bus) { } static inline __attribute__((no_instrument_function)) void pci_release_bus_of_node(struct pci_bus *bus) { } struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); struct firmware { size_t size; const u8 *data; struct page **pages; }; struct module; struct device; struct builtin_fw { char *name; void *data; unsigned long size; }; int request_firmware(const struct firmware **fw, const char *name, struct device *device); int request_firmware_nowait( struct module *module, bool uevent, const char *name, struct device *device, gfp_t gfp, void *context, void (*cont)(const struct firmware *fw, void *context)); void release_firmware(const struct firmware *fw); struct ethhdr { unsigned char h_dest[6]; unsigned char h_source[6]; __be16 h_proto; } __attribute__((packed)); typedef unsigned short __kernel_sa_family_t; struct __kernel_sockaddr_storage { __kernel_sa_family_t ss_family; char __data[128 - sizeof(unsigned short)]; } __attribute__ ((aligned((__alignof__ (struct sockaddr *))))); struct pid; struct cred; struct seq_file; extern void socket_seq_show(struct seq_file *seq); typedef __kernel_sa_family_t sa_family_t; struct sockaddr { sa_family_t sa_family; char sa_data[14]; }; struct linger { int l_onoff; int l_linger; }; struct msghdr { void * msg_name; int msg_namelen; struct iovec * msg_iov; __kernel_size_t msg_iovlen; void * msg_control; __kernel_size_t msg_controllen; unsigned msg_flags; }; struct mmsghdr { struct msghdr msg_hdr; unsigned msg_len; }; struct cmsghdr { __kernel_size_t cmsg_len; int cmsg_level; int cmsg_type; }; static inline __attribute__((no_instrument_function)) struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, struct cmsghdr *__cmsg) { struct cmsghdr * __ptr; __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + ( ((__cmsg->cmsg_len)+sizeof(long)-1) & ~(sizeof(long)-1) )); if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) return (struct cmsghdr *)0; return __ptr; } static inline __attribute__((no_instrument_function)) struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) { return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); } struct ucred { __u32 pid; __u32 uid; __u32 gid; }; extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred); extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, int offset, int len); extern int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset, unsigned int len, __wsum *csump); extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct __kernel_sockaddr_storage *address, int mode); extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, int offset, int len); extern int move_addr_to_kernel(void *uaddr, int ulen, struct __kernel_sockaddr_storage *kaddr); extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); struct timespec; extern int __sys_recvmmsg(int fd, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); extern int __sys_sendmmsg(int fd, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); typedef enum { SS_FREE = 0, SS_UNCONNECTED, SS_CONNECTING, SS_CONNECTED, SS_DISCONNECTING } socket_state; struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; struct rnd_state { __u32 s1, s2, s3; }; extern void rand_initialize_irq(int irq); extern void add_input_randomness(unsigned int type, unsigned int code, unsigned int value); extern void add_interrupt_randomness(int irq); extern void get_random_bytes(void *buf, int nbytes); void generate_random_uuid(unsigned char uuid_out[16]); unsigned int get_random_int(void); unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); u32 random32(void); void srandom32(u32 seed); u32 prandom32(struct rnd_state *); static inline __attribute__((no_instrument_function)) u32 __seed(u32 x, u32 m) { return (x < m) ? x + m : x; } static inline __attribute__((no_instrument_function)) void prandom32_seed(struct rnd_state *state, u64 seed) { u32 i = (seed >> 32) ^ (seed << 10) ^ seed; state->s1 = __seed(i, 1); state->s2 = __seed(i, 7); state->s3 = __seed(i, 15); } static inline __attribute__((no_instrument_function)) int arch_get_random_long(unsigned long *v) { int ok; asm volatile ("661:\n\t" "movl $0, %0\n\t" ".byte " "0x66,0x66,0x90,0x66,0x90" "\n" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(4*32+30)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "\n1: " ".byte 0x48,0x0f,0xc7,0xf0" "\n\t" "jc 2f\n\t" "decl %0\n\t" "jnz 1b\n\t" "2:" "\n664:\n" ".previous" : "=r" (ok), "=a" (*v) : "i" (0), "0" (10)); return ok; }; static inline __attribute__((no_instrument_function)) int arch_get_random_int(unsigned int *v) { int ok; asm volatile ("661:\n\t" "movl $0, %0\n\t" ".byte " "0x66,0x66,0x66,0x90" "\n" "\n662:\n" ".section .altinstructions,\"a\"\n" " .long 661b - .\n" " .long 663f - .\n" " .word " "(4*32+30)" "\n" " .byte 662b-661b\n" " .byte 664f-663f\n" ".previous\n" ".section .discard,\"aw\",@progbits\n" " .byte 0xff + (664f-663f) - (662b-661b)\n" ".previous\n" ".section .altinstr_replacement, \"ax\"\n" "663:\n\t" "\n1: " ".byte 0x0f,0xc7,0xf0" "\n\t" "jc 2f\n\t" "decl %0\n\t" "jnz 1b\n\t" "2:" "\n664:\n" ".previous" : "=r" (ok), "=a" (*v) : "i" (0), "0" (10)); return ok; }; extern void x86_init_rdrand(struct cpuinfo_x86 *c); struct poll_table_struct; struct pipe_inode_info; struct inode; struct net; enum sock_type { SOCK_STREAM = 1, SOCK_DGRAM = 2, SOCK_RAW = 3, SOCK_RDM = 4, SOCK_SEQPACKET = 5, SOCK_DCCP = 6, SOCK_PACKET = 10, }; enum sock_shutdown_cmd { SHUT_RD = 0, SHUT_WR = 1, SHUT_RDWR = 2, }; struct socket_wq { wait_queue_head_t wait; struct fasync_struct *fasync_list; struct rcu_head rcu; } __attribute__((__aligned__((1 << (6))))); struct socket { socket_state state; ; short type; ; unsigned long flags; struct socket_wq *wq; struct file *file; struct sock *sk; const struct proto_ops *ops; }; struct vm_area_struct; struct page; struct kiocb; struct sockaddr; struct msghdr; struct module; struct proto_ops { int family; struct module *owner; int (*release) (struct socket *sock); int (*bind) (struct socket *sock, struct sockaddr *myaddr, int sockaddr_len); int (*connect) (struct socket *sock, struct sockaddr *vaddr, int sockaddr_len, int flags); int (*socketpair)(struct socket *sock1, struct socket *sock2); int (*accept) (struct socket *sock, struct socket *newsock, int flags); int (*getname) (struct socket *sock, struct sockaddr *addr, int *sockaddr_len, int peer); unsigned int (*poll) (struct file *file, struct socket *sock, struct poll_table_struct *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*compat_ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*listen) (struct socket *sock, int len); int (*shutdown) (struct socket *sock, int flags); int (*setsockopt)(struct socket *sock, int level, int optname, char *optval, unsigned int optlen); int (*getsockopt)(struct socket *sock, int level, int optname, char *optval, int *optlen); int (*compat_setsockopt)(struct socket *sock, int level, int optname, char *optval, unsigned int optlen); int (*compat_getsockopt)(struct socket *sock, int level, int optname, char *optval, int *optlen); int (*sendmsg) (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len); int (*recvmsg) (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len, int flags); int (*mmap) (struct file *file, struct socket *sock, struct vm_area_struct * vma); ssize_t (*sendpage) (struct socket *sock, struct page *page, int offset, size_t size, int flags); ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags); void (*set_peek_off)(struct sock *sk, int val); }; struct net_proto_family { int family; int (*create)(struct net *net, struct socket *sock, int protocol, int kern); struct module *owner; }; struct iovec; struct kvec; enum { SOCK_WAKE_IO, SOCK_WAKE_WAITD, SOCK_WAKE_SPACE, SOCK_WAKE_URG, }; extern int sock_wake_async(struct socket *sk, int how, int band); extern int sock_register(const struct net_proto_family *fam); extern void sock_unregister(int family); extern int __sock_create(struct net *net, int family, int type, int proto, struct socket **res, int kern); extern int sock_create(int family, int type, int proto, struct socket **res); extern int sock_create_kern(int family, int type, int proto, struct socket **res); extern int sock_create_lite(int family, int type, int proto, struct socket **res); extern void sock_release(struct socket *sock); extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len); extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int flags); extern int sock_map_fd(struct socket *sock, int flags); extern struct socket *sockfd_lookup(int fd, int *err); extern int net_ratelimit(void); extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len); extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len, int flags); extern int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen); extern int kernel_listen(struct socket *sock, int backlog); extern int kernel_accept(struct socket *sock, struct socket **newsock, int flags); extern int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, int flags); extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr, int *addrlen); extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr, int *addrlen); extern int kernel_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen); extern int kernel_setsockopt(struct socket *sock, int level, int optname, char *optval, unsigned int optlen); extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); extern int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how); struct module; struct ts_config; struct ts_state { unsigned int offset; char cb[40]; }; struct ts_ops { const char *name; struct ts_config * (*init)(const void *, unsigned int, gfp_t, int); unsigned int (*find)(struct ts_config *, struct ts_state *); void (*destroy)(struct ts_config *); void * (*get_pattern)(struct ts_config *); unsigned int (*get_pattern_len)(struct ts_config *); struct module *owner; struct list_head list; }; struct ts_config { struct ts_ops *ops; int flags; unsigned int (*get_next_block)(unsigned int consumed, const u8 **dst, struct ts_config *conf, struct ts_state *state); void (*finish)(struct ts_config *conf, struct ts_state *state); }; static inline __attribute__((no_instrument_function)) unsigned int textsearch_next(struct ts_config *conf, struct ts_state *state) { unsigned int ret = conf->ops->find(conf, state); if (conf->finish) conf->finish(conf, state); return ret; } static inline __attribute__((no_instrument_function)) unsigned int textsearch_find(struct ts_config *conf, struct ts_state *state) { state->offset = 0; return textsearch_next(conf, state); } static inline __attribute__((no_instrument_function)) void *textsearch_get_pattern(struct ts_config *conf) { return conf->ops->get_pattern(conf); } static inline __attribute__((no_instrument_function)) unsigned int textsearch_get_pattern_len(struct ts_config *conf) { return conf->ops->get_pattern_len(conf); } extern int textsearch_register(struct ts_ops *); extern int textsearch_unregister(struct ts_ops *); extern struct ts_config *textsearch_prepare(const char *, const void *, unsigned int, gfp_t, int); extern void textsearch_destroy(struct ts_config *conf); extern unsigned int textsearch_find_continuous(struct ts_config *, struct ts_state *, const void *, unsigned int); static inline __attribute__((no_instrument_function)) struct ts_config *alloc_ts_config(size_t payload, gfp_t gfp_mask) { struct ts_config *conf; conf = kzalloc((((sizeof(*conf)) + 8 -1) & ~(8 -1)) + payload, gfp_mask); if (conf == ((void *)0)) return ERR_PTR(-12); return conf; } static inline __attribute__((no_instrument_function)) void *ts_config_priv(struct ts_config *conf) { return ((u8 *) conf + (((sizeof(struct ts_config)) + 8 -1) & ~(8 -1))); } static inline __attribute__((no_instrument_function)) __sum16 csum_fold(__wsum sum) { asm(" addl %1,%0\n" " adcl $0xffff,%0" : "=r" (sum) : "r" (( u32)sum << 16), "0" (( u32)sum & 0xffff0000)); return ( __sum16)(~( u32)sum >> 16); } static inline __attribute__((no_instrument_function)) __sum16 ip_fast_csum(const void *iph, unsigned int ihl) { unsigned int sum; asm(" movl (%1), %0\n" " subl $4, %2\n" " jbe 2f\n" " addl 4(%1), %0\n" " adcl 8(%1), %0\n" " adcl 12(%1), %0\n" "1: adcl 16(%1), %0\n" " lea 4(%1), %1\n" " decl %2\n" " jne 1b\n" " adcl $0, %0\n" " movl %0, %2\n" " shrl $16, %0\n" " addw %w2, %w0\n" " adcl $0, %0\n" " notl %0\n" "2:" : "=r" (sum), "=r" (iph), "=r" (ihl) : "1" (iph), "2" (ihl) : "memory"); return ( __sum16)sum; } static inline __attribute__((no_instrument_function)) __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, unsigned short proto, __wsum sum) { asm(" addl %1, %0\n" " adcl %2, %0\n" " adcl %3, %0\n" " adcl $0, %0\n" : "=r" (sum) : "g" (daddr), "g" (saddr), "g" ((len + proto)<<8), "0" (sum)); return sum; } static inline __attribute__((no_instrument_function)) __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, unsigned short proto, __wsum sum) { return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); } extern __wsum csum_partial(const void *buff, int len, __wsum sum); extern __wsum csum_partial_copy_generic(const void *src, const void *dst, int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr); extern __wsum csum_partial_copy_from_user(const void *src, void *dst, int len, __wsum isum, int *errp); extern __wsum csum_partial_copy_to_user(const void *src, void *dst, int len, __wsum isum, int *errp); extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum); extern __sum16 ip_compute_csum(const void *buff, int len); struct in6_addr; extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len, unsigned short proto, __wsum sum); static inline __attribute__((no_instrument_function)) unsigned add32_with_carry(unsigned a, unsigned b) { asm("addl %2,%0\n\t" "adcl $0,%0" : "=r" (a) : "0" (a), "r" (b)); return a; } static inline __attribute__((no_instrument_function)) __wsum csum_add(__wsum csum, __wsum addend) { u32 res = ( u32)csum; res += ( u32)addend; return ( __wsum)(res + (res < ( u32)addend)); } static inline __attribute__((no_instrument_function)) __wsum csum_sub(__wsum csum, __wsum addend) { return csum_add(csum, ~addend); } static inline __attribute__((no_instrument_function)) __wsum csum_block_add(__wsum csum, __wsum csum2, int offset) { u32 sum = ( u32)csum2; if (offset&1) sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); return csum_add(csum, ( __wsum)sum); } static inline __attribute__((no_instrument_function)) __wsum csum_block_sub(__wsum csum, __wsum csum2, int offset) { u32 sum = ( u32)csum2; if (offset&1) sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); return csum_sub(csum, ( __wsum)sum); } static inline __attribute__((no_instrument_function)) __wsum csum_unfold(__sum16 n) { return ( __wsum)n; } static inline __attribute__((no_instrument_function)) void csum_replace4(__sum16 *sum, __be32 from, __be32 to) { __be32 diff[] = { ~from, to }; *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum))); } static inline __attribute__((no_instrument_function)) void csum_replace2(__sum16 *sum, __be16 from, __be16 to) { csum_replace4(sum, ( __be32)from, ( __be32)to); } struct sk_buff; extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, __be32 from, __be32 to, int pseudohdr); static inline __attribute__((no_instrument_function)) void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, __be16 from, __be16 to, int pseudohdr) { inet_proto_csum_replace4(sum, skb, ( __be32)from, ( __be32)to, pseudohdr); } typedef s32 dma_cookie_t; enum dma_status { DMA_SUCCESS, DMA_IN_PROGRESS, DMA_PAUSED, DMA_ERROR, }; enum dma_transaction_type { DMA_MEMCPY, DMA_XOR, DMA_PQ, DMA_XOR_VAL, DMA_PQ_VAL, DMA_MEMSET, DMA_INTERRUPT, DMA_SG, DMA_PRIVATE, DMA_ASYNC_TX, DMA_SLAVE, DMA_CYCLIC, DMA_INTERLEAVE, DMA_TX_TYPE_END, }; enum dma_transfer_direction { DMA_MEM_TO_MEM, DMA_MEM_TO_DEV, DMA_DEV_TO_MEM, DMA_DEV_TO_DEV, DMA_TRANS_NONE, }; struct data_chunk { size_t size; size_t icg; }; struct dma_interleaved_template { dma_addr_t src_start; dma_addr_t dst_start; enum dma_transfer_direction dir; bool src_inc; bool dst_inc; bool src_sgl; bool dst_sgl; size_t numf; size_t frame_size; struct data_chunk sgl[0]; }; enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0), DMA_CTRL_ACK = (1 << 1), DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2), DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4), DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5), DMA_PREP_PQ_DISABLE_P = (1 << 6), DMA_PREP_PQ_DISABLE_Q = (1 << 7), DMA_PREP_CONTINUE = (1 << 8), DMA_PREP_FENCE = (1 << 9), }; enum dma_ctrl_cmd { DMA_TERMINATE_ALL, DMA_PAUSE, DMA_RESUME, DMA_SLAVE_CONFIG, FSLDMA_EXTERNAL_START, }; enum sum_check_bits { SUM_CHECK_P = 0, SUM_CHECK_Q = 1, }; enum sum_check_flags { SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P), SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q), }; typedef struct { unsigned long bits[(((DMA_TX_TYPE_END) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))]; } dma_cap_mask_t; struct dma_chan_percpu { unsigned long memcpy_count; unsigned long bytes_transferred; }; struct dma_chan { struct dma_device *device; dma_cookie_t cookie; dma_cookie_t completed_cookie; int chan_id; struct dma_chan_dev *dev; struct list_head device_node; struct dma_chan_percpu *local; int client_count; int table_count; void *private; }; struct dma_chan_dev { struct dma_chan *chan; struct device device; int dev_id; atomic_t *idr_ref; }; enum dma_slave_buswidth { DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, DMA_SLAVE_BUSWIDTH_1_BYTE = 1, DMA_SLAVE_BUSWIDTH_2_BYTES = 2, DMA_SLAVE_BUSWIDTH_4_BYTES = 4, DMA_SLAVE_BUSWIDTH_8_BYTES = 8, }; struct dma_slave_config { enum dma_transfer_direction direction; dma_addr_t src_addr; dma_addr_t dst_addr; enum dma_slave_buswidth src_addr_width; enum dma_slave_buswidth dst_addr_width; u32 src_maxburst; u32 dst_maxburst; bool device_fc; }; static inline __attribute__((no_instrument_function)) const char *dma_chan_name(struct dma_chan *chan) { return dev_name(&chan->dev->device); } void dma_chan_cleanup(struct kref *kref); typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param); typedef void (*dma_async_tx_callback)(void *dma_async_param); struct dma_async_tx_descriptor { dma_cookie_t cookie; enum dma_ctrl_flags flags; dma_addr_t phys; struct dma_chan *chan; dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); dma_async_tx_callback callback; void *callback_param; }; static inline __attribute__((no_instrument_function)) void txd_lock(struct dma_async_tx_descriptor *txd) { } static inline __attribute__((no_instrument_function)) void txd_unlock(struct dma_async_tx_descriptor *txd) { } static inline __attribute__((no_instrument_function)) void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next) { do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dmaengine.h"), "i" (432), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } static inline __attribute__((no_instrument_function)) void txd_clear_parent(struct dma_async_tx_descriptor *txd) { } static inline __attribute__((no_instrument_function)) void txd_clear_next(struct dma_async_tx_descriptor *txd) { } static inline __attribute__((no_instrument_function)) struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd) { return ((void *)0); } static inline __attribute__((no_instrument_function)) struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd) { return ((void *)0); } struct dma_tx_state { dma_cookie_t last; dma_cookie_t used; u32 residue; }; struct dma_device { unsigned int chancnt; unsigned int privatecnt; struct list_head channels; struct list_head global_node; dma_cap_mask_t cap_mask; unsigned short max_xor; unsigned short max_pq; u8 copy_align; u8 xor_align; u8 pq_align; u8 fill_align; int dev_id; struct device *dev; int (*device_alloc_chan_resources)(struct dma_chan *chan); void (*device_free_chan_resources)(struct dma_chan *chan); struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, size_t len, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_xor)( struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src, unsigned int src_cnt, size_t len, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)( struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, size_t len, enum sum_check_flags *result, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_pq)( struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, unsigned int src_cnt, const unsigned char *scf, size_t len, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_pq_val)( struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, unsigned int src_cnt, const unsigned char *scf, size_t len, enum sum_check_flags *pqres, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_memset)( struct dma_chan *chan, dma_addr_t dest, int value, size_t len, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( struct dma_chan *chan, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_dma_sg)( struct dma_chan *chan, struct scatterlist *dst_sg, unsigned int dst_nents, struct scatterlist *src_sg, unsigned int src_nents, unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_slave_sg)( struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, enum dma_transfer_direction direction, unsigned long flags, void *context); struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, void *context); struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( struct dma_chan *chan, struct dma_interleaved_template *xt, unsigned long flags); int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg); enum dma_status (*device_tx_status)(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate); void (*device_issue_pending)(struct dma_chan *chan); }; static inline __attribute__((no_instrument_function)) int dmaengine_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg) { return chan->device->device_control(chan, cmd, arg); } static inline __attribute__((no_instrument_function)) int dmaengine_slave_config(struct dma_chan *chan, struct dma_slave_config *config) { return dmaengine_device_control(chan, DMA_SLAVE_CONFIG, (unsigned long)config); } static inline __attribute__((no_instrument_function)) struct dma_async_tx_descriptor *dmaengine_prep_slave_single( struct dma_chan *chan, void *buf, size_t len, enum dma_transfer_direction dir, unsigned long flags) { struct scatterlist sg; sg_init_one(&sg, buf, len); return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags, ((void *)0)); } static inline __attribute__((no_instrument_function)) struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, enum dma_transfer_direction dir, unsigned long flags) { return chan->device->device_prep_slave_sg(chan, sgl, sg_len, dir, flags, ((void *)0)); } static inline __attribute__((no_instrument_function)) struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction dir) { return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, period_len, dir, ((void *)0)); } static inline __attribute__((no_instrument_function)) int dmaengine_terminate_all(struct dma_chan *chan) { return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); } static inline __attribute__((no_instrument_function)) int dmaengine_pause(struct dma_chan *chan) { return dmaengine_device_control(chan, DMA_PAUSE, 0); } static inline __attribute__((no_instrument_function)) int dmaengine_resume(struct dma_chan *chan) { return dmaengine_device_control(chan, DMA_RESUME, 0); } static inline __attribute__((no_instrument_function)) dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc) { return desc->tx_submit(desc); } static inline __attribute__((no_instrument_function)) bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len) { size_t mask; if (!align) return true; mask = (1 << align) - 1; if (mask & (off1 | off2 | len)) return false; return true; } static inline __attribute__((no_instrument_function)) bool is_dma_copy_aligned(struct dma_device *dev, size_t off1, size_t off2, size_t len) { return dmaengine_check_align(dev->copy_align, off1, off2, len); } static inline __attribute__((no_instrument_function)) bool is_dma_xor_aligned(struct dma_device *dev, size_t off1, size_t off2, size_t len) { return dmaengine_check_align(dev->xor_align, off1, off2, len); } static inline __attribute__((no_instrument_function)) bool is_dma_pq_aligned(struct dma_device *dev, size_t off1, size_t off2, size_t len) { return dmaengine_check_align(dev->pq_align, off1, off2, len); } static inline __attribute__((no_instrument_function)) bool is_dma_fill_aligned(struct dma_device *dev, size_t off1, size_t off2, size_t len) { return dmaengine_check_align(dev->fill_align, off1, off2, len); } static inline __attribute__((no_instrument_function)) void dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue) { dma->max_pq = maxpq; if (has_pq_continue) dma->max_pq |= (1 << 15); } static inline __attribute__((no_instrument_function)) bool dmaf_continue(enum dma_ctrl_flags flags) { return (flags & DMA_PREP_CONTINUE) == DMA_PREP_CONTINUE; } static inline __attribute__((no_instrument_function)) bool dmaf_p_disabled_continue(enum dma_ctrl_flags flags) { enum dma_ctrl_flags mask = DMA_PREP_CONTINUE | DMA_PREP_PQ_DISABLE_P; return (flags & mask) == mask; } static inline __attribute__((no_instrument_function)) bool dma_dev_has_pq_continue(struct dma_device *dma) { return (dma->max_pq & (1 << 15)) == (1 << 15); } static inline __attribute__((no_instrument_function)) unsigned short dma_dev_to_maxpq(struct dma_device *dma) { return dma->max_pq & ~(1 << 15); } static inline __attribute__((no_instrument_function)) int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags) { if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags)) return dma_dev_to_maxpq(dma); else if (dmaf_p_disabled_continue(flags)) return dma_dev_to_maxpq(dma) - 1; else if (dmaf_continue(flags)) return dma_dev_to_maxpq(dma) - 3; do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dmaengine.h"), "i" (751), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } void dmaengine_get(void); void dmaengine_put(void); dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest, void *src, size_t len); dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page, unsigned int offset, void *kdata, size_t len); dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, unsigned int dest_off, struct page *src_pg, unsigned int src_off, size_t len); void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, struct dma_chan *chan); static inline __attribute__((no_instrument_function)) void async_tx_ack(struct dma_async_tx_descriptor *tx) { tx->flags |= DMA_CTRL_ACK; } static inline __attribute__((no_instrument_function)) void async_tx_clear_ack(struct dma_async_tx_descriptor *tx) { tx->flags &= ~DMA_CTRL_ACK; } static inline __attribute__((no_instrument_function)) bool async_tx_test_ack(struct dma_async_tx_descriptor *tx) { return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK; } static inline __attribute__((no_instrument_function)) int __first_dma_cap(const dma_cap_mask_t *srcp) { return ({ int __min1 = (DMA_TX_TYPE_END); int __min2 = (find_first_bit(srcp->bits, DMA_TX_TYPE_END)); __min1 < __min2 ? __min1: __min2; }) ; } static inline __attribute__((no_instrument_function)) int __next_dma_cap(int n, const dma_cap_mask_t *srcp) { return ({ int __min1 = (DMA_TX_TYPE_END); int __min2 = (find_next_bit(srcp->bits, DMA_TX_TYPE_END, n+1)); __min1 < __min2 ? __min1: __min2; }) ; } static inline __attribute__((no_instrument_function)) void __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp) { set_bit(tx_type, dstp->bits); } static inline __attribute__((no_instrument_function)) void __dma_cap_clear(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp) { clear_bit(tx_type, dstp->bits); } static inline __attribute__((no_instrument_function)) void __dma_cap_zero(dma_cap_mask_t *dstp) { bitmap_zero(dstp->bits, DMA_TX_TYPE_END); } static inline __attribute__((no_instrument_function)) int __dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp) { return (__builtin_constant_p((tx_type)) ? constant_test_bit((tx_type), (srcp->bits)) : variable_test_bit((tx_type), (srcp->bits))); } static inline __attribute__((no_instrument_function)) void dma_async_issue_pending(struct dma_chan *chan) { chan->device->device_issue_pending(chan); } static inline __attribute__((no_instrument_function)) enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) { struct dma_tx_state state; enum dma_status status; status = chan->device->device_tx_status(chan, cookie, &state); if (last) *last = state.last; if (used) *used = state.used; return status; } static inline __attribute__((no_instrument_function)) enum dma_status dma_async_is_complete(dma_cookie_t cookie, dma_cookie_t last_complete, dma_cookie_t last_used) { if (last_complete <= last_used) { if ((cookie <= last_complete) || (cookie > last_used)) return DMA_SUCCESS; } else { if ((cookie <= last_complete) && (cookie > last_used)) return DMA_SUCCESS; } return DMA_IN_PROGRESS; } static inline __attribute__((no_instrument_function)) void dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue) { if (st) { st->last = last; st->used = used; st->residue = residue; } } enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); void dma_issue_pending_all(void); struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); void dma_release_channel(struct dma_chan *chan); int dma_async_device_register(struct dma_device *device); void dma_async_device_unregister(struct dma_device *device); void dma_run_dependencies(struct dma_async_tx_descriptor *tx); struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); struct dma_chan *net_dma_find_channel(void); struct dma_page_list { char *base_address; int nr_pages; struct page **pages; }; struct dma_pinned_list { int nr_iovecs; struct dma_page_list page_list[0]; }; struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len); void dma_unpin_iovec_pages(struct dma_pinned_list* pinned_list); dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov, struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len); dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov, struct dma_pinned_list *pinned_list, struct page *page, unsigned int offset, size_t len); typedef u64 netdev_features_t; enum { NETIF_F_SG_BIT, NETIF_F_IP_CSUM_BIT, __UNUSED_NETIF_F_1, NETIF_F_HW_CSUM_BIT, NETIF_F_IPV6_CSUM_BIT, NETIF_F_HIGHDMA_BIT, NETIF_F_FRAGLIST_BIT, NETIF_F_HW_VLAN_TX_BIT, NETIF_F_HW_VLAN_RX_BIT, NETIF_F_HW_VLAN_FILTER_BIT, NETIF_F_VLAN_CHALLENGED_BIT, NETIF_F_GSO_BIT, NETIF_F_LLTX_BIT, NETIF_F_NETNS_LOCAL_BIT, NETIF_F_GRO_BIT, NETIF_F_LRO_BIT, NETIF_F_GSO_SHIFT, NETIF_F_TSO_BIT = NETIF_F_GSO_SHIFT, NETIF_F_UFO_BIT, NETIF_F_GSO_ROBUST_BIT, NETIF_F_TSO_ECN_BIT, NETIF_F_TSO6_BIT, NETIF_F_FSO_BIT, NETIF_F_GSO_RESERVED1, NETIF_F_GSO_LAST, NETIF_F_GSO_RESERVED2 = NETIF_F_GSO_LAST, NETIF_F_FCOE_CRC_BIT, NETIF_F_SCTP_CSUM_BIT, NETIF_F_FCOE_MTU_BIT, NETIF_F_NTUPLE_BIT, NETIF_F_RXHASH_BIT, NETIF_F_RXCSUM_BIT, NETIF_F_NOCACHE_COPY_BIT, NETIF_F_LOOPBACK_BIT, NETIF_F_RXFCS_BIT, NETIF_F_RXALL_BIT, NETDEV_FEATURE_COUNT }; struct net_device; struct scatterlist; struct pipe_inode_info; struct nf_conntrack { atomic_t use; }; struct nf_bridge_info { atomic_t use; struct net_device *physindev; struct net_device *physoutdev; unsigned int mask; unsigned long data[32 / sizeof(unsigned long)]; }; struct sk_buff_head { struct sk_buff *next; struct sk_buff *prev; __u32 qlen; spinlock_t lock; }; struct sk_buff; typedef struct skb_frag_struct skb_frag_t; struct skb_frag_struct { struct { struct page *p; } page; __u32 page_offset; __u32 size; }; static inline __attribute__((no_instrument_function)) unsigned int skb_frag_size(const skb_frag_t *frag) { return frag->size; } static inline __attribute__((no_instrument_function)) void skb_frag_size_set(skb_frag_t *frag, unsigned int size) { frag->size = size; } static inline __attribute__((no_instrument_function)) void skb_frag_size_add(skb_frag_t *frag, int delta) { frag->size += delta; } static inline __attribute__((no_instrument_function)) void skb_frag_size_sub(skb_frag_t *frag, int delta) { frag->size -= delta; } struct skb_shared_hwtstamps { ktime_t hwtstamp; ktime_t syststamp; }; enum { SKBTX_HW_TSTAMP = 1 << 0, SKBTX_SW_TSTAMP = 1 << 1, SKBTX_IN_PROGRESS = 1 << 2, SKBTX_DRV_NEEDS_SK_REF = 1 << 3, SKBTX_DEV_ZEROCOPY = 1 << 4, SKBTX_WIFI_STATUS = 1 << 5, }; struct ubuf_info { void (*callback)(struct ubuf_info *); void *ctx; unsigned long desc; }; struct skb_shared_info { unsigned char nr_frags; __u8 tx_flags; unsigned short gso_size; unsigned short gso_segs; unsigned short gso_type; struct sk_buff *frag_list; struct skb_shared_hwtstamps hwtstamps; __be32 ip6_frag_id; atomic_t dataref; void * destructor_arg; skb_frag_t frags[(65536/((1UL) << 12) + 1)]; }; enum { SKB_FCLONE_UNAVAILABLE, SKB_FCLONE_ORIG, SKB_FCLONE_CLONE, }; enum { SKB_GSO_TCPV4 = 1 << 0, SKB_GSO_UDP = 1 << 1, SKB_GSO_DODGY = 1 << 2, SKB_GSO_TCP_ECN = 1 << 3, SKB_GSO_TCPV6 = 1 << 4, SKB_GSO_FCOE = 1 << 5, }; typedef unsigned int sk_buff_data_t; struct sk_buff { struct sk_buff *next; struct sk_buff *prev; ktime_t tstamp; struct sock *sk; struct net_device *dev; char cb[48] __attribute__((aligned(8))); unsigned long _skb_refdst; struct sec_path *sp; unsigned int len, data_len; __u16 mac_len, hdr_len; union { __wsum csum; struct { __u16 csum_start; __u16 csum_offset; }; }; __u32 priority; ; __u8 local_df:1, cloned:1, ip_summed:2, nohdr:1, nfctinfo:3; __u8 pkt_type:3, fclone:2, ipvs_property:1, peeked:1, nf_trace:1; ; __be16 protocol; void (*destructor)(struct sk_buff *skb); struct nf_conntrack *nfct; struct sk_buff *nfct_reasm; struct nf_bridge_info *nf_bridge; int skb_iif; __u32 rxhash; __u16 vlan_tci; __u16 tc_index; __u16 tc_verd; __u16 queue_mapping; ; __u8 ndisc_nodetype:2; __u8 ooo_okay:1; __u8 l4_rxhash:1; __u8 wifi_acked_valid:1; __u8 wifi_acked:1; __u8 no_fcs:1; ; dma_cookie_t dma_cookie; __u32 secmark; union { __u32 mark; __u32 dropcount; __u32 avail_size; }; sk_buff_data_t transport_header; sk_buff_data_t network_header; sk_buff_data_t mac_header; sk_buff_data_t tail; sk_buff_data_t end; unsigned char *head, *data; unsigned int truesize; atomic_t users; }; static inline __attribute__((no_instrument_function)) struct dst_entry *skb_dst(const struct sk_buff *skb) { ({ int __ret_warn_on = !!((skb->_skb_refdst & 1UL) && !rcu_read_lock_held() && !rcu_read_lock_bh_held()); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null( "include/linux/skbuff.h" , 527 ); ldv__builtin_expect(!!(__ret_warn_on), 0); }) ; return (struct dst_entry *)(skb->_skb_refdst & ~(1UL)); } static inline __attribute__((no_instrument_function)) void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) { skb->_skb_refdst = (unsigned long)dst; } extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); static inline __attribute__((no_instrument_function)) bool skb_dst_is_noref(const struct sk_buff *skb) { return (skb->_skb_refdst & 1UL) && skb_dst(skb); } static inline __attribute__((no_instrument_function)) struct rtable *skb_rtable(const struct sk_buff *skb) { return (struct rtable *)skb_dst(skb); } extern void kfree_skb(struct sk_buff *skb); extern void consume_skb(struct sk_buff *skb); extern void __kfree_skb(struct sk_buff *skb); extern struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int fclone, int node); extern struct sk_buff *build_skb(void *data); static inline __attribute__((no_instrument_function)) struct sk_buff *alloc_skb(unsigned int size, gfp_t priority) { return __alloc_skb(size, priority, 0, (-1)); } static inline __attribute__((no_instrument_function)) struct sk_buff *alloc_skb_fclone(unsigned int size, gfp_t priority) { return __alloc_skb(size, priority, 1, (-1)); } extern void skb_recycle(struct sk_buff *skb); extern bool skb_recycle_check(struct sk_buff *skb, int skb_size); extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); extern struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); extern struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); extern struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask); extern int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom); extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, int newtailroom, gfp_t priority); extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len); extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); extern int skb_pad(struct sk_buff *skb, int pad); extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, int getfrag(void *from, char *to, int offset, int len,int odd, struct sk_buff *skb), void *from, int length); struct skb_seq_state { __u32 lower_offset; __u32 upper_offset; __u32 frag_idx; __u32 stepped_offset; struct sk_buff *root_skb; struct sk_buff *cur_skb; __u8 *frag_data; }; extern void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from, unsigned int to, struct skb_seq_state *st); extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data, struct skb_seq_state *st); extern void skb_abort_seq_read(struct skb_seq_state *st); extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, unsigned int to, struct ts_config *config, struct ts_state *state); extern void __skb_get_rxhash(struct sk_buff *skb); static inline __attribute__((no_instrument_function)) __u32 skb_get_rxhash(struct sk_buff *skb) { if (!skb->rxhash) __skb_get_rxhash(skb); return skb->rxhash; } static inline __attribute__((no_instrument_function)) unsigned char *skb_end_pointer(const struct sk_buff *skb) { return skb->head + skb->end; } static inline __attribute__((no_instrument_function)) struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb) { return &((struct skb_shared_info *)(skb_end_pointer(skb)))->hwtstamps; } static inline __attribute__((no_instrument_function)) int skb_queue_empty(const struct sk_buff_head *list) { return list->next == (struct sk_buff *)list; } static inline __attribute__((no_instrument_function)) bool skb_queue_is_last(const struct sk_buff_head *list, const struct sk_buff *skb) { return skb->next == (struct sk_buff *)list; } static inline __attribute__((no_instrument_function)) bool skb_queue_is_first(const struct sk_buff_head *list, const struct sk_buff *skb) { return skb->prev == (struct sk_buff *)list; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_queue_next(const struct sk_buff_head *list, const struct sk_buff *skb) { do { if (ldv__builtin_expect(!!(skb_queue_is_last(list, skb)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (712), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return skb->next; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_queue_prev(const struct sk_buff_head *list, const struct sk_buff *skb) { do { if (ldv__builtin_expect(!!(skb_queue_is_first(list, skb)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (730), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return skb->prev; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_get(struct sk_buff *skb) { atomic_inc(&skb->users); return skb; } static inline __attribute__((no_instrument_function)) int skb_cloned(const struct sk_buff *skb) { return skb->cloned && (atomic_read(&((struct skb_shared_info *)(skb_end_pointer(skb)))->dataref) & ((1 << 16) - 1)) != 1; } static inline __attribute__((no_instrument_function)) int skb_header_cloned(const struct sk_buff *skb) { int dataref; if (!skb->cloned) return 0; dataref = atomic_read(&((struct skb_shared_info *)(skb_end_pointer(skb)))->dataref); dataref = (dataref & ((1 << 16) - 1)) - (dataref >> 16); return dataref != 1; } static inline __attribute__((no_instrument_function)) void skb_header_release(struct sk_buff *skb) { do { if (ldv__builtin_expect(!!(skb->nohdr), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (795), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); skb->nohdr = 1; atomic_add(1 << 16, &((struct skb_shared_info *)(skb_end_pointer(skb)))->dataref); } static inline __attribute__((no_instrument_function)) int skb_shared(const struct sk_buff *skb) { return atomic_read(&skb->users) != 1; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) { do { if (pri & (( gfp_t)0x10u)) do { __might_sleep("include/linux/skbuff.h", 828, 0); do { } while (0); } while (0); } while (0); if (skb_shared(skb)) { struct sk_buff *nskb = skb_clone(skb, pri); kfree_skb(skb); skb = nskb; } return skb; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_unshare(struct sk_buff *skb, gfp_t pri) { do { if (pri & (( gfp_t)0x10u)) do { __might_sleep("include/linux/skbuff.h", 860, 0); do { } while (0); } while (0); } while (0); if (skb_cloned(skb)) { struct sk_buff *nskb = skb_copy(skb, pri); kfree_skb(skb); skb = nskb; } return skb; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_peek(const struct sk_buff_head *list_) { struct sk_buff *list = ((const struct sk_buff *)list_)->next; if (list == (struct sk_buff *)list_) list = ((void *)0); return list; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_peek_next(struct sk_buff *skb, const struct sk_buff_head *list_) { struct sk_buff *next = skb->next; if (next == (struct sk_buff *)list_) next = ((void *)0); return next; } static inline __attribute__((no_instrument_function)) struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) { struct sk_buff *list = ((const struct sk_buff *)list_)->prev; if (list == (struct sk_buff *)list_) list = ((void *)0); return list; } static inline __attribute__((no_instrument_function)) __u32 skb_queue_len(const struct sk_buff_head *list_) { return list_->qlen; } static inline __attribute__((no_instrument_function)) void __skb_queue_head_init(struct sk_buff_head *list) { list->prev = list->next = (struct sk_buff *)list; list->qlen = 0; } static inline __attribute__((no_instrument_function)) void skb_queue_head_init(struct sk_buff_head *list) { do { spinlock_check(&list->lock); do { static struct lock_class_key __key; __raw_spin_lock_init((&(&list->lock)->rlock), "&(&list->lock)->rlock", &__key); } while (0); } while (0); __skb_queue_head_init(list); } static inline __attribute__((no_instrument_function)) void skb_queue_head_init_class(struct sk_buff_head *list, struct lock_class_key *class) { skb_queue_head_init(list); do { (void)(class); } while (0); } extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) void __skb_insert(struct sk_buff *newsk, struct sk_buff *prev, struct sk_buff *next, struct sk_buff_head *list) { newsk->next = next; newsk->prev = prev; next->prev = prev->next = newsk; list->qlen++; } static inline __attribute__((no_instrument_function)) void __skb_queue_splice(const struct sk_buff_head *list, struct sk_buff *prev, struct sk_buff *next) { struct sk_buff *first = list->next; struct sk_buff *last = list->prev; first->prev = prev; prev->next = first; last->next = next; next->prev = last; } static inline __attribute__((no_instrument_function)) void skb_queue_splice(const struct sk_buff_head *list, struct sk_buff_head *head) { if (!skb_queue_empty(list)) { __skb_queue_splice(list, (struct sk_buff *) head, head->next); head->qlen += list->qlen; } } static inline __attribute__((no_instrument_function)) void skb_queue_splice_init(struct sk_buff_head *list, struct sk_buff_head *head) { if (!skb_queue_empty(list)) { __skb_queue_splice(list, (struct sk_buff *) head, head->next); head->qlen += list->qlen; __skb_queue_head_init(list); } } static inline __attribute__((no_instrument_function)) void skb_queue_splice_tail(const struct sk_buff_head *list, struct sk_buff_head *head) { if (!skb_queue_empty(list)) { __skb_queue_splice(list, head->prev, (struct sk_buff *) head); head->qlen += list->qlen; } } static inline __attribute__((no_instrument_function)) void skb_queue_splice_tail_init(struct sk_buff_head *list, struct sk_buff_head *head) { if (!skb_queue_empty(list)) { __skb_queue_splice(list, head->prev, (struct sk_buff *) head); head->qlen += list->qlen; __skb_queue_head_init(list); } } static inline __attribute__((no_instrument_function)) void __skb_queue_after(struct sk_buff_head *list, struct sk_buff *prev, struct sk_buff *newsk) { __skb_insert(newsk, prev, prev->next, list); } extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) void __skb_queue_before(struct sk_buff_head *list, struct sk_buff *next, struct sk_buff *newsk) { __skb_insert(newsk, next->prev, next, list); } extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); static inline __attribute__((no_instrument_function)) void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { __skb_queue_after(list, (struct sk_buff *)list, newsk); } extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk); static inline __attribute__((no_instrument_function)) void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { __skb_queue_before(list, (struct sk_buff *)list, newsk); } extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) { struct sk_buff *next, *prev; list->qlen--; next = skb->next; prev = skb->prev; skb->next = skb->prev = ((void *)0); next->prev = prev; prev->next = next; } extern struct sk_buff *skb_dequeue(struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) struct sk_buff *__skb_dequeue(struct sk_buff_head *list) { struct sk_buff *skb = skb_peek(list); if (skb) __skb_unlink(skb, list); return skb; } extern struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) { struct sk_buff *skb = skb_peek_tail(list); if (skb) __skb_unlink(skb, list); return skb; } static inline __attribute__((no_instrument_function)) bool skb_is_nonlinear(const struct sk_buff *skb) { return skb->data_len; } static inline __attribute__((no_instrument_function)) unsigned int skb_headlen(const struct sk_buff *skb) { return skb->len - skb->data_len; } static inline __attribute__((no_instrument_function)) int skb_pagelen(const struct sk_buff *skb) { int i, len = 0; for (i = (int)((struct skb_shared_info *)(skb_end_pointer(skb)))->nr_frags - 1; i >= 0; i--) len += skb_frag_size(&((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[i]); return len + skb_headlen(skb); } static inline __attribute__((no_instrument_function)) void __skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size) { skb_frag_t *frag = &((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[i]; frag->page.p = page; frag->page_offset = off; skb_frag_size_set(frag, size); } static inline __attribute__((no_instrument_function)) void skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size) { __skb_fill_page_desc(skb, i, page, off, size); ((struct skb_shared_info *)(skb_end_pointer(skb)))->nr_frags = i + 1; } extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, int size, unsigned int truesize); static inline __attribute__((no_instrument_function)) unsigned char *skb_tail_pointer(const struct sk_buff *skb) { return skb->head + skb->tail; } static inline __attribute__((no_instrument_function)) void skb_reset_tail_pointer(struct sk_buff *skb) { skb->tail = skb->data - skb->head; } static inline __attribute__((no_instrument_function)) void skb_set_tail_pointer(struct sk_buff *skb, const int offset) { skb_reset_tail_pointer(skb); skb->tail += offset; } extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp = skb_tail_pointer(skb); do { if (ldv__builtin_expect(!!(skb_is_nonlinear(skb)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (1296), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); skb->tail += len; skb->len += len; return tmp; } extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; skb->len += len; return skb->data; } extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) { skb->len -= len; do { if (ldv__builtin_expect(!!(skb->len < skb->data_len), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (1314), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return skb->data += len; } static inline __attribute__((no_instrument_function)) unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) { return ldv__builtin_expect(!!(len > skb->len), 0) ? ((void *)0) : __skb_pull(skb, len); } extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); static inline __attribute__((no_instrument_function)) unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) { if (len > skb_headlen(skb) && !__pskb_pull_tail(skb, len - skb_headlen(skb))) return ((void *)0); skb->len -= len; return skb->data += len; } static inline __attribute__((no_instrument_function)) unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) { return ldv__builtin_expect(!!(len > skb->len), 0) ? ((void *)0) : __pskb_pull(skb, len); } static inline __attribute__((no_instrument_function)) int pskb_may_pull(struct sk_buff *skb, unsigned int len) { if (ldv__builtin_expect(!!(len <= skb_headlen(skb)), 1)) return 1; if (ldv__builtin_expect(!!(len > skb->len), 0)) return 0; return __pskb_pull_tail(skb, len - skb_headlen(skb)) != ((void *)0); } static inline __attribute__((no_instrument_function)) unsigned int skb_headroom(const struct sk_buff *skb) { return skb->data - skb->head; } static inline __attribute__((no_instrument_function)) int skb_tailroom(const struct sk_buff *skb) { return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; } static inline __attribute__((no_instrument_function)) int skb_availroom(const struct sk_buff *skb) { return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; } static inline __attribute__((no_instrument_function)) void skb_reserve(struct sk_buff *skb, int len) { skb->data += len; skb->tail += len; } static inline __attribute__((no_instrument_function)) void skb_reset_mac_len(struct sk_buff *skb) { skb->mac_len = skb->network_header - skb->mac_header; } static inline __attribute__((no_instrument_function)) unsigned char *skb_transport_header(const struct sk_buff *skb) { return skb->head + skb->transport_header; } static inline __attribute__((no_instrument_function)) void skb_reset_transport_header(struct sk_buff *skb) { skb->transport_header = skb->data - skb->head; } static inline __attribute__((no_instrument_function)) void skb_set_transport_header(struct sk_buff *skb, const int offset) { skb_reset_transport_header(skb); skb->transport_header += offset; } static inline __attribute__((no_instrument_function)) unsigned char *skb_network_header(const struct sk_buff *skb) { return skb->head + skb->network_header; } static inline __attribute__((no_instrument_function)) void skb_reset_network_header(struct sk_buff *skb) { skb->network_header = skb->data - skb->head; } static inline __attribute__((no_instrument_function)) void skb_set_network_header(struct sk_buff *skb, const int offset) { skb_reset_network_header(skb); skb->network_header += offset; } static inline __attribute__((no_instrument_function)) unsigned char *skb_mac_header(const struct sk_buff *skb) { return skb->head + skb->mac_header; } static inline __attribute__((no_instrument_function)) int skb_mac_header_was_set(const struct sk_buff *skb) { return skb->mac_header != ~0U; } static inline __attribute__((no_instrument_function)) void skb_reset_mac_header(struct sk_buff *skb) { skb->mac_header = skb->data - skb->head; } static inline __attribute__((no_instrument_function)) void skb_set_mac_header(struct sk_buff *skb, const int offset) { skb_reset_mac_header(skb); skb->mac_header += offset; } static inline __attribute__((no_instrument_function)) void skb_mac_header_rebuild(struct sk_buff *skb) { if (skb_mac_header_was_set(skb)) { const unsigned char *old_mac = skb_mac_header(skb); skb_set_mac_header(skb, -skb->mac_len); memmove(skb_mac_header(skb), old_mac, skb->mac_len); } } static inline __attribute__((no_instrument_function)) int skb_checksum_start_offset(const struct sk_buff *skb) { return skb->csum_start - skb_headroom(skb); } static inline __attribute__((no_instrument_function)) int skb_transport_offset(const struct sk_buff *skb) { return skb_transport_header(skb) - skb->data; } static inline __attribute__((no_instrument_function)) u32 skb_network_header_len(const struct sk_buff *skb) { return skb->transport_header - skb->network_header; } static inline __attribute__((no_instrument_function)) int skb_network_offset(const struct sk_buff *skb) { return skb_network_header(skb) - skb->data; } static inline __attribute__((no_instrument_function)) int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) { return pskb_may_pull(skb, skb_network_offset(skb) + len); } extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) void __skb_trim(struct sk_buff *skb, unsigned int len) { if (ldv__builtin_expect(!!(skb_is_nonlinear(skb)), 0)) { ({ int __ret_warn_on = !!(1); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/skbuff.h", 1598); ldv__builtin_expect(!!(__ret_warn_on), 0); }); return; } skb->len = len; skb_set_tail_pointer(skb, len); } extern void skb_trim(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) int __pskb_trim(struct sk_buff *skb, unsigned int len) { if (skb->data_len) return ___pskb_trim(skb, len); __skb_trim(skb, len); return 0; } static inline __attribute__((no_instrument_function)) int pskb_trim(struct sk_buff *skb, unsigned int len) { return (len < skb->len) ? __pskb_trim(skb, len) : 0; } static inline __attribute__((no_instrument_function)) void pskb_trim_unique(struct sk_buff *skb, unsigned int len) { int err = pskb_trim(skb, len); do { if (ldv__builtin_expect(!!(err), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/skbuff.h"), "i" (1632), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); } static inline __attribute__((no_instrument_function)) void skb_orphan(struct sk_buff *skb) { if (skb->destructor) skb->destructor(skb); skb->destructor = ((void *)0); skb->sk = ((void *)0); } extern void skb_queue_purge(struct sk_buff_head *list); static inline __attribute__((no_instrument_function)) void __skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; while ((skb = __skb_dequeue(list)) != ((void *)0)) kfree_skb(skb); } static inline __attribute__((no_instrument_function)) struct sk_buff *__dev_alloc_skb(unsigned int length, gfp_t gfp_mask) { struct sk_buff *skb = alloc_skb(length + ({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }), gfp_mask); if (ldv__builtin_expect(!!(skb), 1)) skb_reserve(skb, ({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; })); return skb; } extern struct sk_buff *dev_alloc_skb(unsigned int length); extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask); static inline __attribute__((no_instrument_function)) struct sk_buff *netdev_alloc_skb(struct net_device *dev, unsigned int length) { return __netdev_alloc_skb(dev, length, ((( gfp_t)0x20u))); } static inline __attribute__((no_instrument_function)) struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length, gfp_t gfp) { struct sk_buff *skb = __netdev_alloc_skb(dev, length + 0, gfp); if (0 && skb) skb_reserve(skb, 0); return skb; } static inline __attribute__((no_instrument_function)) struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length) { return __netdev_alloc_skb_ip_align(dev, length, ((( gfp_t)0x20u))); } static inline __attribute__((no_instrument_function)) struct page *skb_frag_page(const skb_frag_t *frag) { return frag->page.p; } static inline __attribute__((no_instrument_function)) void __skb_frag_ref(skb_frag_t *frag) { get_page(skb_frag_page(frag)); } static inline __attribute__((no_instrument_function)) void skb_frag_ref(struct sk_buff *skb, int f) { __skb_frag_ref(&((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[f]); } static inline __attribute__((no_instrument_function)) void __skb_frag_unref(skb_frag_t *frag) { put_page(skb_frag_page(frag)); } static inline __attribute__((no_instrument_function)) void skb_frag_unref(struct sk_buff *skb, int f) { __skb_frag_unref(&((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[f]); } static inline __attribute__((no_instrument_function)) void *skb_frag_address(const skb_frag_t *frag) { return lowmem_page_address(skb_frag_page(frag)) + frag->page_offset; } static inline __attribute__((no_instrument_function)) void *skb_frag_address_safe(const skb_frag_t *frag) { void *ptr = lowmem_page_address(skb_frag_page(frag)); if (ldv__builtin_expect(!!(!ptr), 0)) return ((void *)0); return ptr + frag->page_offset; } static inline __attribute__((no_instrument_function)) void __skb_frag_set_page(skb_frag_t *frag, struct page *page) { frag->page.p = page; } static inline __attribute__((no_instrument_function)) void skb_frag_set_page(struct sk_buff *skb, int f, struct page *page) { __skb_frag_set_page(&((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[f], page); } static inline __attribute__((no_instrument_function)) dma_addr_t skb_frag_dma_map(struct device *dev, const skb_frag_t *frag, size_t offset, size_t size, enum dma_data_direction dir) { return dma_map_page(dev, skb_frag_page(frag), frag->page_offset + offset, size, dir); } static inline __attribute__((no_instrument_function)) struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) { return __pskb_copy(skb, skb_headroom(skb), gfp_mask); } static inline __attribute__((no_instrument_function)) int skb_clone_writable(const struct sk_buff *skb, unsigned int len) { return !skb_header_cloned(skb) && skb_headroom(skb) + len <= skb->hdr_len; } static inline __attribute__((no_instrument_function)) int __skb_cow(struct sk_buff *skb, unsigned int headroom, int cloned) { int delta = 0; if (headroom < ({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; })) headroom = ({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }); if (headroom > skb_headroom(skb)) delta = headroom - skb_headroom(skb); if (delta || cloned) return pskb_expand_head(skb, ((((delta)) + ((typeof((delta)))((({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }))) - 1)) & ~((typeof((delta)))((({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; }))) - 1)), 0, ((( gfp_t)0x20u))); return 0; } static inline __attribute__((no_instrument_function)) int skb_cow(struct sk_buff *skb, unsigned int headroom) { return __skb_cow(skb, headroom, skb_cloned(skb)); } static inline __attribute__((no_instrument_function)) int skb_cow_head(struct sk_buff *skb, unsigned int headroom) { return __skb_cow(skb, headroom, skb_header_cloned(skb)); } static inline __attribute__((no_instrument_function)) int skb_padto(struct sk_buff *skb, unsigned int len) { unsigned int size = skb->len; if (ldv__builtin_expect(!!(size >= len), 1)) return 0; return skb_pad(skb, len - size); } static inline __attribute__((no_instrument_function)) int skb_add_data(struct sk_buff *skb, char *from, int copy) { const int off = skb->len; if (skb->ip_summed == 0) { int err = 0; __wsum csum = csum_partial_copy_from_user(from, skb_put(skb, copy), copy, 0, &err); if (!err) { skb->csum = csum_block_add(skb->csum, csum, off); return 0; } } else if (!copy_from_user(skb_put(skb, copy), from, copy)) return 0; __skb_trim(skb, off); return -14; } static inline __attribute__((no_instrument_function)) int skb_can_coalesce(struct sk_buff *skb, int i, const struct page *page, int off) { if (i) { const struct skb_frag_struct *frag = &((struct skb_shared_info *)(skb_end_pointer(skb)))->frags[i - 1]; return page == skb_frag_page(frag) && off == frag->page_offset + skb_frag_size(frag); } return 0; } static inline __attribute__((no_instrument_function)) int __skb_linearize(struct sk_buff *skb) { return __pskb_pull_tail(skb, skb->data_len) ? 0 : -12; } static inline __attribute__((no_instrument_function)) int skb_linearize(struct sk_buff *skb) { return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0; } static inline __attribute__((no_instrument_function)) int skb_linearize_cow(struct sk_buff *skb) { return skb_is_nonlinear(skb) || skb_cloned(skb) ? __skb_linearize(skb) : 0; } static inline __attribute__((no_instrument_function)) void skb_postpull_rcsum(struct sk_buff *skb, const void *start, unsigned int len) { if (skb->ip_summed == 2) skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); } unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); static inline __attribute__((no_instrument_function)) int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) { if (ldv__builtin_expect(!!(len >= skb->len), 1)) return 0; if (skb->ip_summed == 2) skb->ip_summed = 0; return __pskb_trim(skb, len); } static inline __attribute__((no_instrument_function)) bool skb_has_frag_list(const struct sk_buff *skb) { return ((struct skb_shared_info *)(skb_end_pointer(skb)))->frag_list != ((void *)0); } static inline __attribute__((no_instrument_function)) void skb_frag_list_init(struct sk_buff *skb) { ((struct skb_shared_info *)(skb_end_pointer(skb)))->frag_list = ((void *)0); } static inline __attribute__((no_instrument_function)) void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) { frag->next = ((struct skb_shared_info *)(skb_end_pointer(skb)))->frag_list; ((struct skb_shared_info *)(skb_end_pointer(skb)))->frag_list = frag; } extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, int *peeked, int *off, int *err); extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, int *err); extern unsigned int datagram_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait); extern int skb_copy_datagram_iovec(const struct sk_buff *from, int offset, struct iovec *to, int size); extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen, struct iovec *iov); extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset, const struct iovec *from, int from_offset, int len); extern int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset, const struct iovec *to, int to_offset, int size); extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); extern void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb); extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags); extern __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, __wsum csum); extern int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len); extern int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len); extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to, int len, __wsum csum); extern int skb_splice_bits(struct sk_buff *skb, unsigned int offset, struct pipe_inode_info *pipe, unsigned int len, unsigned int flags); extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); extern void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len); extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); extern struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); static inline __attribute__((no_instrument_function)) void *skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer) { int hlen = skb_headlen(skb); if (hlen - offset >= len) return skb->data + offset; if (skb_copy_bits(skb, offset, buffer, len) < 0) return ((void *)0); return buffer; } static inline __attribute__((no_instrument_function)) void skb_copy_from_linear_data(const struct sk_buff *skb, void *to, const unsigned int len) { ({ size_t __len = (len); void *__ret; if (__builtin_constant_p(len) && __len >= 64) __ret = __memcpy((to), (skb->data), __len); else __ret = __builtin_memcpy((to), (skb->data), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void skb_copy_from_linear_data_offset(const struct sk_buff *skb, const int offset, void *to, const unsigned int len) { ({ size_t __len = (len); void *__ret; if (__builtin_constant_p(len) && __len >= 64) __ret = __memcpy((to), (skb->data + offset), __len); else __ret = __builtin_memcpy((to), (skb->data + offset), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void skb_copy_to_linear_data(struct sk_buff *skb, const void *from, const unsigned int len) { ({ size_t __len = (len); void *__ret; if (__builtin_constant_p(len) && __len >= 64) __ret = __memcpy((skb->data), (from), __len); else __ret = __builtin_memcpy((skb->data), (from), __len); __ret; }); } static inline __attribute__((no_instrument_function)) void skb_copy_to_linear_data_offset(struct sk_buff *skb, const int offset, const void *from, const unsigned int len) { ({ size_t __len = (len); void *__ret; if (__builtin_constant_p(len) && __len >= 64) __ret = __memcpy((skb->data + offset), (from), __len); else __ret = __builtin_memcpy((skb->data + offset), (from), __len); __ret; }); } extern void skb_init(void); static inline __attribute__((no_instrument_function)) ktime_t skb_get_ktime(const struct sk_buff *skb) { return skb->tstamp; } static inline __attribute__((no_instrument_function)) void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) { *stamp = ns_to_timeval((skb->tstamp).tv64); } static inline __attribute__((no_instrument_function)) void skb_get_timestampns(const struct sk_buff *skb, struct timespec *stamp) { *stamp = ns_to_timespec((skb->tstamp).tv64); } static inline __attribute__((no_instrument_function)) void __net_timestamp(struct sk_buff *skb) { skb->tstamp = ktime_get_real(); } static inline __attribute__((no_instrument_function)) ktime_t net_timedelta(ktime_t t) { return ({ (ktime_t){ .tv64 = (ktime_get_real()).tv64 - (t).tv64 }; }); } static inline __attribute__((no_instrument_function)) ktime_t net_invalid_timestamp(void) { return ktime_set(0, 0); } extern void skb_timestamping_init(void); extern void skb_clone_tx_timestamp(struct sk_buff *skb); extern bool skb_defer_rx_timestamp(struct sk_buff *skb); void skb_complete_tx_timestamp(struct sk_buff *skb, struct skb_shared_hwtstamps *hwtstamps); extern void skb_tstamp_tx(struct sk_buff *orig_skb, struct skb_shared_hwtstamps *hwtstamps); static inline __attribute__((no_instrument_function)) void sw_tx_timestamp(struct sk_buff *skb) { if (((struct skb_shared_info *)(skb_end_pointer(skb)))->tx_flags & SKBTX_SW_TSTAMP && !(((struct skb_shared_info *)(skb_end_pointer(skb)))->tx_flags & SKBTX_IN_PROGRESS)) skb_tstamp_tx(skb, ((void *)0)); } static inline __attribute__((no_instrument_function)) void skb_tx_timestamp(struct sk_buff *skb) { skb_clone_tx_timestamp(skb); sw_tx_timestamp(skb); } void skb_complete_wifi_ack(struct sk_buff *skb, bool acked); extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); extern __sum16 __skb_checksum_complete(struct sk_buff *skb); static inline __attribute__((no_instrument_function)) int skb_csum_unnecessary(const struct sk_buff *skb) { return skb->ip_summed & 1; } static inline __attribute__((no_instrument_function)) __sum16 skb_checksum_complete(struct sk_buff *skb) { return skb_csum_unnecessary(skb) ? 0 : __skb_checksum_complete(skb); } extern void nf_conntrack_destroy(struct nf_conntrack *nfct); static inline __attribute__((no_instrument_function)) void nf_conntrack_put(struct nf_conntrack *nfct) { if (nfct && atomic_dec_and_test(&nfct->use)) nf_conntrack_destroy(nfct); } static inline __attribute__((no_instrument_function)) void nf_conntrack_get(struct nf_conntrack *nfct) { if (nfct) atomic_inc(&nfct->use); } static inline __attribute__((no_instrument_function)) void nf_conntrack_get_reasm(struct sk_buff *skb) { if (skb) atomic_inc(&skb->users); } static inline __attribute__((no_instrument_function)) void nf_conntrack_put_reasm(struct sk_buff *skb) { if (skb) kfree_skb(skb); } static inline __attribute__((no_instrument_function)) void nf_bridge_put(struct nf_bridge_info *nf_bridge) { if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) kfree(nf_bridge); } static inline __attribute__((no_instrument_function)) void nf_bridge_get(struct nf_bridge_info *nf_bridge) { if (nf_bridge) atomic_inc(&nf_bridge->use); } static inline __attribute__((no_instrument_function)) void nf_reset(struct sk_buff *skb) { nf_conntrack_put(skb->nfct); skb->nfct = ((void *)0); nf_conntrack_put_reasm(skb->nfct_reasm); skb->nfct_reasm = ((void *)0); nf_bridge_put(skb->nf_bridge); skb->nf_bridge = ((void *)0); } static inline __attribute__((no_instrument_function)) void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) { dst->nfct = src->nfct; nf_conntrack_get(src->nfct); dst->nfctinfo = src->nfctinfo; dst->nfct_reasm = src->nfct_reasm; nf_conntrack_get_reasm(src->nfct_reasm); dst->nf_bridge = src->nf_bridge; nf_bridge_get(src->nf_bridge); } static inline __attribute__((no_instrument_function)) void nf_copy(struct sk_buff *dst, const struct sk_buff *src) { nf_conntrack_put(dst->nfct); nf_conntrack_put_reasm(dst->nfct_reasm); nf_bridge_put(dst->nf_bridge); __nf_copy(dst, src); } static inline __attribute__((no_instrument_function)) void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) { to->secmark = from->secmark; } static inline __attribute__((no_instrument_function)) void skb_init_secmark(struct sk_buff *skb) { skb->secmark = 0; } static inline __attribute__((no_instrument_function)) void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) { skb->queue_mapping = queue_mapping; } static inline __attribute__((no_instrument_function)) u16 skb_get_queue_mapping(const struct sk_buff *skb) { return skb->queue_mapping; } static inline __attribute__((no_instrument_function)) void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from) { to->queue_mapping = from->queue_mapping; } static inline __attribute__((no_instrument_function)) void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) { skb->queue_mapping = rx_queue + 1; } static inline __attribute__((no_instrument_function)) u16 skb_get_rx_queue(const struct sk_buff *skb) { return skb->queue_mapping - 1; } static inline __attribute__((no_instrument_function)) bool skb_rx_queue_recorded(const struct sk_buff *skb) { return skb->queue_mapping != 0; } extern u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, unsigned int num_tx_queues); static inline __attribute__((no_instrument_function)) struct sec_path *skb_sec_path(struct sk_buff *skb) { return skb->sp; } static inline __attribute__((no_instrument_function)) bool skb_is_gso(const struct sk_buff *skb) { return ((struct skb_shared_info *)(skb_end_pointer(skb)))->gso_size; } static inline __attribute__((no_instrument_function)) bool skb_is_gso_v6(const struct sk_buff *skb) { return ((struct skb_shared_info *)(skb_end_pointer(skb)))->gso_type & SKB_GSO_TCPV6; } extern void __skb_warn_lro_forwarding(const struct sk_buff *skb); static inline __attribute__((no_instrument_function)) bool skb_warn_if_lro(const struct sk_buff *skb) { const struct skb_shared_info *shinfo = ((struct skb_shared_info *)(skb_end_pointer(skb))); if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && ldv__builtin_expect(!!(shinfo->gso_type == 0), 0)) { __skb_warn_lro_forwarding(skb); return true; } return false; } static inline __attribute__((no_instrument_function)) void skb_forward_csum(struct sk_buff *skb) { if (skb->ip_summed == 2) skb->ip_summed = 0; } static inline __attribute__((no_instrument_function)) void skb_checksum_none_assert(const struct sk_buff *skb) { } bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); static inline __attribute__((no_instrument_function)) bool skb_is_recycleable(const struct sk_buff *skb, int skb_size) { if (({ unsigned long _flags; do { ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); _flags = arch_local_save_flags(); } while (0); ({ ({ unsigned long __dummy; typeof(_flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_irqs_disabled_flags(_flags); }); })) return false; if (((struct skb_shared_info *)(skb_end_pointer(skb)))->tx_flags & SKBTX_DEV_ZEROCOPY) return false; if (skb_is_nonlinear(skb) || skb->fclone != SKB_FCLONE_UNAVAILABLE) return false; skb_size = (((skb_size + ({ typeof(32) _max1 = (32); typeof((1 << (6))) _max2 = ((1 << (6))); (void) (&_max1 == &_max2); _max1 > _max2 ? _max1 : _max2; })) + ((1 << (6)) - 1)) & ~((1 << (6)) - 1)); if (skb_end_pointer(skb) - skb->head < skb_size) return false; if (skb_shared(skb) || skb_cloned(skb)) return false; return true; } static inline __attribute__((no_instrument_function)) struct ethhdr *eth_hdr(const struct sk_buff *skb) { return (struct ethhdr *)skb_mac_header(skb); } int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); int mac_pton(const char *s, u8 *mac); extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); typedef struct { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } sync_serial_settings; typedef struct { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } te1_settings; typedef struct { unsigned short encoding; unsigned short parity; } raw_hdlc_proto; typedef struct { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } fr_proto; typedef struct { unsigned int dlci; } fr_proto_pvc; typedef struct { unsigned int dlci; char master[16]; }fr_proto_pvc_info; typedef struct { unsigned int interval; unsigned int timeout; } cisco_proto; enum { IF_OPER_UNKNOWN, IF_OPER_NOTPRESENT, IF_OPER_DOWN, IF_OPER_LOWERLAYERDOWN, IF_OPER_TESTING, IF_OPER_DORMANT, IF_OPER_UP, }; enum { IF_LINK_MODE_DEFAULT, IF_LINK_MODE_DORMANT, }; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; }; struct if_settings { unsigned int type; unsigned int size; union { raw_hdlc_proto *raw_hdlc; cisco_proto *cisco; fr_proto *fr; fr_proto_pvc *fr_pvc; fr_proto_pvc_info *fr_pvc_info; sync_serial_settings *sync; te1_settings *te1; } ifs_ifsu; }; struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; void * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; struct ifconf { int ifc_len; union { char *ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; }; struct sockaddr_pkt { unsigned short spkt_family; unsigned char spkt_device[14]; __be16 spkt_protocol; }; struct sockaddr_ll { unsigned short sll_family; __be16 sll_protocol; int sll_ifindex; unsigned short sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }; struct tpacket_stats { unsigned int tp_packets; unsigned int tp_drops; }; struct tpacket_stats_v3 { unsigned int tp_packets; unsigned int tp_drops; unsigned int tp_freeze_q_cnt; }; union tpacket_stats_u { struct tpacket_stats stats1; struct tpacket_stats_v3 stats3; }; struct tpacket_auxdata { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u16 tp_vlan_tci; __u16 tp_padding; }; struct tpacket_hdr { unsigned long tp_status; unsigned int tp_len; unsigned int tp_snaplen; unsigned short tp_mac; unsigned short tp_net; unsigned int tp_sec; unsigned int tp_usec; }; struct tpacket2_hdr { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u32 tp_sec; __u32 tp_nsec; __u16 tp_vlan_tci; __u16 tp_padding; }; struct tpacket_hdr_variant1 { __u32 tp_rxhash; __u32 tp_vlan_tci; }; struct tpacket3_hdr { __u32 tp_next_offset; __u32 tp_sec; __u32 tp_nsec; __u32 tp_snaplen; __u32 tp_len; __u32 tp_status; __u16 tp_mac; __u16 tp_net; union { struct tpacket_hdr_variant1 hv1; }; }; struct tpacket_bd_ts { unsigned int ts_sec; union { unsigned int ts_usec; unsigned int ts_nsec; }; }; struct tpacket_hdr_v1 { __u32 block_status; __u32 num_pkts; __u32 offset_to_first_pkt; __u32 blk_len; __u64 __attribute__((aligned(8))) seq_num; struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; }; union tpacket_bd_header_u { struct tpacket_hdr_v1 bh1; }; struct tpacket_block_desc { __u32 version; __u32 offset_to_priv; union tpacket_bd_header_u hdr; }; enum tpacket_versions { TPACKET_V1, TPACKET_V2, TPACKET_V3 }; struct tpacket_req { unsigned int tp_block_size; unsigned int tp_block_nr; unsigned int tp_frame_size; unsigned int tp_frame_nr; }; struct tpacket_req3 { unsigned int tp_block_size; unsigned int tp_block_nr; unsigned int tp_frame_size; unsigned int tp_frame_nr; unsigned int tp_retire_blk_tov; unsigned int tp_sizeof_priv; unsigned int tp_feature_req_word; }; union tpacket_req_u { struct tpacket_req req; struct tpacket_req3 req3; }; struct packet_mreq { int mr_ifindex; unsigned short mr_type; unsigned short mr_alen; unsigned char mr_address[8]; }; struct sockaddr_nl { __kernel_sa_family_t nl_family; unsigned short nl_pad; __u32 nl_pid; __u32 nl_groups; }; struct nlmsghdr { __u32 nlmsg_len; __u16 nlmsg_type; __u16 nlmsg_flags; __u32 nlmsg_seq; __u32 nlmsg_pid; }; struct nlmsgerr { int error; struct nlmsghdr msg; }; struct nl_pktinfo { __u32 group; }; enum { NETLINK_UNCONNECTED = 0, NETLINK_CONNECTED, }; struct nlattr { __u16 nla_len; __u16 nla_type; }; struct net; static inline __attribute__((no_instrument_function)) struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) { return (struct nlmsghdr *)skb->data; } struct netlink_skb_parms { struct ucred creds; __u32 pid; __u32 dst_group; }; extern void netlink_table_grab(void); extern void netlink_table_ungrab(void); extern struct sock *netlink_kernel_create(struct net *net, int unit,unsigned int groups, void (*input)(struct sk_buff *skb), struct mutex *cb_mutex, struct module *module); extern void netlink_kernel_release(struct sock *sk); extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group); extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); extern int netlink_has_listeners(struct sock *sk, unsigned int group); extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, __u32 group, gfp_t allocation); extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, __u32 pid, __u32 group, gfp_t allocation, int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), void *filter_data); extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); extern int netlink_register_notifier(struct notifier_block *nb); extern int netlink_unregister_notifier(struct notifier_block *nb); struct sock *netlink_getsockbyfilp(struct file *filp); int netlink_attachskb(struct sock *sk, struct sk_buff *skb, long *timeo, struct sock *ssk); void netlink_detachskb(struct sock *sk, struct sk_buff *skb); int netlink_sendskb(struct sock *sk, struct sk_buff *skb); struct netlink_callback { struct sk_buff *skb; const struct nlmsghdr *nlh; int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); int (*done)(struct netlink_callback *cb); void *data; u16 family; u16 min_dump_alloc; unsigned int prev_seq, seq; long args[6]; }; struct netlink_notify { struct net *net; int pid; int protocol; }; struct nlmsghdr * __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); struct netlink_dump_control { int (*dump)(struct sk_buff *skb, struct netlink_callback *); int (*done)(struct netlink_callback*); void *data; u16 min_dump_alloc; }; extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, const struct nlmsghdr *nlh, struct netlink_dump_control *control); extern void netlink_set_nonroot(int protocol, unsigned flag); struct rtnl_link_stats { __u32 rx_packets; __u32 tx_packets; __u32 rx_bytes; __u32 tx_bytes; __u32 rx_errors; __u32 tx_errors; __u32 rx_dropped; __u32 tx_dropped; __u32 multicast; __u32 collisions; __u32 rx_length_errors; __u32 rx_over_errors; __u32 rx_crc_errors; __u32 rx_frame_errors; __u32 rx_fifo_errors; __u32 rx_missed_errors; __u32 tx_aborted_errors; __u32 tx_carrier_errors; __u32 tx_fifo_errors; __u32 tx_heartbeat_errors; __u32 tx_window_errors; __u32 rx_compressed; __u32 tx_compressed; }; struct rtnl_link_stats64 { __u64 rx_packets; __u64 tx_packets; __u64 rx_bytes; __u64 tx_bytes; __u64 rx_errors; __u64 tx_errors; __u64 rx_dropped; __u64 tx_dropped; __u64 multicast; __u64 collisions; __u64 rx_length_errors; __u64 rx_over_errors; __u64 rx_crc_errors; __u64 rx_frame_errors; __u64 rx_fifo_errors; __u64 rx_missed_errors; __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; __u64 rx_compressed; __u64 tx_compressed; }; struct rtnl_link_ifmap { __u64 mem_start; __u64 mem_end; __u64 base_addr; __u16 irq; __u8 dma; __u8 port; }; enum { IFLA_UNSPEC, IFLA_ADDRESS, IFLA_BROADCAST, IFLA_IFNAME, IFLA_MTU, IFLA_LINK, IFLA_QDISC, IFLA_STATS, IFLA_COST, IFLA_PRIORITY, IFLA_MASTER, IFLA_WIRELESS, IFLA_PROTINFO, IFLA_TXQLEN, IFLA_MAP, IFLA_WEIGHT, IFLA_OPERSTATE, IFLA_LINKMODE, IFLA_LINKINFO, IFLA_NET_NS_PID, IFLA_IFALIAS, IFLA_NUM_VF, IFLA_VFINFO_LIST, IFLA_STATS64, IFLA_VF_PORTS, IFLA_PORT_SELF, IFLA_AF_SPEC, IFLA_GROUP, IFLA_NET_NS_FD, IFLA_EXT_MASK, __IFLA_MAX }; enum { IFLA_INET_UNSPEC, IFLA_INET_CONF, __IFLA_INET_MAX, }; enum { IFLA_INET6_UNSPEC, IFLA_INET6_FLAGS, IFLA_INET6_CONF, IFLA_INET6_STATS, IFLA_INET6_MCAST, IFLA_INET6_CACHEINFO, IFLA_INET6_ICMP6STATS, __IFLA_INET6_MAX }; struct ifla_cacheinfo { __u32 max_reasm_len; __u32 tstamp; __u32 reachable_time; __u32 retrans_time; }; enum { IFLA_INFO_UNSPEC, IFLA_INFO_KIND, IFLA_INFO_DATA, IFLA_INFO_XSTATS, __IFLA_INFO_MAX, }; enum { IFLA_VLAN_UNSPEC, IFLA_VLAN_ID, IFLA_VLAN_FLAGS, IFLA_VLAN_EGRESS_QOS, IFLA_VLAN_INGRESS_QOS, __IFLA_VLAN_MAX, }; struct ifla_vlan_flags { __u32 flags; __u32 mask; }; enum { IFLA_VLAN_QOS_UNSPEC, IFLA_VLAN_QOS_MAPPING, __IFLA_VLAN_QOS_MAX }; struct ifla_vlan_qos_mapping { __u32 from; __u32 to; }; enum { IFLA_MACVLAN_UNSPEC, IFLA_MACVLAN_MODE, __IFLA_MACVLAN_MAX, }; enum macvlan_mode { MACVLAN_MODE_PRIVATE = 1, MACVLAN_MODE_VEPA = 2, MACVLAN_MODE_BRIDGE = 4, MACVLAN_MODE_PASSTHRU = 8, }; enum { IFLA_VF_INFO_UNSPEC, IFLA_VF_INFO, __IFLA_VF_INFO_MAX, }; enum { IFLA_VF_UNSPEC, IFLA_VF_MAC, IFLA_VF_VLAN, IFLA_VF_TX_RATE, IFLA_VF_SPOOFCHK, __IFLA_VF_MAX, }; struct ifla_vf_mac { __u32 vf; __u8 mac[32]; }; struct ifla_vf_vlan { __u32 vf; __u32 vlan; __u32 qos; }; struct ifla_vf_tx_rate { __u32 vf; __u32 rate; }; struct ifla_vf_spoofchk { __u32 vf; __u32 setting; }; struct ifla_vf_info { __u32 vf; __u8 mac[32]; __u32 vlan; __u32 qos; __u32 tx_rate; __u32 spoofchk; }; enum { IFLA_VF_PORT_UNSPEC, IFLA_VF_PORT, __IFLA_VF_PORT_MAX, }; enum { IFLA_PORT_UNSPEC, IFLA_PORT_VF, IFLA_PORT_PROFILE, IFLA_PORT_VSI_TYPE, IFLA_PORT_INSTANCE_UUID, IFLA_PORT_HOST_UUID, IFLA_PORT_REQUEST, IFLA_PORT_RESPONSE, __IFLA_PORT_MAX, }; enum { PORT_REQUEST_PREASSOCIATE = 0, PORT_REQUEST_PREASSOCIATE_RR, PORT_REQUEST_ASSOCIATE, PORT_REQUEST_DISASSOCIATE, }; enum { PORT_VDP_RESPONSE_SUCCESS = 0, PORT_VDP_RESPONSE_INVALID_FORMAT, PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, PORT_VDP_RESPONSE_UNUSED_VTID, PORT_VDP_RESPONSE_VTID_VIOLATION, PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, PORT_VDP_RESPONSE_OUT_OF_SYNC, PORT_PROFILE_RESPONSE_SUCCESS = 0x100, PORT_PROFILE_RESPONSE_INPROGRESS, PORT_PROFILE_RESPONSE_INVALID, PORT_PROFILE_RESPONSE_BADSTATE, PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, PORT_PROFILE_RESPONSE_ERROR, }; struct ifla_port_vsi { __u8 vsi_mgr_id; __u8 vsi_type_id[3]; __u8 vsi_type_version; __u8 pad[3]; }; struct device; struct miscdevice { int minor; const char *name; const struct file_operations *fops; struct list_head list; struct device *parent; struct device *this_device; const char *nodename; umode_t mode; }; extern int misc_register(struct miscdevice * misc); extern int misc_deregister(struct miscdevice *misc); enum { PM_QOS_RESERVED = 0, PM_QOS_CPU_DMA_LATENCY, PM_QOS_NETWORK_LATENCY, PM_QOS_NETWORK_THROUGHPUT, PM_QOS_NUM_CLASSES, }; struct pm_qos_request { struct plist_node node; int pm_qos_class; struct delayed_work work; }; struct dev_pm_qos_request { struct plist_node node; struct device *dev; }; enum pm_qos_type { PM_QOS_UNITIALIZED, PM_QOS_MAX, PM_QOS_MIN }; struct pm_qos_constraints { struct plist_head list; s32 target_value; s32 default_value; enum pm_qos_type type; struct blocking_notifier_head *notifiers; }; enum pm_qos_req_action { PM_QOS_ADD_REQ, PM_QOS_UPDATE_REQ, PM_QOS_REMOVE_REQ }; static inline __attribute__((no_instrument_function)) int dev_pm_qos_request_active(struct dev_pm_qos_request *req) { return req->dev != 0; } int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, enum pm_qos_req_action action, int value); void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, s32 value); void pm_qos_update_request(struct pm_qos_request *req, s32 new_value); void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value, unsigned long timeout_us); void pm_qos_remove_request(struct pm_qos_request *req); int pm_qos_request(int pm_qos_class); int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); int pm_qos_request_active(struct pm_qos_request *req); s32 pm_qos_read_value(struct pm_qos_constraints *c); s32 __dev_pm_qos_read_value(struct device *dev); s32 dev_pm_qos_read_value(struct device *dev); int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, s32 value); int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier); int dev_pm_qos_remove_notifier(struct device *dev, struct notifier_block *notifier); int dev_pm_qos_add_global_notifier(struct notifier_block *notifier); int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); void dev_pm_qos_constraints_init(struct device *dev); void dev_pm_qos_constraints_destroy(struct device *dev); int dev_pm_qos_add_ancestor_request(struct device *dev, struct dev_pm_qos_request *req, s32 value); int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); void dev_pm_qos_hide_latency_limit(struct device *dev); struct dql { unsigned int num_queued; unsigned int adj_limit; unsigned int last_obj_cnt; unsigned int limit __attribute__((__aligned__((1 << (6))))); unsigned int num_completed; unsigned int prev_ovlimit; unsigned int prev_num_queued; unsigned int prev_last_obj_cnt; unsigned int lowest_slack; unsigned long slack_start_time; unsigned int max_limit; unsigned int min_limit; unsigned int slack_hold_time; }; static inline __attribute__((no_instrument_function)) void dql_queued(struct dql *dql, unsigned int count) { do { if (ldv__builtin_expect(!!(count > ((~0U) / 16)), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/dynamic_queue_limits.h"), "i" (74), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); dql->num_queued += count; dql->last_obj_cnt = count; } static inline __attribute__((no_instrument_function)) int dql_avail(const struct dql *dql) { return dql->adj_limit - dql->num_queued; } void dql_completed(struct dql *dql, unsigned int count); void dql_reset(struct dql *dql); int dql_init(struct dql *dql, unsigned hold_time); struct user_i387_ia32_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20]; }; struct user32_fxsr_struct { unsigned short cwd; unsigned short swd; unsigned short twd; unsigned short fop; int fip; int fcs; int foo; int fos; int mxcsr; int reserved; int st_space[32]; int xmm_space[32]; int padding[56]; }; struct user_regs_struct32 { __u32 ebx, ecx, edx, esi, edi, ebp, eax; unsigned short ds, __ds, es, __es; unsigned short fs, __fs, gs, __gs; __u32 orig_eax, eip; unsigned short cs, __cs; __u32 eflags, esp; unsigned short ss, __ss; }; struct user32 { struct user_regs_struct32 regs; int u_fpvalid; struct user_i387_ia32_struct i387; __u32 u_tsize; __u32 u_dsize; __u32 u_ssize; __u32 start_code; __u32 start_stack; __u32 signal; int reserved; __u32 u_ar0; __u32 u_fpstate; __u32 magic; char u_comm[32]; int u_debugreg[8]; }; typedef u32 compat_size_t; typedef s32 compat_ssize_t; typedef s32 compat_time_t; typedef s32 compat_clock_t; typedef s32 compat_pid_t; typedef u16 __compat_uid_t; typedef u16 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; typedef u32 compat_ino_t; typedef u16 compat_dev_t; typedef s32 compat_off_t; typedef s64 compat_loff_t; typedef u16 compat_nlink_t; typedef u16 compat_ipc_pid_t; typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; typedef s32 compat_timer_t; typedef s32 compat_key_t; typedef s32 compat_int_t; typedef s32 compat_long_t; typedef s64 __attribute__((aligned(4))) compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 __attribute__((aligned(4))) compat_u64; struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; }; struct compat_timeval { compat_time_t tv_sec; s32 tv_usec; }; struct compat_stat { compat_dev_t st_dev; u16 __pad1; compat_ino_t st_ino; compat_mode_t st_mode; compat_nlink_t st_nlink; __compat_uid_t st_uid; __compat_gid_t st_gid; compat_dev_t st_rdev; u16 __pad2; u32 st_size; u32 st_blksize; u32 st_blocks; u32 st_atime; u32 st_atime_nsec; u32 st_mtime; u32 st_mtime_nsec; u32 st_ctime; u32 st_ctime_nsec; u32 __unused4; u32 __unused5; }; struct compat_flock { short l_type; short l_whence; compat_off_t l_start; compat_off_t l_len; compat_pid_t l_pid; }; struct compat_flock64 { short l_type; short l_whence; compat_loff_t l_start; compat_loff_t l_len; compat_pid_t l_pid; } __attribute__((packed)); struct compat_statfs { int f_type; int f_bsize; int f_blocks; int f_bfree; int f_bavail; int f_files; int f_ffree; compat_fsid_t f_fsid; int f_namelen; int f_frsize; int f_flags; int f_spare[4]; }; typedef u32 compat_old_sigset_t; typedef u32 compat_sigset_word; struct compat_ipc64_perm { compat_key_t key; __compat_uid32_t uid; __compat_gid32_t gid; __compat_uid32_t cuid; __compat_gid32_t cgid; unsigned short mode; unsigned short __pad1; unsigned short seq; unsigned short __pad2; compat_ulong_t unused1; compat_ulong_t unused2; }; struct compat_semid64_ds { struct compat_ipc64_perm sem_perm; compat_time_t sem_otime; compat_ulong_t __unused1; compat_time_t sem_ctime; compat_ulong_t __unused2; compat_ulong_t sem_nsems; compat_ulong_t __unused3; compat_ulong_t __unused4; }; struct compat_msqid64_ds { struct compat_ipc64_perm msg_perm; compat_time_t msg_stime; compat_ulong_t __unused1; compat_time_t msg_rtime; compat_ulong_t __unused2; compat_time_t msg_ctime; compat_ulong_t __unused3; compat_ulong_t msg_cbytes; compat_ulong_t msg_qnum; compat_ulong_t msg_qbytes; compat_pid_t msg_lspid; compat_pid_t msg_lrpid; compat_ulong_t __unused4; compat_ulong_t __unused5; }; struct compat_shmid64_ds { struct compat_ipc64_perm shm_perm; compat_size_t shm_segsz; compat_time_t shm_atime; compat_ulong_t __unused1; compat_time_t shm_dtime; compat_ulong_t __unused2; compat_time_t shm_ctime; compat_ulong_t __unused3; compat_pid_t shm_cpid; compat_pid_t shm_lpid; compat_ulong_t shm_nattch; compat_ulong_t __unused4; compat_ulong_t __unused5; }; typedef struct user_regs_struct32 compat_elf_gregset_t; typedef u32 compat_uptr_t; static inline __attribute__((no_instrument_function)) void *compat_ptr(compat_uptr_t uptr) { return (void *)(unsigned long)uptr; } static inline __attribute__((no_instrument_function)) compat_uptr_t ptr_to_compat(void *uptr) { return (u32)(unsigned long)uptr; } static inline __attribute__((no_instrument_function)) void *arch_compat_alloc_user_space(long len) { compat_uptr_t sp; if (test_ti_thread_flag(current_thread_info(), 17)) { sp = ((struct pt_regs *)(get_current())->thread.sp0 - 1)->sp; } else { sp = ({ typeof(old_rsp) pfo_ret__; switch (sizeof(old_rsp)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (old_rsp)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (old_rsp)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (old_rsp)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (old_rsp)); break; default: __bad_percpu_size(); } pfo_ret__; }) - 128; } return (void *)((sp - len) & ~((__typeof__(sp - len))((16)-1))); } static inline __attribute__((no_instrument_function)) bool is_x32_task(void) { return false; } static inline __attribute__((no_instrument_function)) bool is_compat_task(void) { return is_ia32_task() || is_x32_task(); } typedef __compat_uid32_t compat_uid_t; typedef __compat_gid32_t compat_gid_t; struct compat_sel_arg_struct; struct rusage; struct compat_itimerspec { struct compat_timespec it_interval; struct compat_timespec it_value; }; struct compat_utimbuf { compat_time_t actime; compat_time_t modtime; }; struct compat_itimerval { struct compat_timeval it_interval; struct compat_timeval it_value; }; struct compat_tms { compat_clock_t tms_utime; compat_clock_t tms_stime; compat_clock_t tms_cutime; compat_clock_t tms_cstime; }; struct compat_timex { compat_uint_t modes; compat_long_t offset; compat_long_t freq; compat_long_t maxerror; compat_long_t esterror; compat_int_t status; compat_long_t constant; compat_long_t precision; compat_long_t tolerance; struct compat_timeval time; compat_long_t tick; compat_long_t ppsfreq; compat_long_t jitter; compat_int_t shift; compat_long_t stabil; compat_long_t jitcnt; compat_long_t calcnt; compat_long_t errcnt; compat_long_t stbcnt; compat_int_t tai; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; }; typedef struct { compat_sigset_word sig[(64 / 32)]; } compat_sigset_t; extern int get_compat_timespec(struct timespec *, const struct compat_timespec *); extern int put_compat_timespec(const struct timespec *, struct compat_timespec *); extern int get_compat_timeval(struct timeval *, const struct compat_timeval *); extern int put_compat_timeval(const struct timeval *, struct compat_timeval *); extern int compat_get_timespec(struct timespec *, const void *); extern int compat_put_timespec(const struct timespec *, void *); extern int compat_get_timeval(struct timeval *, const void *); extern int compat_put_timeval(const struct timeval *, void *); struct compat_iovec { compat_uptr_t iov_base; compat_size_t iov_len; }; struct compat_rlimit { compat_ulong_t rlim_cur; compat_ulong_t rlim_max; }; struct compat_rusage { struct compat_timeval ru_utime; struct compat_timeval ru_stime; compat_long_t ru_maxrss; compat_long_t ru_ixrss; compat_long_t ru_idrss; compat_long_t ru_isrss; compat_long_t ru_minflt; compat_long_t ru_majflt; compat_long_t ru_nswap; compat_long_t ru_inblock; compat_long_t ru_oublock; compat_long_t ru_msgsnd; compat_long_t ru_msgrcv; compat_long_t ru_nsignals; compat_long_t ru_nvcsw; compat_long_t ru_nivcsw; }; extern int put_compat_rusage(const struct rusage *, struct compat_rusage *); struct compat_siginfo; extern long compat_sys_waitid(int, compat_pid_t, struct compat_siginfo *, int, struct compat_rusage *); struct compat_dirent { u32 d_ino; compat_off_t d_off; u16 d_reclen; char d_name[256]; }; struct compat_ustat { compat_daddr_t f_tfree; compat_ino_t f_tinode; char f_fname[6]; char f_fpack[6]; }; typedef union compat_sigval { compat_int_t sival_int; compat_uptr_t sival_ptr; } compat_sigval_t; typedef struct compat_sigevent { compat_sigval_t sigev_value; compat_int_t sigev_signo; compat_int_t sigev_notify; union { compat_int_t _pad[((64/sizeof(int)) - 3)]; compat_int_t _tid; struct { compat_uptr_t _function; compat_uptr_t _attribute; } _sigev_thread; } _sigev_un; } compat_sigevent_t; struct compat_ifmap { compat_ulong_t mem_start; compat_ulong_t mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; }; struct compat_if_settings { unsigned int type; unsigned int size; compat_uptr_t ifs_ifsu; }; struct compat_ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; compat_int_t ifru_ivalue; compat_int_t ifru_mtu; struct compat_ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; compat_caddr_t ifru_data; struct compat_if_settings ifru_settings; } ifr_ifru; }; struct compat_ifconf { compat_int_t ifc_len; compat_caddr_t ifcbuf; }; struct compat_robust_list { compat_uptr_t next; }; struct compat_robust_list_head { struct compat_robust_list list; compat_long_t futex_offset; compat_uptr_t list_op_pending; }; struct compat_statfs; struct compat_statfs64; struct compat_old_linux_dirent; struct compat_linux_dirent; struct linux_dirent64; struct compat_msghdr; struct compat_mmsghdr; struct compat_sysinfo; struct compat_sysctl_args; struct compat_kexec_segment; struct compat_mq_attr; struct compat_msgbuf; extern void compat_exit_robust_list(struct task_struct *curr); long compat_sys_set_robust_list(struct compat_robust_list_head *head, compat_size_t len); long compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr, compat_size_t *len_ptr); long compat_sys_semctl(int first, int second, int third, void *uptr); long compat_sys_msgsnd(int first, int second, int third, void *uptr); long compat_sys_msgrcv(int first, int second, int msgtyp, int third, int version, void *uptr); long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, void *uptr); long compat_sys_msgctl(int first, int second, void *uptr); long compat_sys_shmctl(int first, int second, void *uptr); long compat_sys_semtimedop(int semid, struct sembuf *tsems, unsigned nsems, const struct compat_timespec *timeout); long compat_sys_keyctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5); long compat_sys_ustat(unsigned dev, struct compat_ustat *u32); ssize_t compat_sys_readv(unsigned long fd, const struct compat_iovec *vec, unsigned long vlen); ssize_t compat_sys_writev(unsigned long fd, const struct compat_iovec *vec, unsigned long vlen); ssize_t compat_sys_preadv(unsigned long fd, const struct compat_iovec *vec, unsigned long vlen, u32 pos_low, u32 pos_high); ssize_t compat_sys_pwritev(unsigned long fd, const struct compat_iovec *vec, unsigned long vlen, u32 pos_low, u32 pos_high); int compat_do_execve(char *filename, compat_uptr_t *argv, compat_uptr_t *envp, struct pt_regs *regs); long compat_sys_select(int n, compat_ulong_t *inp, compat_ulong_t *outp, compat_ulong_t *exp, struct compat_timeval *tvp); long compat_sys_old_select(struct compat_sel_arg_struct *arg); long compat_sys_wait4(compat_pid_t pid, compat_uint_t *stat_addr, int options, struct compat_rusage *ru); long compat_get_bitmap(unsigned long *mask, const compat_ulong_t *umask, unsigned long bitmap_size); long compat_put_bitmap(compat_ulong_t *umask, unsigned long *mask, unsigned long bitmap_size); int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo *from); int copy_siginfo_to_user32(struct compat_siginfo *to, siginfo_t *from); int get_compat_sigevent(struct sigevent *event, const struct compat_sigevent *u_event); long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, struct compat_siginfo *uinfo); static inline __attribute__((no_instrument_function)) int compat_timeval_compare(struct compat_timeval *lhs, struct compat_timeval *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; if (lhs->tv_sec > rhs->tv_sec) return 1; return lhs->tv_usec - rhs->tv_usec; } static inline __attribute__((no_instrument_function)) int compat_timespec_compare(struct compat_timespec *lhs, struct compat_timespec *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; if (lhs->tv_sec > rhs->tv_sec) return 1; return lhs->tv_nsec - rhs->tv_nsec; } extern int get_compat_itimerspec(struct itimerspec *dst, const struct compat_itimerspec *src); extern int put_compat_itimerspec(struct compat_itimerspec *dst, const struct itimerspec *src); long compat_sys_gettimeofday(struct compat_timeval *tv, struct timezone *tz); long compat_sys_settimeofday(struct compat_timeval *tv, struct timezone *tz); long compat_sys_adjtimex(struct compat_timex *utp); extern int compat_printk(const char *fmt, ...); extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); long compat_sys_migrate_pages(compat_pid_t pid, compat_ulong_t maxnode, const compat_ulong_t *old_nodes, const compat_ulong_t *new_nodes); extern int compat_ptrace_request(struct task_struct *child, compat_long_t request, compat_ulong_t addr, compat_ulong_t data); extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, compat_ulong_t addr, compat_ulong_t data); long compat_sys_ptrace(compat_long_t request, compat_long_t pid, compat_long_t addr, compat_long_t data); struct epoll_event; long compat_sys_epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout, const compat_sigset_t *sigmask, compat_size_t sigsetsize); long compat_sys_utime(const char *filename, struct compat_utimbuf *t); long compat_sys_utimensat(unsigned int dfd, const char *filename, struct compat_timespec *t, int flags); long compat_sys_time(compat_time_t *tloc); long compat_sys_stime(compat_time_t *tptr); long compat_sys_signalfd(int ufd, const compat_sigset_t *sigmask, compat_size_t sigsetsize); long compat_sys_timerfd_settime(int ufd, int flags, const struct compat_itimerspec *utmr, struct compat_itimerspec *otmr); long compat_sys_timerfd_gettime(int ufd, struct compat_itimerspec *otmr); long compat_sys_move_pages(pid_t pid, unsigned long nr_page, __u32 *pages, const int *nodes, int *status, int flags); long compat_sys_futimesat(unsigned int dfd, const char *filename, struct compat_timeval *t); long compat_sys_utimes(const char *filename, struct compat_timeval *t); long compat_sys_newstat(const char *filename, struct compat_stat *statbuf); long compat_sys_newlstat(const char *filename, struct compat_stat *statbuf); long compat_sys_newfstatat(unsigned int dfd, const char *filename, struct compat_stat *statbuf, int flag); long compat_sys_newfstat(unsigned int fd, struct compat_stat *statbuf); long compat_sys_statfs(const char *pathname, struct compat_statfs *buf); long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf); long compat_sys_statfs64(const char *pathname, compat_size_t sz, struct compat_statfs64 *buf); long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 *buf); long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg); long compat_sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); long compat_sys_io_setup(unsigned nr_reqs, u32 *ctx32p); long compat_sys_io_getevents(aio_context_t ctx_id, unsigned long min_nr, unsigned long nr, struct io_event *events, struct compat_timespec *timeout); long compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 *iocb); long compat_sys_mount(const char *dev_name, const char *dir_name, const char *type, unsigned long flags, const void *data); long compat_sys_old_readdir(unsigned int fd, struct compat_old_linux_dirent *, unsigned int count); long compat_sys_getdents(unsigned int fd, struct compat_linux_dirent *dirent, unsigned int count); long compat_sys_getdents64(unsigned int fd, struct linux_dirent64 *dirent, unsigned int count); long compat_sys_vmsplice(int fd, const struct compat_iovec *, unsigned int nr_segs, unsigned int flags); long compat_sys_open(const char *filename, int flags, umode_t mode); long compat_sys_openat(unsigned int dfd, const char *filename, int flags, umode_t mode); long compat_sys_open_by_handle_at(int mountdirfd, struct file_handle *handle, int flags); long compat_sys_pselect6(int n, compat_ulong_t *inp, compat_ulong_t *outp, compat_ulong_t *exp, struct compat_timespec *tsp, void *sig); long compat_sys_ppoll(struct pollfd *ufds, unsigned int nfds, struct compat_timespec *tsp, const compat_sigset_t *sigmask, compat_size_t sigsetsize); long compat_sys_signalfd4(int ufd, const compat_sigset_t *sigmask, compat_size_t sigsetsize, int flags); long compat_sys_get_mempolicy(int *policy, compat_ulong_t *nmask, compat_ulong_t maxnode, compat_ulong_t addr, compat_ulong_t flags); long compat_sys_set_mempolicy(int mode, compat_ulong_t *nmask, compat_ulong_t maxnode); long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, compat_ulong_t mode, compat_ulong_t *nmask, compat_ulong_t maxnode, compat_ulong_t flags); long compat_sys_setsockopt(int fd, int level, int optname, char *optval, unsigned int optlen); long compat_sys_sendmsg(int fd, struct compat_msghdr *msg, unsigned flags); long compat_sys_sendmmsg(int fd, struct compat_mmsghdr *mmsg, unsigned vlen, unsigned int flags); long compat_sys_recvmsg(int fd, struct compat_msghdr *msg, unsigned int flags); long compat_sys_recv(int fd, void *buf, size_t len, unsigned flags); long compat_sys_recvfrom(int fd, void *buf, size_t len, unsigned flags, struct sockaddr *addr, int *addrlen); long compat_sys_recvmmsg(int fd, struct compat_mmsghdr *mmsg, unsigned vlen, unsigned int flags, struct compat_timespec *timeout); long compat_sys_nanosleep(struct compat_timespec *rqtp, struct compat_timespec *rmtp); long compat_sys_getitimer(int which, struct compat_itimerval *it); long compat_sys_setitimer(int which, struct compat_itimerval *in, struct compat_itimerval *out); long compat_sys_times(struct compat_tms *tbuf); long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit *rlim); long compat_sys_getrlimit(unsigned int resource, struct compat_rlimit *rlim); long compat_sys_getrusage(int who, struct compat_rusage *ru); long compat_sys_sched_setaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t *user_mask_ptr); long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t *user_mask_ptr); long compat_sys_timer_create(clockid_t which_clock, struct compat_sigevent *timer_event_spec, timer_t *created_timer_id); long compat_sys_timer_settime(timer_t timer_id, int flags, struct compat_itimerspec *new, struct compat_itimerspec *old); long compat_sys_timer_gettime(timer_t timer_id, struct compat_itimerspec *setting); long compat_sys_clock_settime(clockid_t which_clock, struct compat_timespec *tp); long compat_sys_clock_gettime(clockid_t which_clock, struct compat_timespec *tp); long compat_sys_clock_adjtime(clockid_t which_clock, struct compat_timex *tp); long compat_sys_clock_getres(clockid_t which_clock, struct compat_timespec *tp); long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, struct compat_timespec *rqtp, struct compat_timespec *rmtp); long compat_sys_rt_sigtimedwait(compat_sigset_t *uthese, struct compat_siginfo *uinfo, struct compat_timespec *uts, compat_size_t sigsetsize); long compat_sys_rt_sigsuspend(compat_sigset_t *unewset, compat_size_t sigsetsize); long compat_sys_sysinfo(struct compat_sysinfo *info); long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); long compat_sys_futex(u32 *uaddr, int op, u32 val, struct compat_timespec *utime, u32 *uaddr2, u32 val3); long compat_sys_getsockopt(int fd, int level, int optname, char *optval, int *optlen); long compat_sys_kexec_load(unsigned long entry, unsigned long nr_segments, struct compat_kexec_segment *, unsigned long flags); long compat_sys_mq_getsetattr(mqd_t mqdes, const struct compat_mq_attr *u_mqstat, struct compat_mq_attr *u_omqstat); long compat_sys_mq_notify(mqd_t mqdes, const struct compat_sigevent *u_notification); long compat_sys_mq_open(const char *u_name, int oflag, compat_mode_t mode, struct compat_mq_attr *u_attr); long compat_sys_mq_timedsend(mqd_t mqdes, const char *u_msg_ptr, size_t msg_len, unsigned int msg_prio, const struct compat_timespec *u_abs_timeout); ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, char *u_msg_ptr, size_t msg_len, unsigned int *u_msg_prio, const struct compat_timespec *u_abs_timeout); long compat_sys_socketcall(int call, u32 *args); long compat_sys_sysctl(struct compat_sysctl_args *args); extern ssize_t compat_rw_copy_check_uvector(int type, const struct compat_iovec *uvector, unsigned long nr_segs, unsigned long fast_segs, struct iovec *fast_pointer, struct iovec **ret_pointer, int check_access); extern void *compat_alloc_user_space(unsigned long len); ssize_t compat_sys_process_vm_readv(compat_pid_t pid, const struct compat_iovec *lvec, unsigned long liovcnt, const struct compat_iovec *rvec, unsigned long riovcnt, unsigned long flags); ssize_t compat_sys_process_vm_writev(compat_pid_t pid, const struct compat_iovec *lvec, unsigned long liovcnt, const struct compat_iovec *rvec, unsigned long riovcnt, unsigned long flags); struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u8 mdio_support; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u8 eth_tp_mdix; __u8 reserved2; __u32 lp_advertising; __u32 reserved[2]; }; static inline __attribute__((no_instrument_function)) void ethtool_cmd_speed_set(struct ethtool_cmd *ep, __u32 speed) { ep->speed = (__u16)speed; ep->speed_hi = (__u16)(speed >> 16); } static inline __attribute__((no_instrument_function)) __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { return (ep->speed_hi << 16) | ep->speed; } struct ethtool_drvinfo { __u32 cmd; char driver[32]; char version[32]; char fw_version[32]; char bus_info[32]; char reserved1[32]; char reserved2[12]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; }; struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[6]; }; struct ethtool_value { __u32 cmd; __u32 data; }; struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0]; }; struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0]; }; struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; }; struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; }; struct ethtool_channels { __u32 cmd; __u32 max_rx; __u32 max_tx; __u32 max_other; __u32 max_combined; __u32 rx_count; __u32 tx_count; __u32 other_count; __u32 combined_count; }; struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; }; enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, ETH_SS_PRIV_FLAGS, ETH_SS_NTUPLE_FILTERS, ETH_SS_FEATURES, }; struct ethtool_gstrings { __u32 cmd; __u32 string_set; __u32 len; __u8 data[0]; }; struct ethtool_sset_info { __u32 cmd; __u32 reserved; __u64 sset_mask; __u32 data[0]; }; enum ethtool_test_flags { ETH_TEST_FL_OFFLINE = (1 << 0), ETH_TEST_FL_FAILED = (1 << 1), ETH_TEST_FL_EXTERNAL_LB = (1 << 2), ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), }; struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0]; }; struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0]; }; struct ethtool_perm_addr { __u32 cmd; __u32 size; __u8 data[0]; }; enum ethtool_flags { ETH_FLAG_TXVLAN = (1 << 7), ETH_FLAG_RXVLAN = (1 << 8), ETH_FLAG_LRO = (1 << 15), ETH_FLAG_NTUPLE = (1 << 27), ETH_FLAG_RXHASH = (1 << 28), }; struct ethtool_tcpip4_spec { __be32 ip4src; __be32 ip4dst; __be16 psrc; __be16 pdst; __u8 tos; }; struct ethtool_ah_espip4_spec { __be32 ip4src; __be32 ip4dst; __be32 spi; __u8 tos; }; struct ethtool_usrip4_spec { __be32 ip4src; __be32 ip4dst; __be32 l4_4_bytes; __u8 tos; __u8 ip_ver; __u8 proto; }; union ethtool_flow_union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[60]; }; struct ethtool_flow_ext { __be16 vlan_etype; __be16 vlan_tci; __be32 data[2]; }; struct ethtool_rx_flow_spec { __u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; __u64 ring_cookie; __u32 location; }; struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; struct ethtool_rx_flow_spec fs; __u32 rule_cnt; __u32 rule_locs[0]; }; struct compat_ethtool_rx_flow_spec { u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; compat_u64 ring_cookie; u32 location; }; struct compat_ethtool_rxnfc { u32 cmd; u32 flow_type; compat_u64 data; struct compat_ethtool_rx_flow_spec fs; u32 rule_cnt; u32 rule_locs[0]; }; struct ethtool_rxfh_indir { __u32 cmd; __u32 size; __u32 ring_index[0]; }; struct ethtool_rx_ntuple_flow_spec { __u32 flow_type; union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[72]; } h_u, m_u; __u16 vlan_tag; __u16 vlan_tag_mask; __u64 data; __u64 data_mask; __s32 action; }; struct ethtool_rx_ntuple { __u32 cmd; struct ethtool_rx_ntuple_flow_spec fs; }; enum ethtool_flash_op_type { ETHTOOL_FLASH_ALL_REGIONS = 0, }; struct ethtool_flash { __u32 cmd; __u32 region; char data[128]; }; struct ethtool_dump { __u32 cmd; __u32 version; __u32 flag; __u32 len; __u8 data[0]; }; struct ethtool_get_features_block { __u32 available; __u32 requested; __u32 active; __u32 never_changed; }; struct ethtool_gfeatures { __u32 cmd; __u32 size; struct ethtool_get_features_block features[0]; }; struct ethtool_set_features_block { __u32 valid; __u32 requested; }; struct ethtool_sfeatures { __u32 cmd; __u32 size; struct ethtool_set_features_block features[0]; }; enum ethtool_sfeatures_retval_bits { ETHTOOL_F_UNSUPPORTED__BIT, ETHTOOL_F_WISH__BIT, ETHTOOL_F_COMPAT__BIT, }; extern int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); enum ethtool_phys_id_state { ETHTOOL_ID_INACTIVE, ETHTOOL_ID_ACTIVE, ETHTOOL_ID_ON, ETHTOOL_ID_OFF }; struct net_device; u32 ethtool_op_get_link(struct net_device *dev); static inline __attribute__((no_instrument_function)) u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings) { return index % n_rx_rings; } struct ethtool_ops { int (*get_settings)(struct net_device *, struct ethtool_cmd *); int (*set_settings)(struct net_device *, struct ethtool_cmd *); void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); int (*get_regs_len)(struct net_device *); void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); u32 (*get_msglevel)(struct net_device *); void (*set_msglevel)(struct net_device *, u32); int (*nway_reset)(struct net_device *); u32 (*get_link)(struct net_device *); int (*get_eeprom_len)(struct net_device *); int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); void (*get_strings)(struct net_device *, u32 stringset, u8 *); int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); int (*begin)(struct net_device *); void (*complete)(struct net_device *); u32 (*get_priv_flags)(struct net_device *); int (*set_priv_flags)(struct net_device *, u32); int (*get_sset_count)(struct net_device *, int); int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, u32 *rule_locs); int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); int (*flash_device)(struct net_device *, struct ethtool_flash *); int (*reset)(struct net_device *, u32 *); u32 (*get_rxfh_indir_size)(struct net_device *); int (*get_rxfh_indir)(struct net_device *, u32 *); int (*set_rxfh_indir)(struct net_device *, const u32 *); void (*get_channels)(struct net_device *, struct ethtool_channels *); int (*set_channels)(struct net_device *, struct ethtool_channels *); int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); int (*get_dump_data)(struct net_device *, struct ethtool_dump *, void *); int (*set_dump)(struct net_device *, struct ethtool_dump *); }; enum ethtool_reset_flags { ETH_RESET_MGMT = 1 << 0, ETH_RESET_IRQ = 1 << 1, ETH_RESET_DMA = 1 << 2, ETH_RESET_FILTER = 1 << 3, ETH_RESET_OFFLOAD = 1 << 4, ETH_RESET_MAC = 1 << 5, ETH_RESET_PHY = 1 << 6, ETH_RESET_RAM = 1 << 7, ETH_RESET_DEDICATED = 0x0000ffff, ETH_RESET_ALL = 0xffffffff, }; struct ctl_table_header; struct prot_inuse; struct netns_core { struct ctl_table_header *sysctl_hdr; int sysctl_somaxconn; struct prot_inuse *inuse; }; enum { IPSTATS_MIB_NUM = 0, IPSTATS_MIB_INPKTS, IPSTATS_MIB_INHDRERRORS, IPSTATS_MIB_INTOOBIGERRORS, IPSTATS_MIB_INNOROUTES, IPSTATS_MIB_INADDRERRORS, IPSTATS_MIB_INUNKNOWNPROTOS, IPSTATS_MIB_INTRUNCATEDPKTS, IPSTATS_MIB_INDISCARDS, IPSTATS_MIB_INDELIVERS, IPSTATS_MIB_OUTFORWDATAGRAMS, IPSTATS_MIB_OUTPKTS, IPSTATS_MIB_OUTDISCARDS, IPSTATS_MIB_OUTNOROUTES, IPSTATS_MIB_REASMTIMEOUT, IPSTATS_MIB_REASMREQDS, IPSTATS_MIB_REASMOKS, IPSTATS_MIB_REASMFAILS, IPSTATS_MIB_FRAGOKS, IPSTATS_MIB_FRAGFAILS, IPSTATS_MIB_FRAGCREATES, IPSTATS_MIB_INMCASTPKTS, IPSTATS_MIB_OUTMCASTPKTS, IPSTATS_MIB_INBCASTPKTS, IPSTATS_MIB_OUTBCASTPKTS, IPSTATS_MIB_INOCTETS, IPSTATS_MIB_OUTOCTETS, IPSTATS_MIB_INMCASTOCTETS, IPSTATS_MIB_OUTMCASTOCTETS, IPSTATS_MIB_INBCASTOCTETS, IPSTATS_MIB_OUTBCASTOCTETS, __IPSTATS_MIB_MAX }; enum { ICMP_MIB_NUM = 0, ICMP_MIB_INMSGS, ICMP_MIB_INERRORS, ICMP_MIB_INDESTUNREACHS, ICMP_MIB_INTIMEEXCDS, ICMP_MIB_INPARMPROBS, ICMP_MIB_INSRCQUENCHS, ICMP_MIB_INREDIRECTS, ICMP_MIB_INECHOS, ICMP_MIB_INECHOREPS, ICMP_MIB_INTIMESTAMPS, ICMP_MIB_INTIMESTAMPREPS, ICMP_MIB_INADDRMASKS, ICMP_MIB_INADDRMASKREPS, ICMP_MIB_OUTMSGS, ICMP_MIB_OUTERRORS, ICMP_MIB_OUTDESTUNREACHS, ICMP_MIB_OUTTIMEEXCDS, ICMP_MIB_OUTPARMPROBS, ICMP_MIB_OUTSRCQUENCHS, ICMP_MIB_OUTREDIRECTS, ICMP_MIB_OUTECHOS, ICMP_MIB_OUTECHOREPS, ICMP_MIB_OUTTIMESTAMPS, ICMP_MIB_OUTTIMESTAMPREPS, ICMP_MIB_OUTADDRMASKS, ICMP_MIB_OUTADDRMASKREPS, __ICMP_MIB_MAX }; enum { ICMP6_MIB_NUM = 0, ICMP6_MIB_INMSGS, ICMP6_MIB_INERRORS, ICMP6_MIB_OUTMSGS, ICMP6_MIB_OUTERRORS, __ICMP6_MIB_MAX }; enum { TCP_MIB_NUM = 0, TCP_MIB_RTOALGORITHM, TCP_MIB_RTOMIN, TCP_MIB_RTOMAX, TCP_MIB_MAXCONN, TCP_MIB_ACTIVEOPENS, TCP_MIB_PASSIVEOPENS, TCP_MIB_ATTEMPTFAILS, TCP_MIB_ESTABRESETS, TCP_MIB_CURRESTAB, TCP_MIB_INSEGS, TCP_MIB_OUTSEGS, TCP_MIB_RETRANSSEGS, TCP_MIB_INERRS, TCP_MIB_OUTRSTS, __TCP_MIB_MAX }; enum { UDP_MIB_NUM = 0, UDP_MIB_INDATAGRAMS, UDP_MIB_NOPORTS, UDP_MIB_INERRORS, UDP_MIB_OUTDATAGRAMS, UDP_MIB_RCVBUFERRORS, UDP_MIB_SNDBUFERRORS, __UDP_MIB_MAX }; enum { LINUX_MIB_NUM = 0, LINUX_MIB_SYNCOOKIESSENT, LINUX_MIB_SYNCOOKIESRECV, LINUX_MIB_SYNCOOKIESFAILED, LINUX_MIB_EMBRYONICRSTS, LINUX_MIB_PRUNECALLED, LINUX_MIB_RCVPRUNED, LINUX_MIB_OFOPRUNED, LINUX_MIB_OUTOFWINDOWICMPS, LINUX_MIB_LOCKDROPPEDICMPS, LINUX_MIB_ARPFILTER, LINUX_MIB_TIMEWAITED, LINUX_MIB_TIMEWAITRECYCLED, LINUX_MIB_TIMEWAITKILLED, LINUX_MIB_PAWSPASSIVEREJECTED, LINUX_MIB_PAWSACTIVEREJECTED, LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_DELAYEDACKS, LINUX_MIB_DELAYEDACKLOCKED, LINUX_MIB_DELAYEDACKLOST, LINUX_MIB_LISTENOVERFLOWS, LINUX_MIB_LISTENDROPS, LINUX_MIB_TCPPREQUEUED, LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG, LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE, LINUX_MIB_TCPPREQUEUEDROPPED, LINUX_MIB_TCPHPHITS, LINUX_MIB_TCPHPHITSTOUSER, LINUX_MIB_TCPPUREACKS, LINUX_MIB_TCPHPACKS, LINUX_MIB_TCPRENORECOVERY, LINUX_MIB_TCPSACKRECOVERY, LINUX_MIB_TCPSACKRENEGING, LINUX_MIB_TCPFACKREORDER, LINUX_MIB_TCPSACKREORDER, LINUX_MIB_TCPRENOREORDER, LINUX_MIB_TCPTSREORDER, LINUX_MIB_TCPFULLUNDO, LINUX_MIB_TCPPARTIALUNDO, LINUX_MIB_TCPDSACKUNDO, LINUX_MIB_TCPLOSSUNDO, LINUX_MIB_TCPLOSTRETRANSMIT, LINUX_MIB_TCPRENOFAILURES, LINUX_MIB_TCPSACKFAILURES, LINUX_MIB_TCPLOSSFAILURES, LINUX_MIB_TCPFASTRETRANS, LINUX_MIB_TCPFORWARDRETRANS, LINUX_MIB_TCPSLOWSTARTRETRANS, LINUX_MIB_TCPTIMEOUTS, LINUX_MIB_TCPRENORECOVERYFAIL, LINUX_MIB_TCPSACKRECOVERYFAIL, LINUX_MIB_TCPSCHEDULERFAILED, LINUX_MIB_TCPRCVCOLLAPSED, LINUX_MIB_TCPDSACKOLDSENT, LINUX_MIB_TCPDSACKOFOSENT, LINUX_MIB_TCPDSACKRECV, LINUX_MIB_TCPDSACKOFORECV, LINUX_MIB_TCPABORTONSYN, LINUX_MIB_TCPABORTONDATA, LINUX_MIB_TCPABORTONCLOSE, LINUX_MIB_TCPABORTONMEMORY, LINUX_MIB_TCPABORTONTIMEOUT, LINUX_MIB_TCPABORTONLINGER, LINUX_MIB_TCPABORTFAILED, LINUX_MIB_TCPMEMORYPRESSURES, LINUX_MIB_TCPSACKDISCARD, LINUX_MIB_TCPDSACKIGNOREDOLD, LINUX_MIB_TCPDSACKIGNOREDNOUNDO, LINUX_MIB_TCPSPURIOUSRTOS, LINUX_MIB_TCPMD5NOTFOUND, LINUX_MIB_TCPMD5UNEXPECTED, LINUX_MIB_SACKSHIFTED, LINUX_MIB_SACKMERGED, LINUX_MIB_SACKSHIFTFALLBACK, LINUX_MIB_TCPBACKLOGDROP, LINUX_MIB_TCPMINTTLDROP, LINUX_MIB_TCPDEFERACCEPTDROP, LINUX_MIB_IPRPFILTER, LINUX_MIB_TCPTIMEWAITOVERFLOW, LINUX_MIB_TCPREQQFULLDOCOOKIES, LINUX_MIB_TCPREQQFULLDROP, LINUX_MIB_TCPRETRANSFAIL, LINUX_MIB_TCPRCVCOALESCE, __LINUX_MIB_MAX }; enum { LINUX_MIB_XFRMNUM = 0, LINUX_MIB_XFRMINERROR, LINUX_MIB_XFRMINBUFFERERROR, LINUX_MIB_XFRMINHDRERROR, LINUX_MIB_XFRMINNOSTATES, LINUX_MIB_XFRMINSTATEPROTOERROR, LINUX_MIB_XFRMINSTATEMODEERROR, LINUX_MIB_XFRMINSTATESEQERROR, LINUX_MIB_XFRMINSTATEEXPIRED, LINUX_MIB_XFRMINSTATEMISMATCH, LINUX_MIB_XFRMINSTATEINVALID, LINUX_MIB_XFRMINTMPLMISMATCH, LINUX_MIB_XFRMINNOPOLS, LINUX_MIB_XFRMINPOLBLOCK, LINUX_MIB_XFRMINPOLERROR, LINUX_MIB_XFRMOUTERROR, LINUX_MIB_XFRMOUTBUNDLEGENERROR, LINUX_MIB_XFRMOUTBUNDLECHECKERROR, LINUX_MIB_XFRMOUTNOSTATES, LINUX_MIB_XFRMOUTSTATEPROTOERROR, LINUX_MIB_XFRMOUTSTATEMODEERROR, LINUX_MIB_XFRMOUTSTATESEQERROR, LINUX_MIB_XFRMOUTSTATEEXPIRED, LINUX_MIB_XFRMOUTPOLBLOCK, LINUX_MIB_XFRMOUTPOLDEAD, LINUX_MIB_XFRMOUTPOLERROR, LINUX_MIB_XFRMFWDHDRERROR, __LINUX_MIB_XFRMMAX }; struct snmp_mib { const char *name; int entry; }; struct u64_stats_sync { }; static inline __attribute__((no_instrument_function)) void u64_stats_update_begin(struct u64_stats_sync *syncp) { } static inline __attribute__((no_instrument_function)) void u64_stats_update_end(struct u64_stats_sync *syncp) { } static inline __attribute__((no_instrument_function)) unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp) { return 0; } static inline __attribute__((no_instrument_function)) bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp, unsigned int start) { return false; } static inline __attribute__((no_instrument_function)) unsigned int u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp) { return 0; } static inline __attribute__((no_instrument_function)) bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp, unsigned int start) { return false; } struct ipstats_mib { u64 mibs[__IPSTATS_MIB_MAX]; struct u64_stats_sync syncp; }; struct icmp_mib { unsigned long mibs[__ICMP_MIB_MAX]; }; struct icmpmsg_mib { atomic_long_t mibs[512]; }; struct icmpv6_mib { unsigned long mibs[__ICMP6_MIB_MAX]; }; struct icmpv6_mib_device { atomic_long_t mibs[__ICMP6_MIB_MAX]; }; struct icmpv6msg_mib { atomic_long_t mibs[512]; }; struct icmpv6msg_mib_device { atomic_long_t mibs[512]; }; struct tcp_mib { unsigned long mibs[__TCP_MIB_MAX]; }; struct udp_mib { unsigned long mibs[__UDP_MIB_MAX]; }; struct linux_mib { unsigned long mibs[__LINUX_MIB_MAX]; }; struct linux_xfrm_mib { unsigned long mibs[__LINUX_MIB_XFRMMAX]; }; struct netns_mib { __typeof__(struct tcp_mib) *tcp_statistics[1]; __typeof__(struct ipstats_mib) *ip_statistics[1]; __typeof__(struct linux_mib) *net_statistics[1]; __typeof__(struct udp_mib) *udp_statistics[1]; __typeof__(struct udp_mib) *udplite_statistics[1]; __typeof__(struct icmp_mib) *icmp_statistics[1]; __typeof__(struct icmpmsg_mib) *icmpmsg_statistics; struct proc_dir_entry *proc_net_devsnmp6; __typeof__(struct udp_mib) *udp_stats_in6[1]; __typeof__(struct udp_mib) *udplite_stats_in6[1]; __typeof__(struct ipstats_mib) *ipv6_statistics[1]; __typeof__(struct icmpv6_mib) *icmpv6_statistics[1]; __typeof__(struct icmpv6msg_mib) *icmpv6msg_statistics; __typeof__(struct linux_xfrm_mib) *xfrm_statistics[1]; }; struct ctl_table_header; struct netns_unix { int sysctl_max_dgram_qlen; struct ctl_table_header *ctl; }; struct netns_packet { spinlock_t sklist_lock; struct hlist_head sklist; }; struct netns_frags { int nqueues; atomic_t mem; struct list_head lru_list; int timeout; int high_thresh; int low_thresh; }; struct inet_frag_queue { struct hlist_node list; struct netns_frags *net; struct list_head lru_list; spinlock_t lock; atomic_t refcnt; struct timer_list timer; struct sk_buff *fragments; struct sk_buff *fragments_tail; ktime_t stamp; int len; int meat; __u8 last_in; }; struct inet_frags { struct hlist_head hash[64]; rwlock_t lock; u32 rnd; int qsize; int secret_interval; struct timer_list secret_timer; unsigned int (*hashfn)(struct inet_frag_queue *); void (*constructor)(struct inet_frag_queue *q, void *arg); void (*destructor)(struct inet_frag_queue *); void (*skb_free)(struct sk_buff *); int (*match)(struct inet_frag_queue *q, void *arg); void (*frag_expire)(unsigned long data); }; void inet_frags_init(struct inet_frags *); void inet_frags_fini(struct inet_frags *); void inet_frags_init_net(struct netns_frags *nf); void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f, int *work); int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, struct inet_frags *f, void *key, unsigned int hash) ; static inline __attribute__((no_instrument_function)) void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) { if (atomic_dec_and_test(&q->refcnt)) inet_frag_destroy(q, f, ((void *)0)); } struct ctl_table_header; struct ipv4_devconf; struct fib_rules_ops; struct hlist_head; struct sock; struct netns_ipv4 { struct ctl_table_header *forw_hdr; struct ctl_table_header *frags_hdr; struct ctl_table_header *ipv4_hdr; struct ctl_table_header *route_hdr; struct ipv4_devconf *devconf_all; struct ipv4_devconf *devconf_dflt; struct fib_rules_ops *rules_ops; struct hlist_head *fib_table_hash; struct sock *fibnl; struct sock **icmp_sk; struct sock *tcp_sock; struct netns_frags frags; struct xt_table *iptable_filter; struct xt_table *iptable_mangle; struct xt_table *iptable_raw; struct xt_table *arptable_filter; struct xt_table *iptable_security; struct xt_table *nat_table; struct hlist_head *nat_bysource; unsigned int nat_htable_size; int sysctl_icmp_echo_ignore_all; int sysctl_icmp_echo_ignore_broadcasts; int sysctl_icmp_ignore_bogus_error_responses; int sysctl_icmp_ratelimit; int sysctl_icmp_ratemask; int sysctl_icmp_errors_use_inbound_ifaddr; int sysctl_rt_cache_rebuild_count; int current_rt_cache_rebuild_count; unsigned int sysctl_ping_group_range[2]; long sysctl_tcp_mem[3]; atomic_t rt_genid; atomic_t dev_addr_genid; struct list_head mr_tables; struct fib_rules_ops *mr_rules_ops; }; struct dst_entry; struct kmem_cachep; struct net_device; struct sk_buff; struct dst_ops { unsigned short family; __be16 protocol; unsigned gc_thresh; int (*gc)(struct dst_ops *ops); struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); unsigned int (*default_advmss)(const struct dst_entry *); unsigned int (*mtu)(const struct dst_entry *); u32 * (*cow_metrics)(struct dst_entry *, unsigned long); void (*destroy)(struct dst_entry *); void (*ifdown)(struct dst_entry *, struct net_device *dev, int how); struct dst_entry * (*negative_advice)(struct dst_entry *); void (*link_failure)(struct sk_buff *); void (*update_pmtu)(struct dst_entry *dst, u32 mtu); int (*local_out)(struct sk_buff *skb); struct neighbour * (*neigh_lookup)(const struct dst_entry *dst, const void *daddr); struct kmem_cache *kmem_cachep; struct percpu_counter pcpuc_entries __attribute__((__aligned__((1 << (6))))); }; static inline __attribute__((no_instrument_function)) int dst_entries_get_fast(struct dst_ops *dst) { return percpu_counter_read_positive(&dst->pcpuc_entries); } static inline __attribute__((no_instrument_function)) int dst_entries_get_slow(struct dst_ops *dst) { int res; local_bh_disable(); res = percpu_counter_sum_positive(&dst->pcpuc_entries); local_bh_enable(); return res; } static inline __attribute__((no_instrument_function)) void dst_entries_add(struct dst_ops *dst, int val) { local_bh_disable(); percpu_counter_add(&dst->pcpuc_entries, val); local_bh_enable(); } static inline __attribute__((no_instrument_function)) int dst_entries_init(struct dst_ops *dst) { return ({ static struct lock_class_key __key; __percpu_counter_init(&dst->pcpuc_entries, 0, &__key); }); } static inline __attribute__((no_instrument_function)) void dst_entries_destroy(struct dst_ops *dst) { percpu_counter_destroy(&dst->pcpuc_entries); } struct ctl_table_header; struct netns_sysctl_ipv6 { struct ctl_table_header *table; struct ctl_table_header *frags_hdr; int bindv6only; int flush_delay; int ip6_rt_max_size; int ip6_rt_gc_min_interval; int ip6_rt_gc_timeout; int ip6_rt_gc_interval; int ip6_rt_gc_elasticity; int ip6_rt_mtu_expires; int ip6_rt_min_advmss; int icmpv6_time; }; struct netns_ipv6 { struct netns_sysctl_ipv6 sysctl; struct ipv6_devconf *devconf_all; struct ipv6_devconf *devconf_dflt; struct netns_frags frags; struct xt_table *ip6table_filter; struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; struct xt_table *ip6table_security; struct rt6_info *ip6_null_entry; struct rt6_statistics *rt6_stats; struct timer_list ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; struct dst_ops ip6_dst_ops; unsigned int ip6_rt_gc_expire; unsigned long ip6_rt_last_gc; struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; struct fib6_table *fib6_local_tbl; struct fib_rules_ops *fib6_rules_ops; struct sock **icmp_sk; struct sock *ndisc_sk; struct sock *tcp_sk; struct sock *igmp_sk; struct list_head mr6_tables; struct fib_rules_ops *mr6_rules_ops; }; struct sock; struct netns_dccp { struct sock *v4_ctl_sk; struct sock *v6_ctl_sk; }; enum { IPPROTO_IP = 0, IPPROTO_ICMP = 1, IPPROTO_IGMP = 2, IPPROTO_IPIP = 4, IPPROTO_TCP = 6, IPPROTO_EGP = 8, IPPROTO_PUP = 12, IPPROTO_UDP = 17, IPPROTO_IDP = 22, IPPROTO_DCCP = 33, IPPROTO_RSVP = 46, IPPROTO_GRE = 47, IPPROTO_IPV6 = 41, IPPROTO_ESP = 50, IPPROTO_AH = 51, IPPROTO_BEETPH = 94, IPPROTO_PIM = 103, IPPROTO_COMP = 108, IPPROTO_SCTP = 132, IPPROTO_UDPLITE = 136, IPPROTO_RAW = 255, IPPROTO_MAX }; struct in_addr { __be32 s_addr; }; struct ip_mreq { struct in_addr imr_multiaddr; struct in_addr imr_interface; }; struct ip_mreqn { struct in_addr imr_multiaddr; struct in_addr imr_address; int imr_ifindex; }; struct ip_mreq_source { __be32 imr_multiaddr; __be32 imr_interface; __be32 imr_sourceaddr; }; struct ip_msfilter { __be32 imsf_multiaddr; __be32 imsf_interface; __u32 imsf_fmode; __u32 imsf_numsrc; __be32 imsf_slist[1]; }; struct group_req { __u32 gr_interface; struct __kernel_sockaddr_storage gr_group; }; struct group_source_req { __u32 gsr_interface; struct __kernel_sockaddr_storage gsr_group; struct __kernel_sockaddr_storage gsr_source; }; struct group_filter { __u32 gf_interface; struct __kernel_sockaddr_storage gf_group; __u32 gf_fmode; __u32 gf_numsrc; struct __kernel_sockaddr_storage gf_slist[1]; }; struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; struct sockaddr_in { __kernel_sa_family_t sin_family; __be16 sin_port; struct in_addr sin_addr; unsigned char __pad[16 - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)]; }; static inline __attribute__((no_instrument_function)) int proto_ports_offset(int proto) { switch (proto) { case IPPROTO_TCP: case IPPROTO_UDP: case IPPROTO_DCCP: case IPPROTO_ESP: case IPPROTO_SCTP: case IPPROTO_UDPLITE: return 0; case IPPROTO_AH: return 4; default: return -22; } } static inline __attribute__((no_instrument_function)) bool ipv4_is_loopback(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xff000000))) ? ((__u32)( (((__u32)((0xff000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xff000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xff000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xff000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xff000000))))) == (( __be32)(__builtin_constant_p((__u32)((0x7f000000))) ? ((__u32)( (((__u32)((0x7f000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0x7f000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0x7f000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0x7f000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0x7f000000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_multicast(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xf0000000))) ? ((__u32)( (((__u32)((0xf0000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xf0000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xf0000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xf0000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xf0000000))))) == (( __be32)(__builtin_constant_p((__u32)((0xe0000000))) ? ((__u32)( (((__u32)((0xe0000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xe0000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xe0000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xe0000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xe0000000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_local_multicast(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xffffff00))) ? ((__u32)( (((__u32)((0xffffff00)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xffffff00)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xffffff00)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xffffff00)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xffffff00))))) == (( __be32)(__builtin_constant_p((__u32)((0xe0000000))) ? ((__u32)( (((__u32)((0xe0000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xe0000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xe0000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xe0000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xe0000000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_lbcast(__be32 addr) { return addr == (( __be32)(__builtin_constant_p((__u32)((((unsigned long int) 0xffffffff)))) ? ((__u32)( (((__u32)((((unsigned long int) 0xffffffff))) & (__u32)0x000000ffUL) << 24) | (((__u32)((((unsigned long int) 0xffffffff))) & (__u32)0x0000ff00UL) << 8) | (((__u32)((((unsigned long int) 0xffffffff))) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((((unsigned long int) 0xffffffff))) & (__u32)0xff000000UL) >> 24))) : __fswab32((((unsigned long int) 0xffffffff))))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_zeronet(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xff000000))) ? ((__u32)( (((__u32)((0xff000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xff000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xff000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xff000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xff000000))))) == (( __be32)(__builtin_constant_p((__u32)((0x00000000))) ? ((__u32)( (((__u32)((0x00000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0x00000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0x00000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0x00000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0x00000000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_private_10(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xff000000))) ? ((__u32)( (((__u32)((0xff000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xff000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xff000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xff000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xff000000))))) == (( __be32)(__builtin_constant_p((__u32)((0x0a000000))) ? ((__u32)( (((__u32)((0x0a000000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0x0a000000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0x0a000000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0x0a000000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0x0a000000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_private_172(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xfff00000))) ? ((__u32)( (((__u32)((0xfff00000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xfff00000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xfff00000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xfff00000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xfff00000))))) == (( __be32)(__builtin_constant_p((__u32)((0xac100000))) ? ((__u32)( (((__u32)((0xac100000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xac100000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xac100000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xac100000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xac100000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_private_192(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xffff0000))) ? ((__u32)( (((__u32)((0xffff0000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xffff0000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xffff0000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xffff0000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xffff0000))))) == (( __be32)(__builtin_constant_p((__u32)((0xc0a80000))) ? ((__u32)( (((__u32)((0xc0a80000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xc0a80000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xc0a80000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xc0a80000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xc0a80000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_linklocal_169(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xffff0000))) ? ((__u32)( (((__u32)((0xffff0000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xffff0000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xffff0000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xffff0000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xffff0000))))) == (( __be32)(__builtin_constant_p((__u32)((0xa9fe0000))) ? ((__u32)( (((__u32)((0xa9fe0000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xa9fe0000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xa9fe0000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xa9fe0000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xa9fe0000)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_anycast_6to4(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xffffff00))) ? ((__u32)( (((__u32)((0xffffff00)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xffffff00)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xffffff00)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xffffff00)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xffffff00))))) == (( __be32)(__builtin_constant_p((__u32)((0xc0586300))) ? ((__u32)( (((__u32)((0xc0586300)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xc0586300)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xc0586300)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xc0586300)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xc0586300)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_test_192(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xffffff00))) ? ((__u32)( (((__u32)((0xffffff00)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xffffff00)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xffffff00)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xffffff00)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xffffff00))))) == (( __be32)(__builtin_constant_p((__u32)((0xc0000200))) ? ((__u32)( (((__u32)((0xc0000200)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xc0000200)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xc0000200)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xc0000200)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xc0000200)))); } static inline __attribute__((no_instrument_function)) bool ipv4_is_test_198(__be32 addr) { return (addr & (( __be32)(__builtin_constant_p((__u32)((0xfffe0000))) ? ((__u32)( (((__u32)((0xfffe0000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xfffe0000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xfffe0000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xfffe0000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xfffe0000))))) == (( __be32)(__builtin_constant_p((__u32)((0xc6120000))) ? ((__u32)( (((__u32)((0xc6120000)) & (__u32)0x000000ffUL) << 24) | (((__u32)((0xc6120000)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((0xc6120000)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((0xc6120000)) & (__u32)0xff000000UL) >> 24))) : __fswab32((0xc6120000)))); } struct in6_addr { union { __u8 u6_addr8[16]; __be16 u6_addr16[8]; __be32 u6_addr32[4]; } in6_u; }; extern const struct in6_addr in6addr_any; extern const struct in6_addr in6addr_loopback; extern const struct in6_addr in6addr_linklocal_allnodes; extern const struct in6_addr in6addr_linklocal_allrouters; struct sockaddr_in6 { unsigned short int sin6_family; __be16 sin6_port; __be32 sin6_flowinfo; struct in6_addr sin6_addr; __u32 sin6_scope_id; }; struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; int ipv6mr_ifindex; }; struct in6_flowlabel_req { struct in6_addr flr_dst; __be32 flr_label; __u8 flr_action; __u8 flr_share; __u16 flr_flags; __u16 flr_expires; __u16 flr_linger; __u32 __flr_pad; }; enum nf_inet_hooks { NF_INET_PRE_ROUTING, NF_INET_LOCAL_IN, NF_INET_FORWARD, NF_INET_LOCAL_OUT, NF_INET_POST_ROUTING, NF_INET_NUMHOOKS }; enum { NFPROTO_UNSPEC = 0, NFPROTO_IPV4 = 2, NFPROTO_ARP = 3, NFPROTO_BRIDGE = 7, NFPROTO_IPV6 = 10, NFPROTO_DECNET = 12, NFPROTO_NUMPROTO, }; union nf_inet_addr { __u32 all[4]; __be32 ip; __be32 ip6[4]; struct in_addr in; struct in6_addr in6; }; static inline __attribute__((no_instrument_function)) int NF_DROP_GETERR(int verdict) { return -(verdict >> 16); } static inline __attribute__((no_instrument_function)) int nf_inet_addr_cmp(const union nf_inet_addr *a1, const union nf_inet_addr *a2) { return a1->all[0] == a2->all[0] && a1->all[1] == a2->all[1] && a1->all[2] == a2->all[2] && a1->all[3] == a2->all[3]; } extern void netfilter_init(void); struct sk_buff; typedef unsigned int nf_hookfn(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)); struct nf_hook_ops { struct list_head list; nf_hookfn *hook; struct module *owner; u_int8_t pf; unsigned int hooknum; int priority; }; struct nf_sockopt_ops { struct list_head list; u_int8_t pf; int set_optmin; int set_optmax; int (*set)(struct sock *sk, int optval, void *user, unsigned int len); int (*compat_set)(struct sock *sk, int optval, void *user, unsigned int len); int get_optmin; int get_optmax; int (*get)(struct sock *sk, int optval, void *user, int *len); int (*compat_get)(struct sock *sk, int optval, void *user, int *len); struct module *owner; }; int nf_register_hook(struct nf_hook_ops *reg); void nf_unregister_hook(struct nf_hook_ops *reg); int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n); void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n); int nf_register_sockopt(struct nf_sockopt_ops *reg); void nf_unregister_sockopt(struct nf_sockopt_ops *reg); extern struct ctl_path nf_net_netfilter_sysctl_path[]; extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; extern struct list_head nf_hooks[NFPROTO_NUMPROTO][8]; enum jump_label_type { JUMP_LABEL_DISABLE = 0, JUMP_LABEL_ENABLE, }; struct module; struct static_key { atomic_t enabled; }; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) void jump_label_init(void) { } struct static_key_deferred { struct static_key key; }; static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) bool static_key_false(struct static_key *key) { if (ldv__builtin_expect(!!(atomic_read(&key->enabled)), 0) > 0) return true; return false; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) bool static_key_true(struct static_key *key) { if (ldv__builtin_expect(!!(atomic_read(&key->enabled)), 1) > 0) return true; return false; } static inline __attribute__((no_instrument_function)) __attribute__((always_inline)) bool static_branch(struct static_key *key) { if (ldv__builtin_expect(!!(atomic_read(&key->enabled)), 0) > 0) return true; return false; } static inline __attribute__((no_instrument_function)) void static_key_slow_inc(struct static_key *key) { atomic_inc(&key->enabled); } static inline __attribute__((no_instrument_function)) void static_key_slow_dec(struct static_key *key) { atomic_dec(&key->enabled); } static inline __attribute__((no_instrument_function)) void static_key_slow_dec_deferred(struct static_key_deferred *key) { static_key_slow_dec(&key->key); } static inline __attribute__((no_instrument_function)) int jump_label_text_reserved(void *start, void *end) { return 0; } static inline __attribute__((no_instrument_function)) void jump_label_lock(void) {} static inline __attribute__((no_instrument_function)) void jump_label_unlock(void) {} static inline __attribute__((no_instrument_function)) int jump_label_apply_nops(struct module *mod) { return 0; } static inline __attribute__((no_instrument_function)) void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl) { } static inline __attribute__((no_instrument_function)) bool static_key_enabled(struct static_key *key) { return (atomic_read(&key->enabled) > 0); } extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][8]; static inline __attribute__((no_instrument_function)) bool nf_hooks_active(u_int8_t pf, unsigned int hook) { if (__builtin_constant_p(pf) && __builtin_constant_p(hook)) return static_key_false(&nf_hooks_needed[pf][hook]); return !list_empty(&nf_hooks[pf][hook]); } int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev, int (*okfn)(struct sk_buff *), int thresh); static inline __attribute__((no_instrument_function)) int nf_hook_thresh(u_int8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev, int (*okfn)(struct sk_buff *), int thresh) { if (nf_hooks_active(pf, hook)) return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); return 1; } static inline __attribute__((no_instrument_function)) int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev, int (*okfn)(struct sk_buff *)) { return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, (-((int)(~0U>>1)) - 1)); } static inline __attribute__((no_instrument_function)) int NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *in, struct net_device *out, int (*okfn)(struct sk_buff *), int thresh) { int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); if (ret == 1) ret = okfn(skb); return ret; } static inline __attribute__((no_instrument_function)) int NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *in, struct net_device *out, int (*okfn)(struct sk_buff *), bool cond) { int ret; if (!cond || ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1))) == 1)) ret = okfn(skb); return ret; } static inline __attribute__((no_instrument_function)) int NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *in, struct net_device *out, int (*okfn)(struct sk_buff *)) { return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1)); } int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char *opt, unsigned int len); int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char *opt, int *len); int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char *opt, unsigned int len); int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char *opt, int *len); extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); struct flowi; struct nf_queue_entry; struct nf_afinfo { unsigned short family; __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u_int8_t protocol); __sum16 (*checksum_partial)(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, unsigned int len, u_int8_t protocol); int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, bool strict); void (*saveroute)(const struct sk_buff *skb, struct nf_queue_entry *entry); int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); int route_key_size; }; extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; static inline __attribute__((no_instrument_function)) const struct nf_afinfo *nf_get_afinfo(unsigned short family) { return ({ typeof(*(nf_afinfo[family])) *_________p1 = (typeof(*(nf_afinfo[family]))* )(*(volatile typeof((nf_afinfo[family])) *)&((nf_afinfo[family]))); do { } while (0); ; do { } while (0); ((typeof(*(nf_afinfo[family])) *)(_________p1)); }); } static inline __attribute__((no_instrument_function)) __sum16 nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u_int8_t protocol, unsigned short family) { const struct nf_afinfo *afinfo; __sum16 csum = 0; rcu_read_lock(); afinfo = nf_get_afinfo(family); if (afinfo) csum = afinfo->checksum(skb, hook, dataoff, protocol); rcu_read_unlock(); return csum; } static inline __attribute__((no_instrument_function)) __sum16 nf_checksum_partial(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, unsigned int len, u_int8_t protocol, unsigned short family) { const struct nf_afinfo *afinfo; __sum16 csum = 0; rcu_read_lock(); afinfo = nf_get_afinfo(family); if (afinfo) csum = afinfo->checksum_partial(skb, hook, dataoff, len, protocol); rcu_read_unlock(); return csum; } extern int nf_register_afinfo(const struct nf_afinfo *afinfo); extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); struct flowi_common { int flowic_oif; int flowic_iif; __u32 flowic_mark; __u8 flowic_tos; __u8 flowic_scope; __u8 flowic_proto; __u8 flowic_flags; __u32 flowic_secid; }; union flowi_uli { struct { __be16 dport; __be16 sport; } ports; struct { __u8 type; __u8 code; } icmpt; struct { __le16 dport; __le16 sport; } dnports; __be32 spi; __be32 gre_key; struct { __u8 type; } mht; }; struct flowi4 { struct flowi_common __fl_common; __be32 saddr; __be32 daddr; union flowi_uli uli; } __attribute__((__aligned__(64/8))); static inline __attribute__((no_instrument_function)) void flowi4_init_output(struct flowi4 *fl4, int oif, __u32 mark, __u8 tos, __u8 scope, __u8 proto, __u8 flags, __be32 daddr, __be32 saddr, __be16 dport, __be16 sport) { fl4->__fl_common.flowic_oif = oif; fl4->__fl_common.flowic_iif = 0; fl4->__fl_common.flowic_mark = mark; fl4->__fl_common.flowic_tos = tos; fl4->__fl_common.flowic_scope = scope; fl4->__fl_common.flowic_proto = proto; fl4->__fl_common.flowic_flags = flags; fl4->__fl_common.flowic_secid = 0; fl4->daddr = daddr; fl4->saddr = saddr; fl4->uli.ports.dport = dport; fl4->uli.ports.sport = sport; } static inline __attribute__((no_instrument_function)) void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos, __be32 daddr, __be32 saddr) { fl4->__fl_common.flowic_oif = oif; fl4->__fl_common.flowic_tos = tos; fl4->daddr = daddr; fl4->saddr = saddr; } struct flowi6 { struct flowi_common __fl_common; struct in6_addr daddr; struct in6_addr saddr; __be32 flowlabel; union flowi_uli uli; } __attribute__((__aligned__(64/8))); struct flowidn { struct flowi_common __fl_common; __le16 daddr; __le16 saddr; union flowi_uli uli; } __attribute__((__aligned__(64/8))); struct flowi { union { struct flowi_common __fl_common; struct flowi4 ip4; struct flowi6 ip6; struct flowidn dn; } u; } __attribute__((__aligned__(64/8))); static inline __attribute__((no_instrument_function)) struct flowi *flowi4_to_flowi(struct flowi4 *fl4) { return ({ const typeof( ((struct flowi *)0)->u.ip4 ) *__mptr = (fl4); (struct flowi *)( (char *)__mptr - __builtin_offsetof(struct flowi,u.ip4) );}); } static inline __attribute__((no_instrument_function)) struct flowi *flowi6_to_flowi(struct flowi6 *fl6) { return ({ const typeof( ((struct flowi *)0)->u.ip6 ) *__mptr = (fl6); (struct flowi *)( (char *)__mptr - __builtin_offsetof(struct flowi,u.ip6) );}); } static inline __attribute__((no_instrument_function)) struct flowi *flowidn_to_flowi(struct flowidn *fldn) { return ({ const typeof( ((struct flowi *)0)->u.dn ) *__mptr = (fldn); (struct flowi *)( (char *)__mptr - __builtin_offsetof(struct flowi,u.dn) );}); } typedef unsigned long flow_compare_t; static inline __attribute__((no_instrument_function)) size_t flow_key_size(u16 family) { switch (family) { case 2: ; return sizeof(struct flowi4) / sizeof(flow_compare_t); case 10: ; return sizeof(struct flowi6) / sizeof(flow_compare_t); case 12: ; return sizeof(struct flowidn) / sizeof(flow_compare_t); } return 0; } struct net; struct sock; struct flow_cache_ops; struct flow_cache_object { const struct flow_cache_ops *ops; }; struct flow_cache_ops { struct flow_cache_object *(*get)(struct flow_cache_object *); int (*check)(struct flow_cache_object *); void (*delete)(struct flow_cache_object *); }; typedef struct flow_cache_object *(*flow_resolve_t)( struct net *net, const struct flowi *key, u16 family, u8 dir, struct flow_cache_object *oldobj, void *ctx); extern struct flow_cache_object *flow_cache_lookup( struct net *net, const struct flowi *key, u16 family, u8 dir, flow_resolve_t resolver, void *ctx); extern void flow_cache_flush(void); extern void flow_cache_flush_deferred(void); extern atomic_t flow_cache_genid; extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); static inline __attribute__((no_instrument_function)) void nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) { void (*decodefn)(struct sk_buff *, struct flowi *); if (family == 2) { rcu_read_lock(); decodefn = ({ typeof(*(ip_nat_decode_session)) *_________p1 = (typeof(*(ip_nat_decode_session))* )(*(volatile typeof((ip_nat_decode_session)) *)&((ip_nat_decode_session))); do { } while (0); ; do { } while (0); ((typeof(*(ip_nat_decode_session)) *)(_________p1)); }); if (decodefn) decodefn(skb, fl); rcu_read_unlock(); } } struct net; struct completion; struct mm_struct; enum { PROC_ROOT_INO = 1, }; typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); typedef int (write_proc_t)(struct file *file, const char *buffer, unsigned long count, void *data); struct proc_dir_entry { unsigned int low_ino; umode_t mode; nlink_t nlink; uid_t uid; gid_t gid; loff_t size; const struct inode_operations *proc_iops; const struct file_operations *proc_fops; struct proc_dir_entry *next, *parent, *subdir; void *data; read_proc_t *read_proc; write_proc_t *write_proc; atomic_t count; int pde_users; struct completion *pde_unload_completion; struct list_head pde_openers; spinlock_t pde_unload_lock; u8 namelen; char name[]; }; enum kcore_type { KCORE_TEXT, KCORE_VMALLOC, KCORE_RAM, KCORE_VMEMMAP, KCORE_OTHER, }; struct kcore_list { struct list_head list; unsigned long addr; size_t size; int type; }; struct vmcore { struct list_head list; unsigned long long paddr; unsigned long long size; loff_t offset; }; extern void proc_root_init(void); void proc_flush_task(struct task_struct *task); extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, struct proc_dir_entry *parent); struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops, void *data); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); struct pid_namespace; extern int pid_ns_prepare_proc(struct pid_namespace *ns); extern void pid_ns_release_proc(struct pid_namespace *ns); struct tty_driver; extern void proc_tty_init(void); extern void proc_tty_register_driver(struct tty_driver *driver); extern void proc_tty_unregister_driver(struct tty_driver *driver); extern struct proc_dir_entry *proc_symlink(const char *, struct proc_dir_entry *, const char *); extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, struct proc_dir_entry *parent); static inline __attribute__((no_instrument_function)) struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops) { return proc_create_data(name, mode, parent, proc_fops, ((void *)0)); } static inline __attribute__((no_instrument_function)) struct proc_dir_entry *create_proc_read_entry(const char *name, umode_t mode, struct proc_dir_entry *base, read_proc_t *read_proc, void * data) { struct proc_dir_entry *res=create_proc_entry(name,mode,base); if (res) { res->read_proc=read_proc; res->data=data; } return res; } extern struct proc_dir_entry *proc_net_fops_create(struct net *net, const char *name, umode_t mode, const struct file_operations *fops); extern void proc_net_remove(struct net *net, const char *name); extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, struct proc_dir_entry *parent); extern struct file *proc_ns_fget(int fd); extern void kclist_add(struct kcore_list *, void *, size_t, int type); struct nsproxy; struct proc_ns_operations { const char *name; int type; void *(*get)(struct task_struct *task); void (*put)(void *ns); int (*install)(struct nsproxy *nsproxy, void *ns); }; extern const struct proc_ns_operations netns_operations; extern const struct proc_ns_operations utsns_operations; extern const struct proc_ns_operations ipcns_operations; union proc_op { int (*proc_get_link)(struct dentry *, struct path *); int (*proc_read)(struct task_struct *task, char *page); int (*proc_show)(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task); }; struct ctl_table_header; struct ctl_table; struct proc_inode { struct pid *pid; int fd; union proc_op op; struct proc_dir_entry *pde; struct ctl_table_header *sysctl; struct ctl_table *sysctl_entry; void *ns; const struct proc_ns_operations *ns_ops; struct inode vfs_inode; }; static inline __attribute__((no_instrument_function)) struct proc_inode *PROC_I(const struct inode *inode) { return ({ const typeof( ((struct proc_inode *)0)->vfs_inode ) *__mptr = (inode); (struct proc_inode *)( (char *)__mptr - __builtin_offsetof(struct proc_inode,vfs_inode) );}); } static inline __attribute__((no_instrument_function)) struct proc_dir_entry *PDE(const struct inode *inode) { return PROC_I(inode)->pde; } static inline __attribute__((no_instrument_function)) struct net *PDE_NET(struct proc_dir_entry *pde) { return pde->parent->data; } extern struct proc_dir_entry *proc_net_netfilter; extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) ; extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); extern void (*nf_ct_destroy)(struct nf_conntrack *) ; struct ebt_table; struct netns_xt { struct list_head tables[NFPROTO_NUMPROTO]; struct ebt_table *broute_table; struct ebt_table *frame_filter; struct ebt_table *frame_nat; }; struct hlist_nulls_head { struct hlist_nulls_node *first; }; struct hlist_nulls_node { struct hlist_nulls_node *next, **pprev; }; static inline __attribute__((no_instrument_function)) int is_a_nulls(const struct hlist_nulls_node *ptr) { return ((unsigned long)ptr & 1); } static inline __attribute__((no_instrument_function)) unsigned long get_nulls_value(const struct hlist_nulls_node *ptr) { return ((unsigned long)ptr) >> 1; } static inline __attribute__((no_instrument_function)) int hlist_nulls_unhashed(const struct hlist_nulls_node *h) { return !h->pprev; } static inline __attribute__((no_instrument_function)) int hlist_nulls_empty(const struct hlist_nulls_head *h) { return is_a_nulls(h->first); } static inline __attribute__((no_instrument_function)) void hlist_nulls_add_head(struct hlist_nulls_node *n, struct hlist_nulls_head *h) { struct hlist_nulls_node *first = h->first; n->next = first; n->pprev = &h->first; h->first = n; if (!is_a_nulls(first)) first->pprev = &n->next; } static inline __attribute__((no_instrument_function)) void __hlist_nulls_del(struct hlist_nulls_node *n) { struct hlist_nulls_node *next = n->next; struct hlist_nulls_node **pprev = n->pprev; *pprev = next; if (!is_a_nulls(next)) next->pprev = pprev; } static inline __attribute__((no_instrument_function)) void hlist_nulls_del(struct hlist_nulls_node *n) { __hlist_nulls_del(n); n->pprev = ((void *) 0x00200200 + (0xdead000000000000UL)); } struct ctl_table_header; struct nf_conntrack_ecache; struct netns_ct { atomic_t count; unsigned int expect_count; unsigned int htable_size; struct kmem_cache *nf_conntrack_cachep; struct hlist_nulls_head *hash; struct hlist_head *expect_hash; struct hlist_nulls_head unconfirmed; struct hlist_nulls_head dying; struct ip_conntrack_stat *stat; struct nf_ct_event_notifier *nf_conntrack_event_cb; struct nf_exp_event_notifier *nf_expect_event_cb; int sysctl_events; unsigned int sysctl_events_retry_timeout; int sysctl_acct; int sysctl_tstamp; int sysctl_checksum; unsigned int sysctl_log_invalid; struct ctl_table_header *sysctl_header; struct ctl_table_header *acct_sysctl_header; struct ctl_table_header *tstamp_sysctl_header; struct ctl_table_header *event_sysctl_header; char *slabname; }; typedef union { __be32 a4; __be32 a6[4]; } xfrm_address_t; struct xfrm_id { xfrm_address_t daddr; __be32 spi; __u8 proto; }; struct xfrm_sec_ctx { __u8 ctx_doi; __u8 ctx_alg; __u16 ctx_len; __u32 ctx_sid; char ctx_str[0]; }; struct xfrm_selector { xfrm_address_t daddr; xfrm_address_t saddr; __be16 dport; __be16 dport_mask; __be16 sport; __be16 sport_mask; __u16 family; __u8 prefixlen_d; __u8 prefixlen_s; __u8 proto; int ifindex; __kernel_uid32_t user; }; struct xfrm_lifetime_cfg { __u64 soft_byte_limit; __u64 hard_byte_limit; __u64 soft_packet_limit; __u64 hard_packet_limit; __u64 soft_add_expires_seconds; __u64 hard_add_expires_seconds; __u64 soft_use_expires_seconds; __u64 hard_use_expires_seconds; }; struct xfrm_lifetime_cur { __u64 bytes; __u64 packets; __u64 add_time; __u64 use_time; }; struct xfrm_replay_state { __u32 oseq; __u32 seq; __u32 bitmap; }; struct xfrm_replay_state_esn { unsigned int bmp_len; __u32 oseq; __u32 seq; __u32 oseq_hi; __u32 seq_hi; __u32 replay_window; __u32 bmp[0]; }; struct xfrm_algo { char alg_name[64]; unsigned int alg_key_len; char alg_key[0]; }; struct xfrm_algo_auth { char alg_name[64]; unsigned int alg_key_len; unsigned int alg_trunc_len; char alg_key[0]; }; struct xfrm_algo_aead { char alg_name[64]; unsigned int alg_key_len; unsigned int alg_icv_len; char alg_key[0]; }; struct xfrm_stats { __u32 replay_window; __u32 replay; __u32 integrity_failed; }; enum { XFRM_POLICY_TYPE_MAIN = 0, XFRM_POLICY_TYPE_SUB = 1, XFRM_POLICY_TYPE_MAX = 2, XFRM_POLICY_TYPE_ANY = 255 }; enum { XFRM_POLICY_IN = 0, XFRM_POLICY_OUT = 1, XFRM_POLICY_FWD = 2, XFRM_POLICY_MASK = 3, XFRM_POLICY_MAX = 3 }; enum { XFRM_SHARE_ANY, XFRM_SHARE_SESSION, XFRM_SHARE_USER, XFRM_SHARE_UNIQUE }; enum { XFRM_MSG_BASE = 0x10, XFRM_MSG_NEWSA = 0x10, XFRM_MSG_DELSA, XFRM_MSG_GETSA, XFRM_MSG_NEWPOLICY, XFRM_MSG_DELPOLICY, XFRM_MSG_GETPOLICY, XFRM_MSG_ALLOCSPI, XFRM_MSG_ACQUIRE, XFRM_MSG_EXPIRE, XFRM_MSG_UPDPOLICY, XFRM_MSG_UPDSA, XFRM_MSG_POLEXPIRE, XFRM_MSG_FLUSHSA, XFRM_MSG_FLUSHPOLICY, XFRM_MSG_NEWAE, XFRM_MSG_GETAE, XFRM_MSG_REPORT, XFRM_MSG_MIGRATE, XFRM_MSG_NEWSADINFO, XFRM_MSG_GETSADINFO, XFRM_MSG_NEWSPDINFO, XFRM_MSG_GETSPDINFO, XFRM_MSG_MAPPING, __XFRM_MSG_MAX }; struct xfrm_user_sec_ctx { __u16 len; __u16 exttype; __u8 ctx_alg; __u8 ctx_doi; __u16 ctx_len; }; struct xfrm_user_tmpl { struct xfrm_id id; __u16 family; xfrm_address_t saddr; __u32 reqid; __u8 mode; __u8 share; __u8 optional; __u32 aalgos; __u32 ealgos; __u32 calgos; }; struct xfrm_encap_tmpl { __u16 encap_type; __be16 encap_sport; __be16 encap_dport; xfrm_address_t encap_oa; }; enum xfrm_ae_ftype_t { XFRM_AE_UNSPEC, XFRM_AE_RTHR=1, XFRM_AE_RVAL=2, XFRM_AE_LVAL=4, XFRM_AE_ETHR=8, XFRM_AE_CR=16, XFRM_AE_CE=32, XFRM_AE_CU=64, __XFRM_AE_MAX }; struct xfrm_userpolicy_type { __u8 type; __u16 reserved1; __u8 reserved2; }; enum xfrm_attr_type_t { XFRMA_UNSPEC, XFRMA_ALG_AUTH, XFRMA_ALG_CRYPT, XFRMA_ALG_COMP, XFRMA_ENCAP, XFRMA_TMPL, XFRMA_SA, XFRMA_POLICY, XFRMA_SEC_CTX, XFRMA_LTIME_VAL, XFRMA_REPLAY_VAL, XFRMA_REPLAY_THRESH, XFRMA_ETIMER_THRESH, XFRMA_SRCADDR, XFRMA_COADDR, XFRMA_LASTUSED, XFRMA_POLICY_TYPE, XFRMA_MIGRATE, XFRMA_ALG_AEAD, XFRMA_KMADDRESS, XFRMA_ALG_AUTH_TRUNC, XFRMA_MARK, XFRMA_TFCPAD, XFRMA_REPLAY_ESN_VAL, __XFRMA_MAX }; struct xfrm_mark { __u32 v; __u32 m; }; enum xfrm_sadattr_type_t { XFRMA_SAD_UNSPEC, XFRMA_SAD_CNT, XFRMA_SAD_HINFO, __XFRMA_SAD_MAX }; struct xfrmu_sadhinfo { __u32 sadhcnt; __u32 sadhmcnt; }; enum xfrm_spdattr_type_t { XFRMA_SPD_UNSPEC, XFRMA_SPD_INFO, XFRMA_SPD_HINFO, __XFRMA_SPD_MAX }; struct xfrmu_spdinfo { __u32 incnt; __u32 outcnt; __u32 fwdcnt; __u32 inscnt; __u32 outscnt; __u32 fwdscnt; }; struct xfrmu_spdhinfo { __u32 spdhcnt; __u32 spdhmcnt; }; struct xfrm_usersa_info { struct xfrm_selector sel; struct xfrm_id id; xfrm_address_t saddr; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; struct xfrm_stats stats; __u32 seq; __u32 reqid; __u16 family; __u8 mode; __u8 replay_window; __u8 flags; }; struct xfrm_usersa_id { xfrm_address_t daddr; __be32 spi; __u16 family; __u8 proto; }; struct xfrm_aevent_id { struct xfrm_usersa_id sa_id; xfrm_address_t saddr; __u32 flags; __u32 reqid; }; struct xfrm_userspi_info { struct xfrm_usersa_info info; __u32 min; __u32 max; }; struct xfrm_userpolicy_info { struct xfrm_selector sel; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; __u32 priority; __u32 index; __u8 dir; __u8 action; __u8 flags; __u8 share; }; struct xfrm_userpolicy_id { struct xfrm_selector sel; __u32 index; __u8 dir; }; struct xfrm_user_acquire { struct xfrm_id id; xfrm_address_t saddr; struct xfrm_selector sel; struct xfrm_userpolicy_info policy; __u32 aalgos; __u32 ealgos; __u32 calgos; __u32 seq; }; struct xfrm_user_expire { struct xfrm_usersa_info state; __u8 hard; }; struct xfrm_user_polexpire { struct xfrm_userpolicy_info pol; __u8 hard; }; struct xfrm_usersa_flush { __u8 proto; }; struct xfrm_user_report { __u8 proto; struct xfrm_selector sel; }; struct xfrm_user_kmaddress { xfrm_address_t local; xfrm_address_t remote; __u32 reserved; __u16 family; }; struct xfrm_user_migrate { xfrm_address_t old_daddr; xfrm_address_t old_saddr; xfrm_address_t new_daddr; xfrm_address_t new_saddr; __u8 proto; __u8 mode; __u16 reserved; __u32 reqid; __u16 old_family; __u16 new_family; }; struct xfrm_user_mapping { struct xfrm_usersa_id id; __u32 reqid; xfrm_address_t old_saddr; xfrm_address_t new_saddr; __be16 old_sport; __be16 new_sport; }; enum xfrm_nlgroups { XFRMNLGRP_NONE, XFRMNLGRP_ACQUIRE, XFRMNLGRP_EXPIRE, XFRMNLGRP_SA, XFRMNLGRP_POLICY, XFRMNLGRP_AEVENTS, XFRMNLGRP_REPORT, XFRMNLGRP_MIGRATE, XFRMNLGRP_MAPPING, __XFRMNLGRP_MAX }; struct ctl_table_header; struct xfrm_policy_hash { struct hlist_head *table; unsigned int hmask; }; struct netns_xfrm { struct list_head state_all; struct hlist_head *state_bydst; struct hlist_head *state_bysrc; struct hlist_head *state_byspi; unsigned int state_hmask; unsigned int state_num; struct work_struct state_hash_work; struct hlist_head state_gc_list; struct work_struct state_gc_work; wait_queue_head_t km_waitq; struct list_head policy_all; struct hlist_head *policy_byidx; unsigned int policy_idx_hmask; struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2]; struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2]; unsigned int policy_count[XFRM_POLICY_MAX * 2]; struct work_struct policy_hash_work; struct sock *nlsk; struct sock *nlsk_stash; u32 sysctl_aevent_etime; u32 sysctl_aevent_rseqth; int sysctl_larval_drop; u32 sysctl_acq_expires; struct ctl_table_header *sysctl_hdr; struct dst_ops xfrm4_dst_ops; struct dst_ops xfrm6_dst_ops; }; struct proc_dir_entry; struct net_device; struct sock; struct ctl_table_header; struct net_generic; struct sock; struct netns_ipvs; struct net { atomic_t passive; atomic_t count; spinlock_t rules_mod_lock; struct list_head list; struct list_head cleanup_list; struct list_head exit_list; struct proc_dir_entry *proc_net; struct proc_dir_entry *proc_net_stat; struct ctl_table_set sysctls; struct sock *rtnl; struct sock *genl_sock; struct list_head dev_base_head; struct hlist_head *dev_name_head; struct hlist_head *dev_index_head; unsigned int dev_base_seq; struct list_head rules_ops; struct net_device *loopback_dev; struct netns_core core; struct netns_mib mib; struct netns_packet packet; struct netns_unix unx; struct netns_ipv4 ipv4; struct netns_ipv6 ipv6; struct netns_dccp dccp; struct netns_xt xt; struct netns_ct ct; struct sock *nfnl; struct sock *nfnl_stash; struct sk_buff_head wext_nlevents; struct net_generic *gen; struct netns_xfrm xfrm; struct netns_ipvs *ipvs; }; struct seq_operations; struct file; struct path; struct inode; struct dentry; struct seq_file { char *buf; size_t size; size_t from; size_t count; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; void *private; }; struct seq_operations { void * (*start) (struct seq_file *m, loff_t *pos); void (*stop) (struct seq_file *m, void *v); void * (*next) (struct seq_file *m, void *v, loff_t *pos); int (*show) (struct seq_file *m, void *v); }; static inline __attribute__((no_instrument_function)) size_t seq_get_buf(struct seq_file *m, char **bufp) { do { if (ldv__builtin_expect(!!(m->count > m->size), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/seq_file.h"), "i" (50), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); if (m->count < m->size) *bufp = m->buf + m->count; else *bufp = ((void *)0); return m->size - m->count; } static inline __attribute__((no_instrument_function)) void seq_commit(struct seq_file *m, int num) { if (num < 0) { m->count = m->size; } else { do { if (ldv__builtin_expect(!!(m->count + num > m->size), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/seq_file.h"), "i" (73), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); m->count += num; } } char *mangle_path(char *s, const char *p, const char *esc); int seq_open(struct file *, const struct seq_operations *); ssize_t seq_read(struct file *, char *, size_t, loff_t *); loff_t seq_lseek(struct file *, loff_t, int); int seq_release(struct inode *, struct file *); int seq_escape(struct seq_file *, const char *, const char *); int seq_putc(struct seq_file *m, char c); int seq_puts(struct seq_file *m, const char *s); int seq_write(struct seq_file *seq, const void *data, size_t len); __attribute__((format(printf, 2, 3))) int seq_printf(struct seq_file *, const char *, ...); int seq_path(struct seq_file *, const struct path *, const char *); int seq_dentry(struct seq_file *, struct dentry *, const char *); int seq_path_root(struct seq_file *m, const struct path *path, const struct path *root, const char *esc); int seq_bitmap(struct seq_file *m, const unsigned long *bits, unsigned int nr_bits); static inline __attribute__((no_instrument_function)) int seq_cpumask(struct seq_file *m, const struct cpumask *mask) { return seq_bitmap(m, ((mask)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int seq_nodemask(struct seq_file *m, nodemask_t *mask) { return seq_bitmap(m, mask->bits, (1 << 10)); } int seq_bitmap_list(struct seq_file *m, const unsigned long *bits, unsigned int nr_bits); static inline __attribute__((no_instrument_function)) int seq_cpumask_list(struct seq_file *m, const struct cpumask *mask) { return seq_bitmap_list(m, ((mask)->bits), nr_cpu_ids); } static inline __attribute__((no_instrument_function)) int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) { return seq_bitmap_list(m, mask->bits, (1 << 10)); } int single_open(struct file *, int (*)(struct seq_file *, void *), void *); int single_release(struct inode *, struct file *); void *__seq_open_private(struct file *, const struct seq_operations *, int); int seq_open_private(struct file *, const struct seq_operations *, int); int seq_release_private(struct inode *, struct file *); int seq_put_decimal_ull(struct seq_file *m, char delimiter, unsigned long long num); int seq_put_decimal_ll(struct seq_file *m, char delimiter, long long num); extern struct list_head *seq_list_start(struct list_head *head, loff_t pos); extern struct list_head *seq_list_start_head(struct list_head *head, loff_t pos); extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos); extern struct hlist_node *seq_hlist_start(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_start_head(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head, loff_t *ppos); extern struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_next_rcu(void *v, struct hlist_head *head, loff_t *ppos); struct net; extern struct net init_net; struct seq_net_private { struct net *net; }; int seq_open_net(struct inode *, struct file *, const struct seq_operations *, int); int single_open_net(struct inode *, struct file *file, int (*show)(struct seq_file *, void *)); int seq_release_net(struct inode *, struct file *); int single_release_net(struct inode *, struct file *); static inline __attribute__((no_instrument_function)) struct net *seq_file_net(struct seq_file *seq) { return ((struct seq_net_private *)seq->private)->net; } extern struct net init_net; extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); extern struct list_head net_namespace_list; extern struct net *get_net_ns_by_pid(pid_t pid); extern struct net *get_net_ns_by_fd(int pid); extern void __put_net(struct net *net); static inline __attribute__((no_instrument_function)) struct net *get_net(struct net *net) { atomic_inc(&net->count); return net; } static inline __attribute__((no_instrument_function)) struct net *maybe_get_net(struct net *net) { if (!atomic_add_unless((&net->count), 1, 0)) net = ((void *)0); return net; } static inline __attribute__((no_instrument_function)) void put_net(struct net *net) { if (atomic_dec_and_test(&net->count)) __put_net(net); } static inline __attribute__((no_instrument_function)) int net_eq(const struct net *net1, const struct net *net2) { return net1 == net2; } extern void net_drop_ns(void *); static inline __attribute__((no_instrument_function)) struct net *hold_net(struct net *net) { return net; } static inline __attribute__((no_instrument_function)) void release_net(struct net *net) { } static inline __attribute__((no_instrument_function)) void write_pnet(struct net **pnet, struct net *net) { *pnet = net; } static inline __attribute__((no_instrument_function)) struct net *read_pnet(struct net * const *pnet) { return *pnet; } struct pernet_operations { struct list_head list; int (*init)(struct net *net); void (*exit)(struct net *net); void (*exit_batch)(struct list_head *net_exit_list); int *id; size_t size; }; extern int register_pernet_subsys(struct pernet_operations *); extern void unregister_pernet_subsys(struct pernet_operations *); extern int register_pernet_device(struct pernet_operations *); extern void unregister_pernet_device(struct pernet_operations *); struct ctl_path; struct ctl_table; struct ctl_table_header; extern struct ctl_table_header *register_net_sysctl_table(struct net *net, const struct ctl_path *path, struct ctl_table *table); extern struct ctl_table_header *register_net_sysctl_rotable( const struct ctl_path *path, struct ctl_table *table); extern void unregister_net_sysctl_table(struct ctl_table_header *header); struct dsa_chip_data { struct device *mii_bus; int sw_addr; char *port_names[12]; s8 *rtable; }; struct dsa_platform_data { struct device *netdev; int nr_chips; struct dsa_chip_data *chip; }; struct dsa_switch_tree { struct dsa_platform_data *pd; struct net_device *master_netdev; __be16 tag_protocol; s8 cpu_switch; s8 cpu_port; int link_poll_needed; struct work_struct link_poll_work; struct timer_list link_poll_timer; struct dsa_switch *ds[4]; }; struct dsa_switch { struct dsa_switch_tree *dst; int index; struct dsa_chip_data *pd; struct dsa_switch_driver *drv; struct mii_bus *master_mii_bus; u32 dsa_port_mask; u32 phys_port_mask; struct mii_bus *slave_mii_bus; struct net_device *ports[12]; }; static inline __attribute__((no_instrument_function)) bool dsa_is_cpu_port(struct dsa_switch *ds, int p) { return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); } static inline __attribute__((no_instrument_function)) u8 dsa_upstream_port(struct dsa_switch *ds) { struct dsa_switch_tree *dst = ds->dst; if (dst->cpu_switch == ds->index) return dst->cpu_port; else return ds->pd->rtable[dst->cpu_switch]; } struct dsa_switch_driver { struct list_head list; __be16 tag_protocol; int priv_size; char *(*probe)(struct mii_bus *bus, int sw_addr); int (*setup)(struct dsa_switch *ds); int (*set_addr)(struct dsa_switch *ds, u8 *addr); int (*phy_read)(struct dsa_switch *ds, int port, int regnum); int (*phy_write)(struct dsa_switch *ds, int port, int regnum, u16 val); void (*poll_link)(struct dsa_switch *ds); void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data); void (*get_ethtool_stats)(struct dsa_switch *ds, int port, uint64_t *data); int (*get_sset_count)(struct dsa_switch *ds); }; void register_switch_driver(struct dsa_switch_driver *type); void unregister_switch_driver(struct dsa_switch_driver *type); static inline __attribute__((no_instrument_function)) bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst) { return !!(dst->tag_protocol == (( __be16)(__builtin_constant_p((__u16)((0x001B))) ? ((__u16)( (((__u16)((0x001B)) & (__u16)0x00ffU) << 8) | (((__u16)((0x001B)) & (__u16)0xff00U) >> 8))) : __fswab16((0x001B))))); } static inline __attribute__((no_instrument_function)) bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst) { return !!(dst->tag_protocol == (( __be16)(__builtin_constant_p((__u16)((0x001C))) ? ((__u16)( (((__u16)((0x001C)) & (__u16)0x00ffU) << 8) | (((__u16)((0x001C)) & (__u16)0xff00U) >> 8))) : __fswab16((0x001C))))); } struct ieee_ets { __u8 willing; __u8 ets_cap; __u8 cbs; __u8 tc_tx_bw[8]; __u8 tc_rx_bw[8]; __u8 tc_tsa[8]; __u8 prio_tc[8]; __u8 tc_reco_bw[8]; __u8 tc_reco_tsa[8]; __u8 reco_prio_tc[8]; }; struct ieee_pfc { __u8 pfc_cap; __u8 pfc_en; __u8 mbc; __u16 delay; __u64 requests[8]; __u64 indications[8]; }; struct cee_pg { __u8 willing; __u8 error; __u8 pg_en; __u8 tcs_supported; __u8 pg_bw[8]; __u8 prio_pg[8]; }; struct cee_pfc { __u8 willing; __u8 error; __u8 pfc_en; __u8 tcs_supported; }; struct dcb_app { __u8 selector; __u8 priority; __u16 protocol; }; struct dcb_peer_app_info { __u8 willing; __u8 error; }; struct dcbmsg { __u8 dcb_family; __u8 cmd; __u16 dcb_pad; }; enum dcbnl_commands { DCB_CMD_UNDEFINED, DCB_CMD_GSTATE, DCB_CMD_SSTATE, DCB_CMD_PGTX_GCFG, DCB_CMD_PGTX_SCFG, DCB_CMD_PGRX_GCFG, DCB_CMD_PGRX_SCFG, DCB_CMD_PFC_GCFG, DCB_CMD_PFC_SCFG, DCB_CMD_SET_ALL, DCB_CMD_GPERM_HWADDR, DCB_CMD_GCAP, DCB_CMD_GNUMTCS, DCB_CMD_SNUMTCS, DCB_CMD_PFC_GSTATE, DCB_CMD_PFC_SSTATE, DCB_CMD_BCN_GCFG, DCB_CMD_BCN_SCFG, DCB_CMD_GAPP, DCB_CMD_SAPP, DCB_CMD_IEEE_SET, DCB_CMD_IEEE_GET, DCB_CMD_GDCBX, DCB_CMD_SDCBX, DCB_CMD_GFEATCFG, DCB_CMD_SFEATCFG, DCB_CMD_CEE_GET, DCB_CMD_IEEE_DEL, __DCB_CMD_ENUM_MAX, DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, }; enum dcbnl_attrs { DCB_ATTR_UNDEFINED, DCB_ATTR_IFNAME, DCB_ATTR_STATE, DCB_ATTR_PFC_STATE, DCB_ATTR_PFC_CFG, DCB_ATTR_NUM_TC, DCB_ATTR_PG_CFG, DCB_ATTR_SET_ALL, DCB_ATTR_PERM_HWADDR, DCB_ATTR_CAP, DCB_ATTR_NUMTCS, DCB_ATTR_BCN, DCB_ATTR_APP, DCB_ATTR_IEEE, DCB_ATTR_DCBX, DCB_ATTR_FEATCFG, DCB_ATTR_CEE, __DCB_ATTR_ENUM_MAX, DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, }; enum ieee_attrs { DCB_ATTR_IEEE_UNSPEC, DCB_ATTR_IEEE_ETS, DCB_ATTR_IEEE_PFC, DCB_ATTR_IEEE_APP_TABLE, DCB_ATTR_IEEE_PEER_ETS, DCB_ATTR_IEEE_PEER_PFC, DCB_ATTR_IEEE_PEER_APP, __DCB_ATTR_IEEE_MAX }; enum ieee_attrs_app { DCB_ATTR_IEEE_APP_UNSPEC, DCB_ATTR_IEEE_APP, __DCB_ATTR_IEEE_APP_MAX }; enum cee_attrs { DCB_ATTR_CEE_UNSPEC, DCB_ATTR_CEE_PEER_PG, DCB_ATTR_CEE_PEER_PFC, DCB_ATTR_CEE_PEER_APP_TABLE, DCB_ATTR_CEE_TX_PG, DCB_ATTR_CEE_RX_PG, DCB_ATTR_CEE_PFC, DCB_ATTR_CEE_APP_TABLE, DCB_ATTR_CEE_FEAT, __DCB_ATTR_CEE_MAX }; enum peer_app_attr { DCB_ATTR_CEE_PEER_APP_UNSPEC, DCB_ATTR_CEE_PEER_APP_INFO, DCB_ATTR_CEE_PEER_APP, __DCB_ATTR_CEE_PEER_APP_MAX }; enum cee_attrs_app { DCB_ATTR_CEE_APP_UNSPEC, DCB_ATTR_CEE_APP, __DCB_ATTR_CEE_APP_MAX }; enum dcbnl_pfc_up_attrs { DCB_PFC_UP_ATTR_UNDEFINED, DCB_PFC_UP_ATTR_0, DCB_PFC_UP_ATTR_1, DCB_PFC_UP_ATTR_2, DCB_PFC_UP_ATTR_3, DCB_PFC_UP_ATTR_4, DCB_PFC_UP_ATTR_5, DCB_PFC_UP_ATTR_6, DCB_PFC_UP_ATTR_7, DCB_PFC_UP_ATTR_ALL, __DCB_PFC_UP_ATTR_ENUM_MAX, DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, }; enum dcbnl_pg_attrs { DCB_PG_ATTR_UNDEFINED, DCB_PG_ATTR_TC_0, DCB_PG_ATTR_TC_1, DCB_PG_ATTR_TC_2, DCB_PG_ATTR_TC_3, DCB_PG_ATTR_TC_4, DCB_PG_ATTR_TC_5, DCB_PG_ATTR_TC_6, DCB_PG_ATTR_TC_7, DCB_PG_ATTR_TC_MAX, DCB_PG_ATTR_TC_ALL, DCB_PG_ATTR_BW_ID_0, DCB_PG_ATTR_BW_ID_1, DCB_PG_ATTR_BW_ID_2, DCB_PG_ATTR_BW_ID_3, DCB_PG_ATTR_BW_ID_4, DCB_PG_ATTR_BW_ID_5, DCB_PG_ATTR_BW_ID_6, DCB_PG_ATTR_BW_ID_7, DCB_PG_ATTR_BW_ID_MAX, DCB_PG_ATTR_BW_ID_ALL, __DCB_PG_ATTR_ENUM_MAX, DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, }; enum dcbnl_tc_attrs { DCB_TC_ATTR_PARAM_UNDEFINED, DCB_TC_ATTR_PARAM_PGID, DCB_TC_ATTR_PARAM_UP_MAPPING, DCB_TC_ATTR_PARAM_STRICT_PRIO, DCB_TC_ATTR_PARAM_BW_PCT, DCB_TC_ATTR_PARAM_ALL, __DCB_TC_ATTR_PARAM_ENUM_MAX, DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, }; enum dcbnl_cap_attrs { DCB_CAP_ATTR_UNDEFINED, DCB_CAP_ATTR_ALL, DCB_CAP_ATTR_PG, DCB_CAP_ATTR_PFC, DCB_CAP_ATTR_UP2TC, DCB_CAP_ATTR_PG_TCS, DCB_CAP_ATTR_PFC_TCS, DCB_CAP_ATTR_GSP, DCB_CAP_ATTR_BCN, DCB_CAP_ATTR_DCBX, __DCB_CAP_ATTR_ENUM_MAX, DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, }; enum dcbnl_numtcs_attrs { DCB_NUMTCS_ATTR_UNDEFINED, DCB_NUMTCS_ATTR_ALL, DCB_NUMTCS_ATTR_PG, DCB_NUMTCS_ATTR_PFC, __DCB_NUMTCS_ATTR_ENUM_MAX, DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, }; enum dcbnl_bcn_attrs{ DCB_BCN_ATTR_UNDEFINED = 0, DCB_BCN_ATTR_RP_0, DCB_BCN_ATTR_RP_1, DCB_BCN_ATTR_RP_2, DCB_BCN_ATTR_RP_3, DCB_BCN_ATTR_RP_4, DCB_BCN_ATTR_RP_5, DCB_BCN_ATTR_RP_6, DCB_BCN_ATTR_RP_7, DCB_BCN_ATTR_RP_ALL, DCB_BCN_ATTR_BCNA_0, DCB_BCN_ATTR_BCNA_1, DCB_BCN_ATTR_ALPHA, DCB_BCN_ATTR_BETA, DCB_BCN_ATTR_GD, DCB_BCN_ATTR_GI, DCB_BCN_ATTR_TMAX, DCB_BCN_ATTR_TD, DCB_BCN_ATTR_RMIN, DCB_BCN_ATTR_W, DCB_BCN_ATTR_RD, DCB_BCN_ATTR_RU, DCB_BCN_ATTR_WRTT, DCB_BCN_ATTR_RI, DCB_BCN_ATTR_C, DCB_BCN_ATTR_ALL, __DCB_BCN_ATTR_ENUM_MAX, DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, }; enum dcb_general_attr_values { DCB_ATTR_VALUE_UNDEFINED = 0xff }; enum dcbnl_app_attrs { DCB_APP_ATTR_UNDEFINED, DCB_APP_ATTR_IDTYPE, DCB_APP_ATTR_ID, DCB_APP_ATTR_PRIORITY, __DCB_APP_ATTR_ENUM_MAX, DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, }; enum dcbnl_featcfg_attrs { DCB_FEATCFG_ATTR_UNDEFINED, DCB_FEATCFG_ATTR_ALL, DCB_FEATCFG_ATTR_PG, DCB_FEATCFG_ATTR_PFC, DCB_FEATCFG_ATTR_APP, __DCB_FEATCFG_ATTR_ENUM_MAX, DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1, }; struct dcb_app_type { int ifindex; struct dcb_app app; struct list_head list; u8 dcbx; }; int dcb_setapp(struct net_device *, struct dcb_app *); u8 dcb_getapp(struct net_device *, struct dcb_app *); int dcb_ieee_setapp(struct net_device *, struct dcb_app *); int dcb_ieee_delapp(struct net_device *, struct dcb_app *); u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *); int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 pid); int dcbnl_cee_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 pid); struct dcbnl_rtnl_ops { int (*ieee_getets) (struct net_device *, struct ieee_ets *); int (*ieee_setets) (struct net_device *, struct ieee_ets *); int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *); int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); int (*ieee_getapp) (struct net_device *, struct dcb_app *); int (*ieee_setapp) (struct net_device *, struct dcb_app *); int (*ieee_delapp) (struct net_device *, struct dcb_app *); int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *); int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *); u8 (*getstate)(struct net_device *); u8 (*setstate)(struct net_device *, u8); void (*getpermhwaddr)(struct net_device *, u8 *); void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8); void (*setpgbwgcfgtx)(struct net_device *, int, u8); void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8); void (*setpgbwgcfgrx)(struct net_device *, int, u8); void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgtx)(struct net_device *, int, u8 *); void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgrx)(struct net_device *, int, u8 *); void (*setpfccfg)(struct net_device *, int, u8); void (*getpfccfg)(struct net_device *, int, u8 *); u8 (*setall)(struct net_device *); u8 (*getcap)(struct net_device *, int, u8 *); int (*getnumtcs)(struct net_device *, int, u8 *); int (*setnumtcs)(struct net_device *, int, u8); u8 (*getpfcstate)(struct net_device *); void (*setpfcstate)(struct net_device *, u8); void (*getbcncfg)(struct net_device *, int, u32 *); void (*setbcncfg)(struct net_device *, int, u32); void (*getbcnrp)(struct net_device *, int, u8 *); void (*setbcnrp)(struct net_device *, int, u8); u8 (*setapp)(struct net_device *, u8, u16, u8); u8 (*getapp)(struct net_device *, u8, u16); u8 (*getfeatcfg)(struct net_device *, int, u8 *); u8 (*setfeatcfg)(struct net_device *, int, u8); u8 (*getdcbx)(struct net_device *); u8 (*setdcbx)(struct net_device *, u8); int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *, u16 *); int (*peer_getapptable)(struct net_device *, struct dcb_app *); int (*cee_peer_getpg) (struct net_device *, struct cee_pg *); int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *); }; struct taskstats { __u16 version; __u32 ac_exitcode; __u8 ac_flag; __u8 ac_nice; __u64 cpu_count __attribute__((aligned(8))); __u64 cpu_delay_total; __u64 blkio_count; __u64 blkio_delay_total; __u64 swapin_count; __u64 swapin_delay_total; __u64 cpu_run_real_total; __u64 cpu_run_virtual_total; char ac_comm[32]; __u8 ac_sched __attribute__((aligned(8))); __u8 ac_pad[3]; __u32 ac_uid __attribute__((aligned(8))); __u32 ac_gid; __u32 ac_pid; __u32 ac_ppid; __u32 ac_btime; __u64 ac_etime __attribute__((aligned(8))); __u64 ac_utime; __u64 ac_stime; __u64 ac_minflt; __u64 ac_majflt; __u64 coremem; __u64 virtmem; __u64 hiwater_rss; __u64 hiwater_vm; __u64 read_char; __u64 write_char; __u64 read_syscalls; __u64 write_syscalls; __u64 read_bytes; __u64 write_bytes; __u64 cancelled_write_bytes; __u64 nvcsw; __u64 nivcsw; __u64 ac_utimescaled; __u64 ac_stimescaled; __u64 cpu_scaled_run_real_total; __u64 freepages_count; __u64 freepages_delay_total; }; enum { TASKSTATS_CMD_UNSPEC = 0, TASKSTATS_CMD_GET, TASKSTATS_CMD_NEW, __TASKSTATS_CMD_MAX, }; enum { TASKSTATS_TYPE_UNSPEC = 0, TASKSTATS_TYPE_PID, TASKSTATS_TYPE_TGID, TASKSTATS_TYPE_STATS, TASKSTATS_TYPE_AGGR_PID, TASKSTATS_TYPE_AGGR_TGID, TASKSTATS_TYPE_NULL, __TASKSTATS_TYPE_MAX, }; enum { TASKSTATS_CMD_ATTR_UNSPEC = 0, TASKSTATS_CMD_ATTR_PID, TASKSTATS_CMD_ATTR_TGID, TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, __TASKSTATS_CMD_ATTR_MAX, }; struct cgroupstats { __u64 nr_sleeping; __u64 nr_running; __u64 nr_stopped; __u64 nr_uninterruptible; __u64 nr_io_wait; }; enum { CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, CGROUPSTATS_CMD_GET, CGROUPSTATS_CMD_NEW, __CGROUPSTATS_CMD_MAX, }; enum { CGROUPSTATS_TYPE_UNSPEC = 0, CGROUPSTATS_TYPE_CGROUP_STATS, __CGROUPSTATS_TYPE_MAX, }; enum { CGROUPSTATS_CMD_ATTR_UNSPEC = 0, CGROUPSTATS_CMD_ATTR_FD, __CGROUPSTATS_CMD_ATTR_MAX, }; struct ptr_heap { void **ptrs; int max; int size; int (*gt)(void *, void *); }; extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask, int (*gt)(void *, void *)); void heap_free(struct ptr_heap *heap); extern void *heap_insert(struct ptr_heap *heap, void *p); struct idr_layer { unsigned long bitmap; struct idr_layer *ary[1<<6]; int count; int layer; struct rcu_head rcu_head; }; struct idr { struct idr_layer *top; struct idr_layer *id_free; int layers; int id_free_cnt; spinlock_t lock; }; void *idr_find(struct idr *idp, int id); int idr_pre_get(struct idr *idp, gfp_t gfp_mask); int idr_get_new(struct idr *idp, void *ptr, int *id); int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); int idr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *data); void *idr_get_next(struct idr *idp, int *nextid); void *idr_replace(struct idr *idp, void *ptr, int id); void idr_remove(struct idr *idp, int id); void idr_remove_all(struct idr *idp); void idr_destroy(struct idr *idp); void idr_init(struct idr *idp); struct ida_bitmap { long nr_busy; unsigned long bitmap[(128 / sizeof(long) - 1)]; }; struct ida { struct idr idr; struct ida_bitmap *free_bitmap; }; int ida_pre_get(struct ida *ida, gfp_t gfp_mask); int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); int ida_get_new(struct ida *ida, int *p_id); void ida_remove(struct ida *ida, int id); void ida_destroy(struct ida *ida); void ida_init(struct ida *ida); int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end, gfp_t gfp_mask); void ida_simple_remove(struct ida *ida, unsigned int id); void __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) idr_init_cache(void); struct cgroupfs_root; struct cgroup_subsys; struct inode; struct cgroup; struct css_id; extern int cgroup_init_early(void); extern int cgroup_init(void); extern void cgroup_lock(void); extern int cgroup_lock_is_held(void); extern bool cgroup_lock_live_group(struct cgroup *cgrp); extern void cgroup_unlock(void); extern void cgroup_fork(struct task_struct *p); extern void cgroup_fork_callbacks(struct task_struct *p); extern void cgroup_post_fork(struct task_struct *p); extern void cgroup_exit(struct task_struct *p, int run_callbacks); extern int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry); extern int cgroup_load_subsys(struct cgroup_subsys *ss); extern void cgroup_unload_subsys(struct cgroup_subsys *ss); extern const struct file_operations proc_cgroup_operations; enum cgroup_subsys_id { cpuset_subsys_id, debug_subsys_id, cpu_cgroup_subsys_id, cpuacct_subsys_id, mem_cgroup_subsys_id, devices_subsys_id, freezer_subsys_id, perf_subsys_id, CGROUP_BUILTIN_SUBSYS_COUNT }; struct cgroup_subsys_state { struct cgroup *cgroup; atomic_t refcnt; unsigned long flags; struct css_id *id; }; enum { CSS_ROOT, CSS_REMOVED, }; static inline __attribute__((no_instrument_function)) void __css_get(struct cgroup_subsys_state *css, int count) { atomic_add(count, &css->refcnt); } static inline __attribute__((no_instrument_function)) void css_get(struct cgroup_subsys_state *css) { if (!(__builtin_constant_p((CSS_ROOT)) ? constant_test_bit((CSS_ROOT), (&css->flags)) : variable_test_bit((CSS_ROOT), (&css->flags)))) __css_get(css, 1); } static inline __attribute__((no_instrument_function)) bool css_is_removed(struct cgroup_subsys_state *css) { return (__builtin_constant_p((CSS_REMOVED)) ? constant_test_bit((CSS_REMOVED), (&css->flags)) : variable_test_bit((CSS_REMOVED), (&css->flags))); } static inline __attribute__((no_instrument_function)) bool css_tryget(struct cgroup_subsys_state *css) { if ((__builtin_constant_p((CSS_ROOT)) ? constant_test_bit((CSS_ROOT), (&css->flags)) : variable_test_bit((CSS_ROOT), (&css->flags)))) return true; while (!atomic_add_unless((&css->refcnt), 1, 0)) { if ((__builtin_constant_p((CSS_REMOVED)) ? constant_test_bit((CSS_REMOVED), (&css->flags)) : variable_test_bit((CSS_REMOVED), (&css->flags)))) return false; cpu_relax(); } return true; } extern void __css_put(struct cgroup_subsys_state *css, int count); static inline __attribute__((no_instrument_function)) void css_put(struct cgroup_subsys_state *css) { if (!(__builtin_constant_p((CSS_ROOT)) ? constant_test_bit((CSS_ROOT), (&css->flags)) : variable_test_bit((CSS_ROOT), (&css->flags)))) __css_put(css, 1); } enum { CGRP_REMOVED, CGRP_RELEASABLE, CGRP_NOTIFY_ON_RELEASE, CGRP_WAIT_ON_RMDIR, CGRP_CLONE_CHILDREN, }; struct cgroup { unsigned long flags; atomic_t count; struct list_head sibling; struct list_head children; struct cgroup *parent; struct dentry *dentry; struct cgroup_subsys_state *subsys[(8*sizeof(unsigned long))]; struct cgroupfs_root *root; struct cgroup *top_cgroup; struct list_head css_sets; struct list_head release_list; struct list_head pidlists; struct mutex pidlist_mutex; struct rcu_head rcu_head; struct list_head event_list; spinlock_t event_list_lock; }; struct css_set { atomic_t refcount; struct hlist_node hlist; struct list_head tasks; struct list_head cg_links; struct cgroup_subsys_state *subsys[(8*sizeof(unsigned long))]; struct rcu_head rcu_head; }; struct cgroup_map_cb { int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value); void *state; }; struct cftype { char name[64]; int private; umode_t mode; size_t max_write_len; int (*open)(struct inode *inode, struct file *file); ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, struct file *file, char *buf, size_t nbytes, loff_t *ppos); u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); int (*read_map)(struct cgroup *cont, struct cftype *cft, struct cgroup_map_cb *cb); int (*read_seq_string)(struct cgroup *cont, struct cftype *cft, struct seq_file *m); ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, struct file *file, const char *buf, size_t nbytes, loff_t *ppos); int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); int (*write_string)(struct cgroup *cgrp, struct cftype *cft, const char *buffer); int (*trigger)(struct cgroup *cgrp, unsigned int event); int (*release)(struct inode *inode, struct file *file); int (*register_event)(struct cgroup *cgrp, struct cftype *cft, struct eventfd_ctx *eventfd, const char *args); void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, struct eventfd_ctx *eventfd); }; struct cgroup_scanner { struct cgroup *cg; int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); void (*process_task)(struct task_struct *p, struct cgroup_scanner *scan); struct ptr_heap *heap; void *data; }; int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, const struct cftype *cft); int cgroup_add_files(struct cgroup *cgrp, struct cgroup_subsys *subsys, const struct cftype cft[], int count); int cgroup_is_removed(const struct cgroup *cgrp); int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); int cgroup_task_count(const struct cgroup *cgrp); int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); void cgroup_exclude_rmdir(struct cgroup_subsys_state *css); void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css); struct cgroup_taskset; struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset); int cgroup_taskset_size(struct cgroup_taskset *tset); struct cgroup_subsys { struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); int (*pre_destroy)(struct cgroup *cgrp); void (*destroy)(struct cgroup *cgrp); int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); void (*fork)(struct task_struct *task); void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, struct task_struct *task); int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp); void (*post_clone)(struct cgroup *cgrp); void (*bind)(struct cgroup *root); int subsys_id; int active; int disabled; int early_init; bool use_id; const char *name; struct mutex hierarchy_mutex; struct lock_class_key subsys_key; struct cgroupfs_root *root; struct list_head sibling; struct idr idr; spinlock_t id_lock; struct module *module; }; extern struct cgroup_subsys cpuset_subsys; extern struct cgroup_subsys debug_subsys; extern struct cgroup_subsys cpu_cgroup_subsys; extern struct cgroup_subsys cpuacct_subsys; extern struct cgroup_subsys mem_cgroup_subsys; extern struct cgroup_subsys devices_subsys; extern struct cgroup_subsys freezer_subsys; extern struct cgroup_subsys perf_subsys; static inline __attribute__((no_instrument_function)) struct cgroup_subsys_state *cgroup_subsys_state( struct cgroup *cgrp, int subsys_id) { return cgrp->subsys[subsys_id]; } static inline __attribute__((no_instrument_function)) struct cgroup_subsys_state * task_subsys_state(struct task_struct *task, int subsys_id) { return ({ typeof(*(task->cgroups->subsys[subsys_id])) *_________p1 = (typeof(*(task->cgroups->subsys[subsys_id]))* )(*(volatile typeof((task->cgroups->subsys[subsys_id])) *)&((task->cgroups->subsys[subsys_id]))); do { } while (0); ; do { } while (0); ((typeof(*(task->cgroups->subsys[subsys_id])) *)(_________p1)); }); } static inline __attribute__((no_instrument_function)) struct cgroup* task_cgroup(struct task_struct *task, int subsys_id) { return task_subsys_state(task, subsys_id)->cgroup; } struct cgroup_iter { struct list_head *cg_link; struct list_head *task; }; void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it); struct task_struct *cgroup_iter_next(struct cgroup *cgrp, struct cgroup_iter *it); void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); int cgroup_scan_tasks(struct cgroup_scanner *scan); int cgroup_attach_task(struct cgroup *, struct task_struct *); int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css); struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id); struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id, struct cgroup_subsys_state *root, int *foundid); bool css_is_ancestor(struct cgroup_subsys_state *cg, const struct cgroup_subsys_state *root); unsigned short css_id(struct cgroup_subsys_state *css); unsigned short css_depth(struct cgroup_subsys_state *css); struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); struct netprio_map { struct rcu_head rcu; u32 priomap_len; u32 priomap[]; }; struct cgroup_netprio_state { struct cgroup_subsys_state css; u32 prioidx; }; extern int net_prio_subsys_id; extern void sock_update_netprioidx(struct sock *sk); static inline __attribute__((no_instrument_function)) u32 task_netprioidx(struct task_struct *p) { struct cgroup_netprio_state *state; int subsys_id; u32 idx = 0; rcu_read_lock(); subsys_id = ({ typeof((net_prio_subsys_id)) _________p1 = (*(volatile typeof((net_prio_subsys_id)) *)&((net_prio_subsys_id))); do { } while (0); do { } while (0); (_________p1); }) ; if (subsys_id >= 0) { state = ({ const typeof( ((struct cgroup_netprio_state *)0)->css ) *__mptr = (task_subsys_state(p, subsys_id)); (struct cgroup_netprio_state *)( (char *)__mptr - __builtin_offsetof(struct cgroup_netprio_state,css) );}) ; idx = state->prioidx; } rcu_read_unlock(); return idx; } struct netpoll_info; struct device; struct phy_device; struct wireless_dev; enum netdev_tx { __NETDEV_TX_MIN = (-((int)(~0U>>1)) - 1), NETDEV_TX_OK = 0x00, NETDEV_TX_BUSY = 0x10, NETDEV_TX_LOCKED = 0x20, }; typedef enum netdev_tx netdev_tx_t; static inline __attribute__((no_instrument_function)) bool dev_xmit_complete(int rc) { if (ldv__builtin_expect(!!(rc < 0x0f), 1)) return true; return false; } struct net_device_stats { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_bytes; unsigned long tx_bytes; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long multicast; unsigned long collisions; unsigned long rx_length_errors; unsigned long rx_over_errors; unsigned long rx_crc_errors; unsigned long rx_frame_errors; unsigned long rx_fifo_errors; unsigned long rx_missed_errors; unsigned long tx_aborted_errors; unsigned long tx_carrier_errors; unsigned long tx_fifo_errors; unsigned long tx_heartbeat_errors; unsigned long tx_window_errors; unsigned long rx_compressed; unsigned long tx_compressed; }; enum { IF_PORT_UNKNOWN = 0, IF_PORT_10BASE2, IF_PORT_10BASET, IF_PORT_AUI, IF_PORT_100BASET, IF_PORT_100BASETX, IF_PORT_100BASEFX }; extern struct static_key rps_needed; struct neighbour; struct neigh_parms; struct sk_buff; struct netdev_hw_addr { struct list_head list; unsigned char addr[32]; unsigned char type; bool synced; bool global_use; int refcount; struct rcu_head rcu_head; }; struct netdev_hw_addr_list { struct list_head list; int count; }; struct hh_cache { u16 hh_len; u16 __pad; seqlock_t hh_lock; unsigned long hh_data[(((128)+(16 -1))&~(16 - 1)) / sizeof(long)]; }; struct header_ops { int (*create) (struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned len); int (*parse)(const struct sk_buff *skb, unsigned char *haddr); int (*rebuild)(struct sk_buff *skb); int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); void (*cache_update)(struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr); }; enum netdev_state_t { __LINK_STATE_START, __LINK_STATE_PRESENT, __LINK_STATE_NOCARRIER, __LINK_STATE_LINKWATCH_PENDING, __LINK_STATE_DORMANT, }; struct netdev_boot_setup { char name[16]; struct ifmap map; }; extern int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) netdev_boot_setup(char *str); struct napi_struct { struct list_head poll_list; unsigned long state; int weight; int (*poll)(struct napi_struct *, int); spinlock_t poll_lock; int poll_owner; unsigned int gro_count; struct net_device *dev; struct list_head dev_list; struct sk_buff *gro_list; struct sk_buff *skb; }; enum { NAPI_STATE_SCHED, NAPI_STATE_DISABLE, NAPI_STATE_NPSVC, }; enum gro_result { GRO_MERGED, GRO_MERGED_FREE, GRO_HELD, GRO_NORMAL, GRO_DROP, }; typedef enum gro_result gro_result_t; enum rx_handler_result { RX_HANDLER_CONSUMED, RX_HANDLER_ANOTHER, RX_HANDLER_EXACT, RX_HANDLER_PASS, }; typedef enum rx_handler_result rx_handler_result_t; typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); extern void __napi_schedule(struct napi_struct *n); static inline __attribute__((no_instrument_function)) bool napi_disable_pending(struct napi_struct *n) { return (__builtin_constant_p((NAPI_STATE_DISABLE)) ? constant_test_bit((NAPI_STATE_DISABLE), (&n->state)) : variable_test_bit((NAPI_STATE_DISABLE), (&n->state))); } static inline __attribute__((no_instrument_function)) bool napi_schedule_prep(struct napi_struct *n) { return !napi_disable_pending(n) && !test_and_set_bit(NAPI_STATE_SCHED, &n->state); } static inline __attribute__((no_instrument_function)) void napi_schedule(struct napi_struct *n) { if (napi_schedule_prep(n)) __napi_schedule(n); } static inline __attribute__((no_instrument_function)) bool napi_reschedule(struct napi_struct *napi) { if (napi_schedule_prep(napi)) { __napi_schedule(napi); return true; } return false; } extern void __napi_complete(struct napi_struct *n); extern void napi_complete(struct napi_struct *n); static inline __attribute__((no_instrument_function)) void napi_disable(struct napi_struct *n) { set_bit(NAPI_STATE_DISABLE, &n->state); while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) msleep(1); clear_bit(NAPI_STATE_DISABLE, &n->state); } static inline __attribute__((no_instrument_function)) void napi_enable(struct napi_struct *n) { do { if (ldv__builtin_expect(!!(!(__builtin_constant_p((NAPI_STATE_SCHED)) ? constant_test_bit((NAPI_STATE_SCHED), (&n->state)) : variable_test_bit((NAPI_STATE_SCHED), (&n->state)))), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/linux/netdevice.h"), "i" (497), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); __asm__ __volatile__("": : :"memory"); clear_bit(NAPI_STATE_SCHED, &n->state); } static inline __attribute__((no_instrument_function)) void napi_synchronize(const struct napi_struct *n) { while ((__builtin_constant_p((NAPI_STATE_SCHED)) ? constant_test_bit((NAPI_STATE_SCHED), (&n->state)) : variable_test_bit((NAPI_STATE_SCHED), (&n->state)))) msleep(1); } enum netdev_queue_state_t { __QUEUE_STATE_DRV_XOFF, __QUEUE_STATE_STACK_XOFF, __QUEUE_STATE_FROZEN, }; struct netdev_queue { struct net_device *dev; struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; struct kobject kobj; int numa_node; spinlock_t _xmit_lock __attribute__((__aligned__((1 << (6))))); int xmit_lock_owner; unsigned long trans_start; unsigned long trans_timeout; unsigned long state; struct dql dql; } __attribute__((__aligned__((1 << (6))))); static inline __attribute__((no_instrument_function)) int netdev_queue_numa_node_read(const struct netdev_queue *q) { return q->numa_node; } static inline __attribute__((no_instrument_function)) void netdev_queue_numa_node_write(struct netdev_queue *q, int node) { q->numa_node = node; } struct rps_map { unsigned int len; struct rcu_head rcu; u16 cpus[0]; }; struct rps_dev_flow { u16 cpu; u16 filter; unsigned int last_qtail; }; struct rps_dev_flow_table { unsigned int mask; struct rcu_head rcu; struct work_struct free_work; struct rps_dev_flow flows[0]; }; struct rps_sock_flow_table { unsigned int mask; u16 ents[0]; }; static inline __attribute__((no_instrument_function)) void rps_record_sock_flow(struct rps_sock_flow_table *table, u32 hash) { if (table && hash) { unsigned int cpu, index = hash & table->mask; cpu = (({ typeof(cpu_number) pfo_ret__; switch (sizeof(cpu_number)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (cpu_number)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; default: __bad_percpu_size(); } pfo_ret__; })); if (table->ents[index] != cpu) table->ents[index] = cpu; } } static inline __attribute__((no_instrument_function)) void rps_reset_sock_flow(struct rps_sock_flow_table *table, u32 hash) { if (table && hash) table->ents[hash & table->mask] = 0xffff; } extern struct rps_sock_flow_table *rps_sock_flow_table; extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id, u16 filter_id); struct netdev_rx_queue { struct rps_map *rps_map; struct rps_dev_flow_table *rps_flow_table; struct kobject kobj; struct net_device *dev; } __attribute__((__aligned__((1 << (6))))); struct xps_map { unsigned int len; unsigned int alloc_len; struct rcu_head rcu; u16 queues[0]; }; struct xps_dev_maps { struct rcu_head rcu; struct xps_map *cpu_map[0]; }; struct netdev_tc_txq { u16 count; u16 offset; }; struct netdev_fcoe_hbainfo { char manufacturer[64]; char serial_number[64]; char hardware_version[64]; char driver_version[64]; char optionrom_version[64]; char firmware_version[64]; char model[256]; char model_description[256]; }; struct net_device_ops { int (*ndo_init)(struct net_device *dev); void (*ndo_uninit)(struct net_device *dev); int (*ndo_open)(struct net_device *dev); int (*ndo_stop)(struct net_device *dev); netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, struct net_device *dev); u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); void (*ndo_change_rx_flags)(struct net_device *dev, int flags); void (*ndo_set_rx_mode)(struct net_device *dev); int (*ndo_set_mac_address)(struct net_device *dev, void *addr); int (*ndo_validate_addr)(struct net_device *dev); int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); int (*ndo_set_config)(struct net_device *dev, struct ifmap *map); int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); int (*ndo_neigh_setup)(struct net_device *dev, struct neigh_parms *); void (*ndo_tx_timeout) (struct net_device *dev); struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, struct rtnl_link_stats64 *storage); struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); void (*ndo_poll_controller)(struct net_device *dev); int (*ndo_netpoll_setup)(struct net_device *dev, struct netpoll_info *info); void (*ndo_netpoll_cleanup)(struct net_device *dev); int (*ndo_set_vf_mac)(struct net_device *dev, int queue, u8 *mac); int (*ndo_set_vf_vlan)(struct net_device *dev, int queue, u16 vlan, u8 qos); int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); int (*ndo_get_vf_config)(struct net_device *dev, int vf, struct ifla_vf_info *ivf); int (*ndo_set_vf_port)(struct net_device *dev, int vf, struct nlattr *port[]); int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); int (*ndo_setup_tc)(struct net_device *dev, u8 tc); int (*ndo_fcoe_enable)(struct net_device *dev); int (*ndo_fcoe_disable)(struct net_device *dev); int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid, struct scatterlist *sgl, unsigned int sgc); int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid); int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid, struct scatterlist *sgl, unsigned int sgc); int (*ndo_fcoe_get_hbainfo)(struct net_device *dev, struct netdev_fcoe_hbainfo *hbainfo); int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id); int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); netdev_features_t (*ndo_fix_features)(struct net_device *dev, netdev_features_t features); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct neighbour *n); void (*ndo_neigh_destroy)(struct neighbour *n); }; struct net_device { char name[16]; struct pm_qos_request pm_qos_req; struct hlist_node name_hlist; char *ifalias; unsigned long mem_end; unsigned long mem_start; unsigned long base_addr; unsigned int irq; unsigned long state; struct list_head dev_list; struct list_head napi_list; struct list_head unreg_list; netdev_features_t features; netdev_features_t hw_features; netdev_features_t wanted_features; netdev_features_t vlan_features; int ifindex; int iflink; struct net_device_stats stats; atomic_long_t rx_dropped; const struct iw_handler_def * wireless_handlers; struct iw_public_data * wireless_data; const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; const struct header_ops *header_ops; unsigned int flags; unsigned int priv_flags; unsigned short gflags; unsigned short padded; unsigned char operstate; unsigned char link_mode; unsigned char if_port; unsigned char dma; unsigned int mtu; unsigned short type; unsigned short hard_header_len; unsigned short needed_headroom; unsigned short needed_tailroom; unsigned char perm_addr[32]; unsigned char addr_assign_type; unsigned char addr_len; unsigned char neigh_priv_len; unsigned short dev_id; spinlock_t addr_list_lock; struct netdev_hw_addr_list uc; struct netdev_hw_addr_list mc; bool uc_promisc; unsigned int promiscuity; unsigned int allmulti; struct vlan_info *vlan_info; struct dsa_switch_tree *dsa_ptr; void *atalk_ptr; struct in_device *ip_ptr; struct dn_dev *dn_ptr; struct inet6_dev *ip6_ptr; void *ec_ptr; void *ax25_ptr; struct wireless_dev *ieee80211_ptr; unsigned long last_rx; struct net_device *master; unsigned char *dev_addr; struct netdev_hw_addr_list dev_addrs; unsigned char broadcast[32]; struct kset *queues_kset; struct netdev_rx_queue *_rx; unsigned int num_rx_queues; unsigned int real_num_rx_queues; struct cpu_rmap *rx_cpu_rmap; rx_handler_func_t *rx_handler; void *rx_handler_data; struct netdev_queue *ingress_queue; struct netdev_queue *_tx __attribute__((__aligned__((1 << (6))))); unsigned int num_tx_queues; unsigned int real_num_tx_queues; struct Qdisc *qdisc; unsigned long tx_queue_len; spinlock_t tx_global_lock; struct xps_dev_maps *xps_maps; unsigned long trans_start; int watchdog_timeo; struct timer_list watchdog_timer; int *pcpu_refcnt; struct list_head todo_list; struct hlist_node index_hlist; struct list_head link_watch_list; enum { NETREG_UNINITIALIZED=0, NETREG_REGISTERED, NETREG_UNREGISTERING, NETREG_UNREGISTERED, NETREG_RELEASED, NETREG_DUMMY, } reg_state:8; bool dismantle; enum { RTNL_LINK_INITIALIZED, RTNL_LINK_INITIALIZING, } rtnl_link_state:16; void (*destructor)(struct net_device *dev); struct netpoll_info *npinfo; struct net *nd_net; union { void *ml_priv; struct pcpu_lstats *lstats; struct pcpu_tstats *tstats; struct pcpu_dstats *dstats; }; struct garp_port *garp_port; struct device dev; const struct attribute_group *sysfs_groups[4]; const struct rtnl_link_ops *rtnl_link_ops; unsigned int gso_max_size; const struct dcbnl_rtnl_ops *dcbnl_ops; u8 num_tc; struct netdev_tc_txq tc_to_txq[16]; u8 prio_tc_map[15 + 1]; unsigned int fcoe_ddp_xid; struct netprio_map *priomap; struct phy_device *phydev; int group; }; static inline __attribute__((no_instrument_function)) int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio) { return dev->prio_tc_map[prio & 15]; } static inline __attribute__((no_instrument_function)) int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc) { if (tc >= dev->num_tc) return -22; dev->prio_tc_map[prio & 15] = tc & 15; return 0; } static inline __attribute__((no_instrument_function)) void netdev_reset_tc(struct net_device *dev) { dev->num_tc = 0; memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq)); memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map)); } static inline __attribute__((no_instrument_function)) int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset) { if (tc >= dev->num_tc) return -22; dev->tc_to_txq[tc].count = count; dev->tc_to_txq[tc].offset = offset; return 0; } static inline __attribute__((no_instrument_function)) int netdev_set_num_tc(struct net_device *dev, u8 num_tc) { if (num_tc > 16) return -22; dev->num_tc = num_tc; return 0; } static inline __attribute__((no_instrument_function)) int netdev_get_num_tc(struct net_device *dev) { return dev->num_tc; } static inline __attribute__((no_instrument_function)) struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, unsigned int index) { return &dev->_tx[index]; } static inline __attribute__((no_instrument_function)) void netdev_for_each_tx_queue(struct net_device *dev, void (*f)(struct net_device *, struct netdev_queue *, void *), void *arg) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) f(dev, &dev->_tx[i], arg); } static inline __attribute__((no_instrument_function)) struct net *dev_net(const struct net_device *dev) { return read_pnet(&dev->nd_net); } static inline __attribute__((no_instrument_function)) void dev_net_set(struct net_device *dev, struct net *net) { release_net(dev->nd_net); dev->nd_net = hold_net(net); } static inline __attribute__((no_instrument_function)) bool netdev_uses_dsa_tags(struct net_device *dev) { if (dev->dsa_ptr != ((void *)0)) return dsa_uses_dsa_tags(dev->dsa_ptr); return 0; } static inline __attribute__((no_instrument_function)) bool netdev_uses_trailer_tags(struct net_device *dev) { if (dev->dsa_ptr != ((void *)0)) return dsa_uses_trailer_tags(dev->dsa_ptr); return 0; } static inline __attribute__((no_instrument_function)) void *netdev_priv(const struct net_device *dev) { return (char *)dev + ((((sizeof(struct net_device))) + ((typeof((sizeof(struct net_device))))((32)) - 1)) & ~((typeof((sizeof(struct net_device))))((32)) - 1)); } void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight); void netif_napi_del(struct napi_struct *napi); struct napi_gro_cb { void *frag0; unsigned int frag0_len; int data_offset; int same_flow; int flush; int count; int free; }; struct packet_type { __be16 type; struct net_device *dev; int (*func) (struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); struct sk_buff *(*gso_segment)(struct sk_buff *skb, netdev_features_t features); int (*gso_send_check)(struct sk_buff *skb); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); int (*gro_complete)(struct sk_buff *skb); void *af_packet_priv; struct list_head list; }; extern int register_netdevice_notifier(struct notifier_block *nb); extern int unregister_netdevice_notifier(struct notifier_block *nb); extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); extern rwlock_t dev_base_lock; static inline __attribute__((no_instrument_function)) struct net_device *next_net_device(struct net_device *dev) { struct list_head *lh; struct net *net; net = dev_net(dev); lh = dev->dev_list.next; return lh == &net->dev_base_head ? ((void *)0) : ({ const typeof( ((struct net_device *)0)->dev_list ) *__mptr = (lh); (struct net_device *)( (char *)__mptr - __builtin_offsetof(struct net_device,dev_list) );}); } static inline __attribute__((no_instrument_function)) struct net_device *next_net_device_rcu(struct net_device *dev) { struct list_head *lh; struct net *net; net = dev_net(dev); lh = ({ typeof(*((*((struct list_head **)(&(&dev->dev_list)->next))))) *_________p1 = (typeof(*((*((struct list_head **)(&(&dev->dev_list)->next)))))* )(*(volatile typeof(((*((struct list_head **)(&(&dev->dev_list)->next))))) *)&(((*((struct list_head **)(&(&dev->dev_list)->next)))))); do { } while (0); ; do { } while (0); ((typeof(*((*((struct list_head **)(&(&dev->dev_list)->next))))) *)(_________p1)); }); return lh == &net->dev_base_head ? ((void *)0) : ({ const typeof( ((struct net_device *)0)->dev_list ) *__mptr = (lh); (struct net_device *)( (char *)__mptr - __builtin_offsetof(struct net_device,dev_list) );}); } static inline __attribute__((no_instrument_function)) struct net_device *first_net_device(struct net *net) { return list_empty(&net->dev_base_head) ? ((void *)0) : ({ const typeof( ((struct net_device *)0)->dev_list ) *__mptr = (net->dev_base_head.next); (struct net_device *)( (char *)__mptr - __builtin_offsetof(struct net_device,dev_list) );}); } static inline __attribute__((no_instrument_function)) struct net_device *first_net_device_rcu(struct net *net) { struct list_head *lh = ({ typeof(*((*((struct list_head **)(&(&net->dev_base_head)->next))))) *_________p1 = (typeof(*((*((struct list_head **)(&(&net->dev_base_head)->next)))))* )(*(volatile typeof(((*((struct list_head **)(&(&net->dev_base_head)->next))))) *)&(((*((struct list_head **)(&(&net->dev_base_head)->next)))))); do { } while (0); ; do { } while (0); ((typeof(*((*((struct list_head **)(&(&net->dev_base_head)->next))))) *)(_________p1)); }); return lh == &net->dev_base_head ? ((void *)0) : ({ const typeof( ((struct net_device *)0)->dev_list ) *__mptr = (lh); (struct net_device *)( (char *)__mptr - __builtin_offsetof(struct net_device,dev_list) );}); } extern int netdev_boot_setup_check(struct net_device *dev); extern unsigned long netdev_boot_base(const char *prefix, int unit); extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, const char *hwaddr); extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); extern void __dev_remove_pack(struct packet_type *pt); extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, unsigned short mask); extern struct net_device *dev_get_by_name(struct net *net, const char *name); extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); extern struct net_device *__dev_get_by_name(struct net *net, const char *name); extern int dev_alloc_name(struct net_device *dev, const char *name); extern int dev_open(struct net_device *dev); extern int dev_close(struct net_device *dev); extern void dev_disable_lro(struct net_device *dev); extern int dev_queue_xmit(struct sk_buff *skb); extern int register_netdevice(struct net_device *dev); extern void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); extern void unregister_netdevice_many(struct list_head *head); static inline __attribute__((no_instrument_function)) void unregister_netdevice(struct net_device *dev) { unregister_netdevice_queue(dev, ((void *)0)); } extern int netdev_refcnt_read(const struct net_device *dev); extern void free_netdev(struct net_device *dev); extern void synchronize_net(void); extern int init_dummy_netdev(struct net_device *dev); extern void netdev_resync_ops(struct net_device *dev); extern struct net_device *dev_get_by_index(struct net *net, int ifindex); extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); extern int dev_restart(struct net_device *dev); extern int netpoll_trap(void); extern int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); extern void skb_gro_reset_offset(struct sk_buff *skb); static inline __attribute__((no_instrument_function)) unsigned int skb_gro_offset(const struct sk_buff *skb) { return ((struct napi_gro_cb *)(skb)->cb)->data_offset; } static inline __attribute__((no_instrument_function)) unsigned int skb_gro_len(const struct sk_buff *skb) { return skb->len - ((struct napi_gro_cb *)(skb)->cb)->data_offset; } static inline __attribute__((no_instrument_function)) void skb_gro_pull(struct sk_buff *skb, unsigned int len) { ((struct napi_gro_cb *)(skb)->cb)->data_offset += len; } static inline __attribute__((no_instrument_function)) void *skb_gro_header_fast(struct sk_buff *skb, unsigned int offset) { return ((struct napi_gro_cb *)(skb)->cb)->frag0 + offset; } static inline __attribute__((no_instrument_function)) int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen) { return ((struct napi_gro_cb *)(skb)->cb)->frag0_len < hlen; } static inline __attribute__((no_instrument_function)) void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen, unsigned int offset) { if (!pskb_may_pull(skb, hlen)) return ((void *)0); ((struct napi_gro_cb *)(skb)->cb)->frag0 = ((void *)0); ((struct napi_gro_cb *)(skb)->cb)->frag0_len = 0; return skb->data + offset; } static inline __attribute__((no_instrument_function)) void *skb_gro_mac_header(struct sk_buff *skb) { return ((struct napi_gro_cb *)(skb)->cb)->frag0 ?: skb_mac_header(skb); } static inline __attribute__((no_instrument_function)) void *skb_gro_network_header(struct sk_buff *skb) { return (((struct napi_gro_cb *)(skb)->cb)->frag0 ?: skb->data) + skb_network_offset(skb); } static inline __attribute__((no_instrument_function)) int dev_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned len) { if (!dev->header_ops || !dev->header_ops->create) return 0; return dev->header_ops->create(skb, dev, type, daddr, saddr, len); } static inline __attribute__((no_instrument_function)) int dev_parse_header(const struct sk_buff *skb, unsigned char *haddr) { const struct net_device *dev = skb->dev; if (!dev->header_ops || !dev->header_ops->parse) return 0; return dev->header_ops->parse(skb, haddr); } typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len); extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); static inline __attribute__((no_instrument_function)) int unregister_gifconf(unsigned int family) { return register_gifconf(family, ((void *)0)); } struct softnet_data { struct Qdisc *output_queue; struct Qdisc **output_queue_tailp; struct list_head poll_list; struct sk_buff *completion_queue; struct sk_buff_head process_queue; unsigned int processed; unsigned int time_squeeze; unsigned int cpu_collision; unsigned int received_rps; struct softnet_data *rps_ipi_list; struct call_single_data csd __attribute__((__aligned__((1 << (6))))); struct softnet_data *rps_ipi_next; unsigned int cpu; unsigned int input_queue_head; unsigned int input_queue_tail; unsigned dropped; struct sk_buff_head input_pkt_queue; struct napi_struct backlog; }; static inline __attribute__((no_instrument_function)) void input_queue_head_incr(struct softnet_data *sd) { sd->input_queue_head++; } static inline __attribute__((no_instrument_function)) void input_queue_tail_incr_save(struct softnet_data *sd, unsigned int *qtail) { *qtail = ++sd->input_queue_tail; } extern __attribute__((section(".discard"), unused)) char __pcpu_scope_softnet_data; extern __attribute__((section(".data..percpu" ""))) __typeof__(struct softnet_data) softnet_data __attribute__((__aligned__((1 << (6))))); extern void __netif_schedule(struct Qdisc *q); static inline __attribute__((no_instrument_function)) void netif_schedule_queue(struct netdev_queue *txq) { if (!(txq->state & ((1 << __QUEUE_STATE_DRV_XOFF) | (1 << __QUEUE_STATE_STACK_XOFF)))) __netif_schedule(txq->qdisc); } static inline __attribute__((no_instrument_function)) void netif_tx_schedule_all(struct net_device *dev) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) netif_schedule_queue(netdev_get_tx_queue(dev, i)); } static inline __attribute__((no_instrument_function)) void netif_tx_start_queue(struct netdev_queue *dev_queue) { clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); } static inline __attribute__((no_instrument_function)) void netif_start_queue(struct net_device *dev) { netif_tx_start_queue(netdev_get_tx_queue(dev, 0)); } static inline __attribute__((no_instrument_function)) void netif_tx_start_all_queues(struct net_device *dev) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); netif_tx_start_queue(txq); } } static inline __attribute__((no_instrument_function)) void netif_tx_wake_queue(struct netdev_queue *dev_queue) { if (netpoll_trap()) { netif_tx_start_queue(dev_queue); return; } if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) __netif_schedule(dev_queue->qdisc); } static inline __attribute__((no_instrument_function)) void netif_wake_queue(struct net_device *dev) { netif_tx_wake_queue(netdev_get_tx_queue(dev, 0)); } static inline __attribute__((no_instrument_function)) void netif_tx_wake_all_queues(struct net_device *dev) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); netif_tx_wake_queue(txq); } } static inline __attribute__((no_instrument_function)) void netif_tx_stop_queue(struct netdev_queue *dev_queue) { if (({ int __ret_warn_on = !!(!dev_queue); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/linux/netdevice.h", 1834); ldv__builtin_expect(!!(__ret_warn_on), 0); })) { printk("<6>" "netif_stop_queue() cannot be called before register_netdev()\n"); return; } set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); } static inline __attribute__((no_instrument_function)) void netif_stop_queue(struct net_device *dev) { netif_tx_stop_queue(netdev_get_tx_queue(dev, 0)); } static inline __attribute__((no_instrument_function)) void netif_tx_stop_all_queues(struct net_device *dev) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); netif_tx_stop_queue(txq); } } static inline __attribute__((no_instrument_function)) bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) { return (__builtin_constant_p((__QUEUE_STATE_DRV_XOFF)) ? constant_test_bit((__QUEUE_STATE_DRV_XOFF), (&dev_queue->state)) : variable_test_bit((__QUEUE_STATE_DRV_XOFF), (&dev_queue->state))); } static inline __attribute__((no_instrument_function)) bool netif_queue_stopped(const struct net_device *dev) { return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); } static inline __attribute__((no_instrument_function)) bool netif_xmit_stopped(const struct netdev_queue *dev_queue) { return dev_queue->state & ((1 << __QUEUE_STATE_DRV_XOFF) | (1 << __QUEUE_STATE_STACK_XOFF)); } static inline __attribute__((no_instrument_function)) bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) { return dev_queue->state & (((1 << __QUEUE_STATE_DRV_XOFF) | (1 << __QUEUE_STATE_STACK_XOFF)) | (1 << __QUEUE_STATE_FROZEN)); } static inline __attribute__((no_instrument_function)) void netdev_tx_sent_queue(struct netdev_queue *dev_queue, unsigned int bytes) { dql_queued(&dev_queue->dql, bytes); if (ldv__builtin_expect(!!(dql_avail(&dev_queue->dql) >= 0), 1)) return; set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); asm volatile("mfence":::"memory"); if (ldv__builtin_expect(!!(dql_avail(&dev_queue->dql) >= 0), 0)) clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); } static inline __attribute__((no_instrument_function)) void netdev_sent_queue(struct net_device *dev, unsigned int bytes) { netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); } static inline __attribute__((no_instrument_function)) void netdev_tx_completed_queue(struct netdev_queue *dev_queue, unsigned pkts, unsigned bytes) { if (ldv__builtin_expect(!!(!bytes), 0)) return; dql_completed(&dev_queue->dql, bytes); asm volatile("mfence":::"memory"); if (dql_avail(&dev_queue->dql) < 0) return; if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state)) netif_schedule_queue(dev_queue); } static inline __attribute__((no_instrument_function)) void netdev_completed_queue(struct net_device *dev, unsigned pkts, unsigned bytes) { netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); } static inline __attribute__((no_instrument_function)) void netdev_tx_reset_queue(struct netdev_queue *q) { clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state); dql_reset(&q->dql); } static inline __attribute__((no_instrument_function)) void netdev_reset_queue(struct net_device *dev_queue) { netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); } static inline __attribute__((no_instrument_function)) bool netif_running(const struct net_device *dev) { return (__builtin_constant_p((__LINK_STATE_START)) ? constant_test_bit((__LINK_STATE_START), (&dev->state)) : variable_test_bit((__LINK_STATE_START), (&dev->state))); } static inline __attribute__((no_instrument_function)) void netif_start_subqueue(struct net_device *dev, u16 queue_index) { struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); netif_tx_start_queue(txq); } static inline __attribute__((no_instrument_function)) void netif_stop_subqueue(struct net_device *dev, u16 queue_index) { struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); if (netpoll_trap()) return; netif_tx_stop_queue(txq); } static inline __attribute__((no_instrument_function)) bool __netif_subqueue_stopped(const struct net_device *dev, u16 queue_index) { struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); return netif_tx_queue_stopped(txq); } static inline __attribute__((no_instrument_function)) bool netif_subqueue_stopped(const struct net_device *dev, struct sk_buff *skb) { return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); } static inline __attribute__((no_instrument_function)) void netif_wake_subqueue(struct net_device *dev, u16 queue_index) { struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); if (netpoll_trap()) return; if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) __netif_schedule(txq->qdisc); } static inline __attribute__((no_instrument_function)) u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) { return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); } static inline __attribute__((no_instrument_function)) bool netif_is_multiqueue(const struct net_device *dev) { return dev->num_tx_queues > 1; } extern int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq); extern int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); static inline __attribute__((no_instrument_function)) int netif_copy_real_num_queues(struct net_device *to_dev, const struct net_device *from_dev) { netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues); return netif_set_real_num_rx_queues(to_dev, from_dev->real_num_rx_queues); } extern void dev_kfree_skb_irq(struct sk_buff *skb); extern void dev_kfree_skb_any(struct sk_buff *skb); extern int netif_rx(struct sk_buff *skb); extern int netif_rx_ni(struct sk_buff *skb); extern int netif_receive_skb(struct sk_buff *skb); extern gro_result_t dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb); extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); extern gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); extern void napi_gro_flush(struct napi_struct *napi); extern struct sk_buff * napi_get_frags(struct napi_struct *napi); extern gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, gro_result_t ret); extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); extern gro_result_t napi_gro_frags(struct napi_struct *napi); static inline __attribute__((no_instrument_function)) void napi_free_frags(struct napi_struct *napi) { kfree_skb(napi->skb); napi->skb = ((void *)0); } extern int netdev_rx_handler_register(struct net_device *dev, rx_handler_func_t *rx_handler, void *rx_handler_data); extern void netdev_rx_handler_unregister(struct net_device *dev); extern bool dev_valid_name(const char *name); extern int dev_ioctl(struct net *net, unsigned int cmd, void *); extern int dev_ethtool(struct net *net, struct ifreq *); extern unsigned dev_get_flags(const struct net_device *); extern int __dev_change_flags(struct net_device *, unsigned int flags); extern int dev_change_flags(struct net_device *, unsigned); extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); extern int dev_change_name(struct net_device *, const char *); extern int dev_set_alias(struct net_device *, const char *, size_t); extern int dev_change_net_namespace(struct net_device *, struct net *, const char *); extern int dev_set_mtu(struct net_device *, int); extern void dev_set_group(struct net_device *, int); extern int dev_set_mac_address(struct net_device *, struct sockaddr *); extern int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq); extern int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); extern int netdev_budget; extern void netdev_run_todo(void); static inline __attribute__((no_instrument_function)) void dev_put(struct net_device *dev) { do { do { const void *__vpp_verify = (typeof(&((((*dev->pcpu_refcnt))))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof((((*dev->pcpu_refcnt))))) { case 1: do { typedef typeof(((((*dev->pcpu_refcnt))))) pao_T__; const int pao_ID__ = (__builtin_constant_p((-(1))) && (((-(1))) == 1 || ((-(1))) == -1)) ? ((-(1))) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((-(1))); (void)pao_tmp__; } switch (sizeof(((((*dev->pcpu_refcnt)))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "qi" ((pao_T__)((-(1))))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "re" ((pao_T__)((-(1))))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof(((((*dev->pcpu_refcnt))))) pao_T__; const int pao_ID__ = (__builtin_constant_p((-(1))) && (((-(1))) == 1 || ((-(1))) == -1)) ? ((-(1))) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((-(1))); (void)pao_tmp__; } switch (sizeof(((((*dev->pcpu_refcnt)))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "qi" ((pao_T__)((-(1))))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "re" ((pao_T__)((-(1))))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof(((((*dev->pcpu_refcnt))))) pao_T__; const int pao_ID__ = (__builtin_constant_p((-(1))) && (((-(1))) == 1 || ((-(1))) == -1)) ? ((-(1))) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((-(1))); (void)pao_tmp__; } switch (sizeof(((((*dev->pcpu_refcnt)))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "qi" ((pao_T__)((-(1))))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "re" ((pao_T__)((-(1))))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof(((((*dev->pcpu_refcnt))))) pao_T__; const int pao_ID__ = (__builtin_constant_p((-(1))) && (((-(1))) == 1 || ((-(1))) == -1)) ? ((-(1))) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((-(1))); (void)pao_tmp__; } switch (sizeof(((((*dev->pcpu_refcnt)))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "qi" ((pao_T__)((-(1))))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "ri" ((pao_T__)((-(1))))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt)))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" (((((*dev->pcpu_refcnt))))) : "re" ((pao_T__)((-(1))))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } static inline __attribute__((no_instrument_function)) void dev_hold(struct net_device *dev) { do { do { const void *__vpp_verify = (typeof(&(((*dev->pcpu_refcnt)))))((void *)0); (void)__vpp_verify; } while (0); switch(sizeof(((*dev->pcpu_refcnt)))) { case 1: do { typedef typeof((((*dev->pcpu_refcnt)))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((*dev->pcpu_refcnt))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 2: do { typedef typeof((((*dev->pcpu_refcnt)))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((*dev->pcpu_refcnt))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 4: do { typedef typeof((((*dev->pcpu_refcnt)))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((*dev->pcpu_refcnt))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; case 8: do { typedef typeof((((*dev->pcpu_refcnt)))) pao_T__; const int pao_ID__ = (__builtin_constant_p((1)) && (((1)) == 1 || ((1)) == -1)) ? ((1)) : 0; if (0) { pao_T__ pao_tmp__; pao_tmp__ = ((1)); (void)pao_tmp__; } switch (sizeof((((*dev->pcpu_refcnt))))) { case 1: if (pao_ID__ == 1) asm("incb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decb ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addb %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "qi" ((pao_T__)((1)))); break; case 2: if (pao_ID__ == 1) asm("incw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decw ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addw %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 4: if (pao_ID__ == 1) asm("incl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decl ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addl %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "ri" ((pao_T__)((1)))); break; case 8: if (pao_ID__ == 1) asm("incq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else if (pao_ID__ == -1) asm("decq ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt))))); else asm("addq %1, ""%%""gs"":" "%P" "0" : "+m" ((((*dev->pcpu_refcnt)))) : "re" ((pao_T__)((1)))); break; default: __bad_percpu_size(); } } while (0);break; default: __bad_size_call_parameter();break; } } while (0); } extern void linkwatch_fire_event(struct net_device *dev); extern void linkwatch_forget_dev(struct net_device *dev); static inline __attribute__((no_instrument_function)) bool netif_carrier_ok(const struct net_device *dev) { return !(__builtin_constant_p((__LINK_STATE_NOCARRIER)) ? constant_test_bit((__LINK_STATE_NOCARRIER), (&dev->state)) : variable_test_bit((__LINK_STATE_NOCARRIER), (&dev->state))); } extern unsigned long dev_trans_start(struct net_device *dev); extern void __netdev_watchdog_up(struct net_device *dev); extern void netif_carrier_on(struct net_device *dev); extern void netif_carrier_off(struct net_device *dev); extern void netif_notify_peers(struct net_device *dev); static inline __attribute__((no_instrument_function)) void netif_dormant_on(struct net_device *dev) { if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) linkwatch_fire_event(dev); } static inline __attribute__((no_instrument_function)) void netif_dormant_off(struct net_device *dev) { if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) linkwatch_fire_event(dev); } static inline __attribute__((no_instrument_function)) bool netif_dormant(const struct net_device *dev) { return (__builtin_constant_p((__LINK_STATE_DORMANT)) ? constant_test_bit((__LINK_STATE_DORMANT), (&dev->state)) : variable_test_bit((__LINK_STATE_DORMANT), (&dev->state))); } static inline __attribute__((no_instrument_function)) bool netif_oper_up(const struct net_device *dev) { return (dev->operstate == IF_OPER_UP || dev->operstate == IF_OPER_UNKNOWN ); } static inline __attribute__((no_instrument_function)) bool netif_device_present(struct net_device *dev) { return (__builtin_constant_p((__LINK_STATE_PRESENT)) ? constant_test_bit((__LINK_STATE_PRESENT), (&dev->state)) : variable_test_bit((__LINK_STATE_PRESENT), (&dev->state))); } extern void netif_device_detach(struct net_device *dev); extern void netif_device_attach(struct net_device *dev); enum { NETIF_MSG_DRV = 0x0001, NETIF_MSG_PROBE = 0x0002, NETIF_MSG_LINK = 0x0004, NETIF_MSG_TIMER = 0x0008, NETIF_MSG_IFDOWN = 0x0010, NETIF_MSG_IFUP = 0x0020, NETIF_MSG_RX_ERR = 0x0040, NETIF_MSG_TX_ERR = 0x0080, NETIF_MSG_TX_QUEUED = 0x0100, NETIF_MSG_INTR = 0x0200, NETIF_MSG_TX_DONE = 0x0400, NETIF_MSG_RX_STATUS = 0x0800, NETIF_MSG_PKTDATA = 0x1000, NETIF_MSG_HW = 0x2000, NETIF_MSG_WOL = 0x4000, }; static inline __attribute__((no_instrument_function)) u32 netif_msg_init(int debug_value, int default_msg_enable_bits) { if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) return default_msg_enable_bits; if (debug_value == 0) return 0; return (1 << debug_value) - 1; } static inline __attribute__((no_instrument_function)) void __netif_tx_lock(struct netdev_queue *txq, int cpu) { spin_lock(&txq->_xmit_lock); txq->xmit_lock_owner = cpu; } static inline __attribute__((no_instrument_function)) void __netif_tx_lock_bh(struct netdev_queue *txq) { spin_lock_bh(&txq->_xmit_lock); txq->xmit_lock_owner = (({ typeof(cpu_number) pfo_ret__; switch (sizeof(cpu_number)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (cpu_number)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; default: __bad_percpu_size(); } pfo_ret__; })); } static inline __attribute__((no_instrument_function)) bool __netif_tx_trylock(struct netdev_queue *txq) { bool ok = spin_trylock(&txq->_xmit_lock); if (ldv__builtin_expect(!!(ok), 1)) txq->xmit_lock_owner = (({ typeof(cpu_number) pfo_ret__; switch (sizeof(cpu_number)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (cpu_number)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; default: __bad_percpu_size(); } pfo_ret__; })); return ok; } static inline __attribute__((no_instrument_function)) void __netif_tx_unlock(struct netdev_queue *txq) { txq->xmit_lock_owner = -1; spin_unlock(&txq->_xmit_lock); } static inline __attribute__((no_instrument_function)) void __netif_tx_unlock_bh(struct netdev_queue *txq) { txq->xmit_lock_owner = -1; spin_unlock_bh(&txq->_xmit_lock); } static inline __attribute__((no_instrument_function)) void txq_trans_update(struct netdev_queue *txq) { if (txq->xmit_lock_owner != -1) txq->trans_start = jiffies; } static inline __attribute__((no_instrument_function)) void netif_tx_lock(struct net_device *dev) { unsigned int i; int cpu; spin_lock(&dev->tx_global_lock); cpu = (({ typeof(cpu_number) pfo_ret__; switch (sizeof(cpu_number)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (cpu_number)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; default: __bad_percpu_size(); } pfo_ret__; })); for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); __netif_tx_lock(txq, cpu); set_bit(__QUEUE_STATE_FROZEN, &txq->state); __netif_tx_unlock(txq); } } static inline __attribute__((no_instrument_function)) void netif_tx_lock_bh(struct net_device *dev) { local_bh_disable(); netif_tx_lock(dev); } static inline __attribute__((no_instrument_function)) void netif_tx_unlock(struct net_device *dev) { unsigned int i; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); clear_bit(__QUEUE_STATE_FROZEN, &txq->state); netif_schedule_queue(txq); } spin_unlock(&dev->tx_global_lock); } static inline __attribute__((no_instrument_function)) void netif_tx_unlock_bh(struct net_device *dev) { netif_tx_unlock(dev); local_bh_enable(); } static inline __attribute__((no_instrument_function)) void netif_tx_disable(struct net_device *dev) { unsigned int i; int cpu; local_bh_disable(); cpu = (({ typeof(cpu_number) pfo_ret__; switch (sizeof(cpu_number)) { case 1: asm("mov" "b ""%%""gs"":" "%P" "1"",%0" : "=q" (pfo_ret__) : "m" (cpu_number)); break; case 2: asm("mov" "w ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 4: asm("mov" "l ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; case 8: asm("mov" "q ""%%""gs"":" "%P" "1"",%0" : "=r" (pfo_ret__) : "m" (cpu_number)); break; default: __bad_percpu_size(); } pfo_ret__; })); for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); __netif_tx_lock(txq, cpu); netif_tx_stop_queue(txq); __netif_tx_unlock(txq); } local_bh_enable(); } static inline __attribute__((no_instrument_function)) void netif_addr_lock(struct net_device *dev) { spin_lock(&dev->addr_list_lock); } static inline __attribute__((no_instrument_function)) void netif_addr_lock_nested(struct net_device *dev) { do { _raw_spin_lock(spinlock_check(&dev->addr_list_lock)); } while (0); } static inline __attribute__((no_instrument_function)) void netif_addr_lock_bh(struct net_device *dev) { spin_lock_bh(&dev->addr_list_lock); } static inline __attribute__((no_instrument_function)) void netif_addr_unlock(struct net_device *dev) { spin_unlock(&dev->addr_list_lock); } static inline __attribute__((no_instrument_function)) void netif_addr_unlock_bh(struct net_device *dev) { spin_unlock_bh(&dev->addr_list_lock); } extern void ether_setup(struct net_device *dev); extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs); extern int register_netdev(struct net_device *dev); extern void unregister_netdev(struct net_device *dev); extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len, unsigned char addr_type); extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len, unsigned char addr_type); extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len); extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len); extern void __hw_addr_flush(struct netdev_hw_addr_list *list); extern void __hw_addr_init(struct netdev_hw_addr_list *list); extern int dev_addr_add(struct net_device *dev, unsigned char *addr, unsigned char addr_type); extern int dev_addr_del(struct net_device *dev, unsigned char *addr, unsigned char addr_type); extern int dev_addr_add_multiple(struct net_device *to_dev, struct net_device *from_dev, unsigned char addr_type); extern int dev_addr_del_multiple(struct net_device *to_dev, struct net_device *from_dev, unsigned char addr_type); extern void dev_addr_flush(struct net_device *dev); extern int dev_addr_init(struct net_device *dev); extern int dev_uc_add(struct net_device *dev, unsigned char *addr); extern int dev_uc_del(struct net_device *dev, unsigned char *addr); extern int dev_uc_sync(struct net_device *to, struct net_device *from); extern void dev_uc_unsync(struct net_device *to, struct net_device *from); extern void dev_uc_flush(struct net_device *dev); extern void dev_uc_init(struct net_device *dev); extern int dev_mc_add(struct net_device *dev, unsigned char *addr); extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); extern int dev_mc_del(struct net_device *dev, unsigned char *addr); extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); extern int dev_mc_sync(struct net_device *to, struct net_device *from); extern void dev_mc_unsync(struct net_device *to, struct net_device *from); extern void dev_mc_flush(struct net_device *dev); extern void dev_mc_init(struct net_device *dev); extern void dev_set_rx_mode(struct net_device *dev); extern void __dev_set_rx_mode(struct net_device *dev); extern int dev_set_promiscuity(struct net_device *dev, int inc); extern int dev_set_allmulti(struct net_device *dev, int inc); extern void netdev_state_change(struct net_device *dev); extern int netdev_bonding_change(struct net_device *dev, unsigned long event); extern void netdev_features_change(struct net_device *dev); extern void dev_load(struct net *net, const char *name); extern void dev_mcast_init(void); extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, struct rtnl_link_stats64 *storage); extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, const struct net_device_stats *netdev_stats); extern int netdev_max_backlog; extern int netdev_tstamp_prequeue; extern int weight_p; extern int bpf_jit_enable; extern int netdev_set_master(struct net_device *dev, struct net_device *master); extern int netdev_set_bond_master(struct net_device *dev, struct net_device *master); extern int skb_checksum_help(struct sk_buff *skb); extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features); extern void netdev_rx_csum_fault(struct net_device *dev); extern void net_enable_timestamp(void); extern void net_disable_timestamp(void); extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); extern void dev_seq_stop(struct seq_file *seq, void *v); extern int netdev_class_create_file(struct class_attribute *class_attr); extern void netdev_class_remove_file(struct class_attribute *class_attr); extern struct kobj_ns_type_operations net_ns_type_operations; extern const char *netdev_drivername(const struct net_device *dev); extern void linkwatch_run_queue(void); static inline __attribute__((no_instrument_function)) netdev_features_t netdev_get_wanted_features( struct net_device *dev) { return (dev->features & ~dev->hw_features) | dev->wanted_features; } netdev_features_t netdev_increment_features(netdev_features_t all, netdev_features_t one, netdev_features_t mask); int __netdev_update_features(struct net_device *dev); void netdev_update_features(struct net_device *dev); void netdev_change_features(struct net_device *dev); void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev); netdev_features_t netif_skb_features(struct sk_buff *skb); static inline __attribute__((no_instrument_function)) bool net_gso_ok(netdev_features_t features, int gso_type) { netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; ; ; ; ; ; ; return (features & feature) == feature; } static inline __attribute__((no_instrument_function)) bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) { return net_gso_ok(features, ((struct skb_shared_info *)(skb_end_pointer(skb)))->gso_type) && (!skb_has_frag_list(skb) || (features & ((netdev_features_t)1 << (NETIF_F_FRAGLIST_BIT)))); } static inline __attribute__((no_instrument_function)) bool netif_needs_gso(struct sk_buff *skb, netdev_features_t features) { return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || ldv__builtin_expect(!!((skb->ip_summed != 3) && (skb->ip_summed != 1)), 0) ); } static inline __attribute__((no_instrument_function)) void netif_set_gso_max_size(struct net_device *dev, unsigned int size) { dev->gso_max_size = size; } static inline __attribute__((no_instrument_function)) bool netif_is_bond_slave(struct net_device *dev) { return dev->flags & 0x800 && dev->priv_flags & 0x20; } static inline __attribute__((no_instrument_function)) bool netif_supports_nofcs(struct net_device *dev) { return dev->priv_flags & 0x80000; } extern struct pernet_operations loopback_net_ops; static inline __attribute__((no_instrument_function)) const char *netdev_name(const struct net_device *dev) { if (dev->reg_state != NETREG_REGISTERED) return "(unregistered net_device)"; return dev->name; } extern int __netdev_printk(const char *level, const struct net_device *dev, struct va_format *vaf); extern __attribute__((format(printf, 3, 4))) int netdev_printk(const char *level, const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_emerg(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_alert(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_crit(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_err(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_warn(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_notice(const struct net_device *dev, const char *format, ...); extern __attribute__((format(printf, 2, 3))) int netdev_info(const struct net_device *dev, const char *format, ...); static inline __attribute__((no_instrument_function)) u16 get_unaligned_le16(const void *p) { return __le16_to_cpup((__le16 *)p); } static inline __attribute__((no_instrument_function)) u32 get_unaligned_le32(const void *p) { return __le32_to_cpup((__le32 *)p); } static inline __attribute__((no_instrument_function)) u64 get_unaligned_le64(const void *p) { return __le64_to_cpup((__le64 *)p); } static inline __attribute__((no_instrument_function)) u16 get_unaligned_be16(const void *p) { return __be16_to_cpup((__be16 *)p); } static inline __attribute__((no_instrument_function)) u32 get_unaligned_be32(const void *p) { return __be32_to_cpup((__be32 *)p); } static inline __attribute__((no_instrument_function)) u64 get_unaligned_be64(const void *p) { return __be64_to_cpup((__be64 *)p); } static inline __attribute__((no_instrument_function)) void put_unaligned_le16(u16 val, void *p) { *((__le16 *)p) = (( __le16)(__u16)(val)); } static inline __attribute__((no_instrument_function)) void put_unaligned_le32(u32 val, void *p) { *((__le32 *)p) = (( __le32)(__u32)(val)); } static inline __attribute__((no_instrument_function)) void put_unaligned_le64(u64 val, void *p) { *((__le64 *)p) = (( __le64)(__u64)(val)); } static inline __attribute__((no_instrument_function)) void put_unaligned_be16(u16 val, void *p) { *((__be16 *)p) = (( __be16)(__builtin_constant_p((__u16)((val))) ? ((__u16)( (((__u16)((val)) & (__u16)0x00ffU) << 8) | (((__u16)((val)) & (__u16)0xff00U) >> 8))) : __fswab16((val)))); } static inline __attribute__((no_instrument_function)) void put_unaligned_be32(u32 val, void *p) { *((__be32 *)p) = (( __be32)(__builtin_constant_p((__u32)((val))) ? ((__u32)( (((__u32)((val)) & (__u32)0x000000ffUL) << 24) | (((__u32)((val)) & (__u32)0x0000ff00UL) << 8) | (((__u32)((val)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((val)) & (__u32)0xff000000UL) >> 24))) : __fswab32((val)))); } static inline __attribute__((no_instrument_function)) void put_unaligned_be64(u64 val, void *p) { *((__be64 *)p) = (( __be64)(__builtin_constant_p((__u64)((val))) ? ((__u64)( (((__u64)((val)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)((val)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)((val)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)((val)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)((val)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)((val)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)((val)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)((val)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64((val)))); } extern void __bad_unaligned_access_size(void); extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); extern const struct header_ops eth_header_ops; extern int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned len); extern int eth_rebuild_header(struct sk_buff *skb); extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); extern void eth_header_cache_update(struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr); extern int eth_mac_addr(struct net_device *dev, void *p); extern int eth_change_mtu(struct net_device *dev, int new_mtu); extern int eth_validate_addr(struct net_device *dev); extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs, unsigned int rxqs); static inline __attribute__((no_instrument_function)) int is_zero_ether_addr(const u8 *addr) { return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); } static inline __attribute__((no_instrument_function)) int is_multicast_ether_addr(const u8 *addr) { return 0x01 & addr[0]; } static inline __attribute__((no_instrument_function)) int is_local_ether_addr(const u8 *addr) { return 0x02 & addr[0]; } static inline __attribute__((no_instrument_function)) int is_broadcast_ether_addr(const u8 *addr) { return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; } static inline __attribute__((no_instrument_function)) int is_unicast_ether_addr(const u8 *addr) { return !is_multicast_ether_addr(addr); } static inline __attribute__((no_instrument_function)) int is_valid_ether_addr(const u8 *addr) { return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } static inline __attribute__((no_instrument_function)) void random_ether_addr(u8 *addr) { get_random_bytes (addr, 6); addr [0] &= 0xfe; addr [0] |= 0x02; } static inline __attribute__((no_instrument_function)) void eth_hw_addr_random(struct net_device *dev) { dev->addr_assign_type |= 1; random_ether_addr(dev->dev_addr); } static inline __attribute__((no_instrument_function)) unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) { const u16 *a = (const u16 *) addr1; const u16 *b = (const u16 *) addr2; ; return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; } static inline __attribute__((no_instrument_function)) unsigned long zap_last_2bytes(unsigned long value) { return value << 16; } static inline __attribute__((no_instrument_function)) unsigned compare_ether_addr_64bits(const u8 addr1[6+2], const u8 addr2[6+2]) { unsigned long fold = ((*(unsigned long *)addr1) ^ (*(unsigned long *)addr2)); if (sizeof(fold) == 8) return zap_last_2bytes(fold) != 0; fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^ (*(unsigned long *)(addr2 + 4))); return fold != 0; } static inline __attribute__((no_instrument_function)) bool is_etherdev_addr(const struct net_device *dev, const u8 addr[6 + 2]) { struct netdev_hw_addr *ha; int res = 1; rcu_read_lock(); for (ha = ({typeof (*(&dev->dev_addrs.list)->next) *__ptr = (typeof (*(&dev->dev_addrs.list)->next) *)(&dev->dev_addrs.list)->next; ({ const typeof( ((typeof(*ha) *)0)->list ) *__mptr = ((typeof((&dev->dev_addrs.list)->next))({ typeof(*(__ptr)) *_________p1 = (typeof(*(__ptr))* )(*(volatile typeof((__ptr)) *)&((__ptr))); do { } while (0); ; do { } while (0); ((typeof(*(__ptr)) *)(_________p1)); })); (typeof(*ha) *)( (char *)__mptr - __builtin_offsetof(typeof(*ha),list) );}); }); &ha->list != (&dev->dev_addrs.list); ha = ({typeof (*ha->list.next) *__ptr = (typeof (*ha->list.next) *)ha->list.next; ({ const typeof( ((typeof(*ha) *)0)->list ) *__mptr = ((typeof(ha->list.next))({ typeof(*(__ptr)) *_________p1 = (typeof(*(__ptr))* )(*(volatile typeof((__ptr)) *)&((__ptr))); do { } while (0); ; do { } while (0); ((typeof(*(__ptr)) *)(_________p1)); })); (typeof(*ha) *)( (char *)__mptr - __builtin_offsetof(typeof(*ha),list) );}); })) { res = compare_ether_addr_64bits(addr, ha->addr); if (!res) break; } rcu_read_unlock(); return !res; } static inline __attribute__((no_instrument_function)) unsigned long compare_ether_header(const void *a, const void *b) { unsigned long fold; fold = *(unsigned long *)a ^ *(unsigned long *)b; fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; } extern u8 const byte_rev_table[256]; static inline __attribute__((no_instrument_function)) u8 bitrev8(u8 byte) { return byte_rev_table[byte]; } extern u16 bitrev16(u16 in); extern u32 bitrev32(u32 in); extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); extern char modprobe_path[]; extern __attribute__((format(printf, 2, 3))) int __request_module(bool wait, const char *name, ...); struct cred; struct file; struct subprocess_info { struct work_struct work; struct completion *complete; char *path; char **argv; char **envp; int wait; int retval; int (*init)(struct subprocess_info *info, struct cred *new); void (*cleanup)(struct subprocess_info *info); void *data; }; struct subprocess_info *call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask); void call_usermodehelper_setfns(struct subprocess_info *info, int (*init)(struct subprocess_info *info, struct cred *new), void (*cleanup)(struct subprocess_info *info), void *data); int call_usermodehelper_exec(struct subprocess_info *info, int wait); void call_usermodehelper_freeinfo(struct subprocess_info *info); static inline __attribute__((no_instrument_function)) int call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, int (*init)(struct subprocess_info *info, struct cred *new), void (*cleanup)(struct subprocess_info *), void *data) { struct subprocess_info *info; gfp_t gfp_mask = (wait == 0) ? ((( gfp_t)0x20u)) : ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u)); info = call_usermodehelper_setup(path, argv, envp, gfp_mask); if (info == ((void *)0)) return -12; call_usermodehelper_setfns(info, init, cleanup, data); return call_usermodehelper_exec(info, wait); } static inline __attribute__((no_instrument_function)) int call_usermodehelper(char *path, char **argv, char **envp, int wait) { return call_usermodehelper_fns(path, argv, envp, wait, ((void *)0), ((void *)0), ((void *)0)); } extern struct ctl_table usermodehelper_table[]; enum umh_disable_depth { UMH_ENABLED = 0, UMH_FREEZING, UMH_DISABLED, }; extern void usermodehelper_init(void); extern int __usermodehelper_disable(enum umh_disable_depth depth); extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); static inline __attribute__((no_instrument_function)) int usermodehelper_disable(void) { return __usermodehelper_disable(UMH_DISABLED); } static inline __attribute__((no_instrument_function)) void usermodehelper_enable(void) { __usermodehelper_set_disable_depth(UMH_ENABLED); } extern int usermodehelper_read_trylock(void); extern long usermodehelper_read_lock_wait(long timeout); extern void usermodehelper_read_unlock(void); struct user_i387_struct { unsigned short cwd; unsigned short swd; unsigned short twd; unsigned short fop; __u64 rip; __u64 rdp; __u32 mxcsr; __u32 mxcsr_mask; __u32 st_space[32]; __u32 xmm_space[64]; __u32 padding[24]; }; struct user_regs_struct { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; unsigned long fs_base; unsigned long gs_base; unsigned long ds; unsigned long es; unsigned long fs; unsigned long gs; }; struct user { struct user_regs_struct regs; int u_fpvalid; int pad0; struct user_i387_struct i387; unsigned long int u_tsize; unsigned long int u_dsize; unsigned long int u_ssize; unsigned long start_code; unsigned long start_stack; long int signal; int reserved; int pad1; unsigned long u_ar0; struct user_i387_struct *u_fpstate; unsigned long magic; char u_comm[32]; unsigned long u_debugreg[8]; unsigned long error_code; unsigned long fault_address; }; struct user_ymmh_regs { __u32 ymmh_space[64]; }; struct user_xsave_hdr { __u64 xstate_bv; __u64 reserved1[2]; __u64 reserved2[5]; }; struct user_xstateregs { struct { __u64 fpx_space[58]; __u64 xstate_fx_sw[6]; } i387; struct user_xsave_hdr xsave_hdr; struct user_ymmh_regs ymmh; }; typedef unsigned long elf_greg_t; typedef elf_greg_t elf_gregset_t[(sizeof(struct user_regs_struct) / sizeof(elf_greg_t))]; typedef struct user_i387_struct elf_fpregset_t; extern const char VDSO32_PRELINK[]; extern void __kernel_sigreturn; extern void __kernel_rt_sigreturn; extern const char vdso32_int80_start, vdso32_int80_end; extern const char vdso32_syscall_start, vdso32_syscall_end; extern const char vdso32_sysenter_start, vdso32_sysenter_end; extern unsigned int vdso_enabled; static inline __attribute__((no_instrument_function)) void elf_common_init(struct thread_struct *t, struct pt_regs *regs, const u16 ds) { regs->ax = regs->bx = regs->cx = regs->dx = 0; regs->si = regs->di = regs->bp = 0; regs->r8 = regs->r9 = regs->r10 = regs->r11 = 0; regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0; t->fs = t->gs = 0; t->fsindex = t->gsindex = 0; t->ds = t->es = ds; } void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp); void set_personality_ia32(bool); extern void set_personality_64bit(void); extern unsigned int sysctl_vsyscall32; extern int force_personality32; struct task_struct; struct linux_binprm; extern int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); extern int x32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); extern int syscall32_setup_pages(struct linux_binprm *, int exstack); extern unsigned long arch_randomize_brk(struct mm_struct *mm); static inline __attribute__((no_instrument_function)) int mmap_is_ia32(void) { if (test_ti_thread_flag(current_thread_info(), 29)) return 1; return 0; } enum align_flags { ALIGN_VA_32 = (1UL << (0)), ALIGN_VA_64 = (1UL << (1)), ALIGN_VDSO = (1UL << (2)), ALIGN_TOPDOWN = (1UL << (3)), }; struct va_alignment { int flags; unsigned long mask; } __attribute__((__aligned__((1 << (6))))); extern struct va_alignment va_align; extern unsigned long align_addr(unsigned long, struct file *, enum align_flags); typedef __u32 Elf32_Addr; typedef __u16 Elf32_Half; typedef __u32 Elf32_Off; typedef __s32 Elf32_Sword; typedef __u32 Elf32_Word; typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __s16 Elf64_SHalf; typedef __u64 Elf64_Off; typedef __s32 Elf64_Sword; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; typedef __s64 Elf64_Sxword; typedef struct dynamic{ Elf32_Sword d_tag; union{ Elf32_Sword d_val; Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef struct elf64_rel { Elf64_Addr r_offset; Elf64_Xword r_info; } Elf64_Rel; typedef struct elf32_rela{ Elf32_Addr r_offset; Elf32_Word r_info; Elf32_Sword r_addend; } Elf32_Rela; typedef struct elf64_rela { Elf64_Addr r_offset; Elf64_Xword r_info; Elf64_Sxword r_addend; } Elf64_Rela; typedef struct elf32_sym{ Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_info; unsigned char st_other; Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } Elf64_Sym; typedef struct elf32_hdr{ unsigned char e_ident[16]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; Elf32_Off e_phoff; Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; Elf32_Half e_phnum; Elf32_Half e_shentsize; Elf32_Half e_shnum; Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { unsigned char e_ident[16]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr; typedef struct elf32_phdr{ Elf32_Word p_type; Elf32_Off p_offset; Elf32_Addr p_vaddr; Elf32_Addr p_paddr; Elf32_Word p_filesz; Elf32_Word p_memsz; Elf32_Word p_flags; Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { Elf64_Word p_type; Elf64_Word p_flags; Elf64_Off p_offset; Elf64_Addr p_vaddr; Elf64_Addr p_paddr; Elf64_Xword p_filesz; Elf64_Xword p_memsz; Elf64_Xword p_align; } Elf64_Phdr; typedef struct elf32_shdr { Elf32_Word sh_name; Elf32_Word sh_type; Elf32_Word sh_flags; Elf32_Addr sh_addr; Elf32_Off sh_offset; Elf32_Word sh_size; Elf32_Word sh_link; Elf32_Word sh_info; Elf32_Word sh_addralign; Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } Elf64_Shdr; typedef struct elf32_note { Elf32_Word n_namesz; Elf32_Word n_descsz; Elf32_Word n_type; } Elf32_Nhdr; typedef struct elf64_note { Elf64_Word n_namesz; Elf64_Word n_descsz; Elf64_Word n_type; } Elf64_Nhdr; extern Elf64_Dyn _DYNAMIC []; struct file; static inline __attribute__((no_instrument_function)) int elf_coredump_extra_notes_size(void) { return 0; } static inline __attribute__((no_instrument_function)) int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset) { return 0; } struct kernel_param; struct kernel_param_ops { int (*set)(const char *val, const struct kernel_param *kp); int (*get)(char *buffer, const struct kernel_param *kp); void (*free)(void *arg); }; struct kernel_param { const char *name; const struct kernel_param_ops *ops; u16 perm; s16 level; union { void *arg; const struct kparam_string *str; const struct kparam_array *arr; }; }; struct kparam_string { unsigned int maxlen; char *string; }; struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; }; static inline __attribute__((no_instrument_function)) int __check_old_set_param(int (*oldset)(const char *, struct kernel_param *)) { return 0; } extern void __kernel_param_lock(void); extern void __kernel_param_unlock(void); extern bool parameq(const char *name1, const char *name2); extern bool parameqn(const char *name1, const char *name2, size_t n); extern int parse_args(const char *name, char *args, const struct kernel_param *params, unsigned num, s16 level_min, s16 level_max, int (*unknown)(char *param, char *val)); extern void destroy_params(const struct kernel_param *params, unsigned num); extern struct kernel_param_ops param_ops_byte; extern int param_set_byte(const char *val, const struct kernel_param *kp); extern int param_get_byte(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_short; extern int param_set_short(const char *val, const struct kernel_param *kp); extern int param_get_short(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_ushort; extern int param_set_ushort(const char *val, const struct kernel_param *kp); extern int param_get_ushort(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_int; extern int param_set_int(const char *val, const struct kernel_param *kp); extern int param_get_int(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_uint; extern int param_set_uint(const char *val, const struct kernel_param *kp); extern int param_get_uint(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_long; extern int param_set_long(const char *val, const struct kernel_param *kp); extern int param_get_long(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_ulong; extern int param_set_ulong(const char *val, const struct kernel_param *kp); extern int param_get_ulong(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_charp; extern int param_set_charp(const char *val, const struct kernel_param *kp); extern int param_get_charp(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_bool; extern int param_set_bool(const char *val, const struct kernel_param *kp); extern int param_get_bool(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_invbool; extern int param_set_invbool(const char *val, const struct kernel_param *kp); extern int param_get_invbool(char *buffer, const struct kernel_param *kp); extern struct kernel_param_ops param_ops_bint; extern int param_set_bint(const char *val, const struct kernel_param *kp); extern struct kernel_param_ops param_array_ops; extern struct kernel_param_ops param_ops_string; extern int param_set_copystring(const char *val, const struct kernel_param *); extern int param_get_string(char *buffer, const struct kernel_param *kp); struct module; extern int module_param_sysfs_setup(struct module *mod, const struct kernel_param *kparam, unsigned int num_params); extern void module_param_sysfs_remove(struct module *mod); struct module; struct tracepoint; struct tracepoint_func { void *func; void *data; }; struct tracepoint { const char *name; struct static_key key; void (*regfunc)(void); void (*unregfunc)(void); struct tracepoint_func *funcs; }; extern int tracepoint_probe_register(const char *name, void *probe, void *data); extern int tracepoint_probe_unregister(const char *name, void *probe, void *data); extern int tracepoint_probe_register_noupdate(const char *name, void *probe, void *data); extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe, void *data); extern void tracepoint_probe_update_all(void); struct tp_module { struct list_head list; unsigned int num_tracepoints; struct tracepoint * const *tracepoints_ptrs; }; struct tracepoint_iter { struct tp_module *module; struct tracepoint * const *tracepoint; }; extern void tracepoint_iter_start(struct tracepoint_iter *iter); extern void tracepoint_iter_next(struct tracepoint_iter *iter); extern void tracepoint_iter_stop(struct tracepoint_iter *iter); extern void tracepoint_iter_reset(struct tracepoint_iter *iter); static inline __attribute__((no_instrument_function)) void tracepoint_synchronize_unregister(void) { synchronize_sched(); } struct kernel_symbol { unsigned long value; const char *name; }; extern struct module __this_module; struct mod_arch_specific { }; struct modversion_info { unsigned long crc; char name[(64 - sizeof(unsigned long))]; }; struct module; struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; }; struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t count); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); }; struct module_version_attribute { struct module_attribute mattr; const char *module_name; const char *version; } __attribute__ ((__aligned__(sizeof(void *)))); extern ssize_t __modver_version_show(struct module_attribute *, struct module_kobject *, char *); extern struct module_attribute module_uevent; extern int init_module(void); extern void cleanup_module(void); struct exception_table_entry; const struct exception_table_entry * search_extable(const struct exception_table_entry *first, const struct exception_table_entry *last, unsigned long value); void sort_extable(struct exception_table_entry *start, struct exception_table_entry *finish); void sort_main_extable(void); void trim_init_extable(struct module *m); const struct exception_table_entry *search_exception_tables(unsigned long add); struct notifier_block; extern int modules_disabled; void *__symbol_get(const char *symbol); void *__symbol_get_gpl(const char *symbol); struct module_use { struct list_head source_list; struct list_head target_list; struct module *source, *target; }; enum module_state { MODULE_STATE_LIVE, MODULE_STATE_COMING, MODULE_STATE_GOING, }; struct module_ref { unsigned long incs; unsigned long decs; } __attribute((aligned(2 * sizeof(unsigned long)))); struct module { enum module_state state; struct list_head list; char name[(64 - sizeof(unsigned long))]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const unsigned long *crcs; unsigned int num_syms; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; const struct kernel_symbol *gpl_future_syms; const unsigned long *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(void); void *module_init; void *module_core; unsigned int init_size, core_size; unsigned int init_text_size, core_text_size; unsigned int init_ro_size, core_ro_size; struct mod_arch_specific arch; unsigned int taints; unsigned num_bugs; struct list_head bug_list; struct bug_entry *bug_table; Elf64_Sym *symtab, *core_symtab; unsigned int num_symtab, core_num_syms; char *strtab, *core_strtab; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; struct tracepoint * const *tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct ftrace_event_call **trace_events; unsigned int num_trace_events; struct list_head source_list; struct list_head target_list; struct task_struct *waiter; void (*exit)(void); struct module_ref *refptr; ctor_fn_t *ctors; unsigned int num_ctors; }; extern struct mutex module_mutex; static inline __attribute__((no_instrument_function)) int module_is_live(struct module *mod) { return mod->state != MODULE_STATE_GOING; } struct module *__module_text_address(unsigned long addr); struct module *__module_address(unsigned long addr); bool is_module_address(unsigned long addr); bool is_module_percpu_address(unsigned long addr); bool is_module_text_address(unsigned long addr); static inline __attribute__((no_instrument_function)) int within_module_core(unsigned long addr, struct module *mod) { return (unsigned long)mod->module_core <= addr && addr < (unsigned long)mod->module_core + mod->core_size; } static inline __attribute__((no_instrument_function)) int within_module_init(unsigned long addr, struct module *mod) { return (unsigned long)mod->module_init <= addr && addr < (unsigned long)mod->module_init + mod->init_size; } struct module *find_module(const char *name); struct symsearch { const struct kernel_symbol *start, *stop; const unsigned long *crcs; enum { NOT_GPL_ONLY, GPL_ONLY, WILL_BE_GPL_ONLY, } licence; bool unused; }; const struct kernel_symbol *find_symbol(const char *name, struct module **owner, const unsigned long **crc, bool gplok, bool warn); bool each_symbol_section(bool (*fn)(const struct symsearch *arr, struct module *owner, void *data), void *data); int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, char *name, char *module_name, int *exported); unsigned long module_kallsyms_lookup_name(const char *name); int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); extern void __module_put_and_exit(struct module *mod, long code) __attribute__((noreturn)); unsigned long module_refcount(struct module *mod); void __symbol_put(const char *symbol); void symbol_put_addr(void *addr); extern void __module_get(struct module *module); extern bool try_module_get(struct module *module); extern void module_put(struct module *module); int ref_module(struct module *a, struct module *b); const char *module_address_lookup(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, char *namebuf); int lookup_module_symbol_name(unsigned long addr, char *symname); int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); const struct exception_table_entry *search_module_extables(unsigned long addr); int register_module_notifier(struct notifier_block * nb); int unregister_module_notifier(struct notifier_block * nb); extern void print_modules(void); extern struct kset *module_kset; extern struct kobj_type module_ktype; extern int module_sysfs_initialized; extern void set_all_modules_text_rw(void); extern void set_all_modules_text_ro(void); void module_bug_finalize(const Elf64_Ehdr *, const Elf64_Shdr *, struct module *); void module_bug_cleanup(struct module *); struct ieee80211_hdr { __le16 frame_control; __le16 duration_id; u8 addr1[6]; u8 addr2[6]; u8 addr3[6]; __le16 seq_ctrl; u8 addr4[6]; } __attribute__ ((packed)); struct ieee80211_hdr_3addr { __le16 frame_control; __le16 duration_id; u8 addr1[6]; u8 addr2[6]; u8 addr3[6]; __le16 seq_ctrl; } __attribute__ ((packed)); struct ieee80211_qos_hdr { __le16 frame_control; __le16 duration_id; u8 addr1[6]; u8 addr2[6]; u8 addr3[6]; __le16 seq_ctrl; __le16 qos_ctrl; } __attribute__ ((packed)); static inline __attribute__((no_instrument_function)) int ieee80211_has_tods(__le16 fc) { return (fc & (( __le16)(__u16)(0x0100))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_fromds(__le16 fc) { return (fc & (( __le16)(__u16)(0x0200))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_a4(__le16 fc) { __le16 tmp = (( __le16)(__u16)(0x0100 | 0x0200)); return (fc & tmp) == tmp; } static inline __attribute__((no_instrument_function)) int ieee80211_has_morefrags(__le16 fc) { return (fc & (( __le16)(__u16)(0x0400))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_retry(__le16 fc) { return (fc & (( __le16)(__u16)(0x0800))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_pm(__le16 fc) { return (fc & (( __le16)(__u16)(0x1000))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_moredata(__le16 fc) { return (fc & (( __le16)(__u16)(0x2000))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_protected(__le16 fc) { return (fc & (( __le16)(__u16)(0x4000))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_has_order(__le16 fc) { return (fc & (( __le16)(__u16)(0x8000))) != 0; } static inline __attribute__((no_instrument_function)) int ieee80211_is_mgmt(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c))) == (( __le16)(__u16)(0x0000)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_ctl(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c))) == (( __le16)(__u16)(0x0004)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_data(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c))) == (( __le16)(__u16)(0x0008)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_data_qos(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x0080))) == (( __le16)(__u16)(0x0008 | 0x0080)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_data_present(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x40))) == (( __le16)(__u16)(0x0008)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_assoc_req(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0000)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_assoc_resp(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0010)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_reassoc_req(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0020)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_reassoc_resp(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0030)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_probe_req(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0040)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_probe_resp(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0050)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_beacon(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0080)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_atim(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x0090)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_disassoc(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x00A0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_auth(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x00B0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_deauth(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x00C0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_action(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0000 | 0x00D0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_back_req(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x0080)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_back(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x0090)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_pspoll(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00A0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_rts(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00B0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_cts(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00C0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_ack(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00D0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_cfend(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00E0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_cfendack(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0004 | 0x00F0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_nullfunc(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0008 | 0x0040)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_qos_nullfunc(__le16 fc) { return (fc & (( __le16)(__u16)(0x000c | 0x00f0))) == (( __le16)(__u16)(0x0008 | 0x00C0)); } static inline __attribute__((no_instrument_function)) int ieee80211_is_first_frag(__le16 seq_ctrl) { return (seq_ctrl & (( __le16)(__u16)(0x000F))) == 0; } struct ieee80211s_hdr { u8 flags; u8 ttl; __le32 seqnum; u8 eaddr1[6]; u8 eaddr2[6]; } __attribute__ ((packed)); struct ieee80211_quiet_ie { u8 count; u8 period; __le16 duration; __le16 offset; } __attribute__ ((packed)); struct ieee80211_msrment_ie { u8 token; u8 mode; u8 type; u8 request[0]; } __attribute__ ((packed)); struct ieee80211_channel_sw_ie { u8 mode; u8 new_ch_num; u8 count; } __attribute__ ((packed)); struct ieee80211_tim_ie { u8 dtim_count; u8 dtim_period; u8 bitmap_ctrl; u8 virtual_map[1]; } __attribute__ ((packed)); struct ieee80211_meshconf_ie { u8 meshconf_psel; u8 meshconf_pmetric; u8 meshconf_congest; u8 meshconf_synch; u8 meshconf_auth; u8 meshconf_form; u8 meshconf_cap; } __attribute__ ((packed)); struct ieee80211_rann_ie { u8 rann_flags; u8 rann_hopcount; u8 rann_ttl; u8 rann_addr[6]; u32 rann_seq; u32 rann_interval; u32 rann_metric; } __attribute__ ((packed)); enum ieee80211_rann_flags { RANN_FLAG_IS_GATE = 1 << 0, }; struct ieee80211_mgmt { __le16 frame_control; __le16 duration; u8 da[6]; u8 sa[6]; u8 bssid[6]; __le16 seq_ctrl; union { struct { __le16 auth_alg; __le16 auth_transaction; __le16 status_code; u8 variable[0]; } __attribute__ ((packed)) auth; struct { __le16 reason_code; } __attribute__ ((packed)) deauth; struct { __le16 capab_info; __le16 listen_interval; u8 variable[0]; } __attribute__ ((packed)) assoc_req; struct { __le16 capab_info; __le16 status_code; __le16 aid; u8 variable[0]; } __attribute__ ((packed)) assoc_resp, reassoc_resp; struct { __le16 capab_info; __le16 listen_interval; u8 current_ap[6]; u8 variable[0]; } __attribute__ ((packed)) reassoc_req; struct { __le16 reason_code; } __attribute__ ((packed)) disassoc; struct { __le64 timestamp; __le16 beacon_int; __le16 capab_info; u8 variable[0]; } __attribute__ ((packed)) beacon; struct { u8 variable[0]; } __attribute__ ((packed)) probe_req; struct { __le64 timestamp; __le16 beacon_int; __le16 capab_info; u8 variable[0]; } __attribute__ ((packed)) probe_resp; struct { u8 category; union { struct { u8 action_code; u8 dialog_token; u8 status_code; u8 variable[0]; } __attribute__ ((packed)) wme_action; struct{ u8 action_code; u8 element_id; u8 length; struct ieee80211_channel_sw_ie sw_elem; } __attribute__((packed)) chan_switch; struct{ u8 action_code; u8 dialog_token; u8 element_id; u8 length; struct ieee80211_msrment_ie msr_elem; } __attribute__((packed)) measurement; struct{ u8 action_code; u8 dialog_token; __le16 capab; __le16 timeout; __le16 start_seq_num; } __attribute__((packed)) addba_req; struct{ u8 action_code; u8 dialog_token; __le16 status; __le16 capab; __le16 timeout; } __attribute__((packed)) addba_resp; struct{ u8 action_code; __le16 params; __le16 reason_code; } __attribute__((packed)) delba; struct { u8 action_code; u8 variable[0]; } __attribute__((packed)) self_prot; struct{ u8 action_code; u8 variable[0]; } __attribute__((packed)) mesh_action; struct { u8 action; u8 trans_id[2]; } __attribute__ ((packed)) sa_query; struct { u8 action; u8 smps_control; } __attribute__ ((packed)) ht_smps; struct { u8 action_code; u8 dialog_token; __le16 capability; u8 variable[0]; } __attribute__((packed)) tdls_discover_resp; } u; } __attribute__ ((packed)) action; } u; } __attribute__ ((packed)); struct ieee80211_mmie { u8 element_id; u8 length; __le16 key_id; u8 sequence_number[6]; u8 mic[8]; } __attribute__ ((packed)); struct ieee80211_vendor_ie { u8 element_id; u8 len; u8 oui[3]; u8 oui_type; } __attribute__((packed)); struct ieee80211_rts { __le16 frame_control; __le16 duration; u8 ra[6]; u8 ta[6]; } __attribute__ ((packed)); struct ieee80211_cts { __le16 frame_control; __le16 duration; u8 ra[6]; } __attribute__ ((packed)); struct ieee80211_pspoll { __le16 frame_control; __le16 aid; u8 bssid[6]; u8 ta[6]; } __attribute__ ((packed)); struct ieee80211_tdls_lnkie { u8 ie_type; u8 ie_len; u8 bssid[6]; u8 init_sta[6]; u8 resp_sta[6]; } __attribute__((packed)); struct ieee80211_tdls_data { u8 da[6]; u8 sa[6]; __be16 ether_type; u8 payload_type; u8 category; u8 action_code; union { struct { u8 dialog_token; __le16 capability; u8 variable[0]; } __attribute__((packed)) setup_req; struct { __le16 status_code; u8 dialog_token; __le16 capability; u8 variable[0]; } __attribute__((packed)) setup_resp; struct { __le16 status_code; u8 dialog_token; u8 variable[0]; } __attribute__((packed)) setup_cfm; struct { __le16 reason_code; u8 variable[0]; } __attribute__((packed)) teardown; struct { u8 dialog_token; u8 variable[0]; } __attribute__((packed)) discover_req; } u; } __attribute__((packed)); struct ieee80211_bar { __le16 frame_control; __le16 duration; __u8 ra[6]; __u8 ta[6]; __le16 control; __le16 start_seq_num; } __attribute__((packed)); struct ieee80211_mcs_info { u8 rx_mask[10]; __le16 rx_highest; u8 tx_params; u8 reserved[3]; } __attribute__((packed)); struct ieee80211_ht_cap { __le16 cap_info; u8 ampdu_params_info; struct ieee80211_mcs_info mcs; __le16 extended_ht_cap_info; __le32 tx_BF_cap_info; u8 antenna_selection_info; } __attribute__ ((packed)); enum ieee80211_max_ampdu_length_exp { IEEE80211_HT_MAX_AMPDU_8K = 0, IEEE80211_HT_MAX_AMPDU_16K = 1, IEEE80211_HT_MAX_AMPDU_32K = 2, IEEE80211_HT_MAX_AMPDU_64K = 3 }; enum ieee80211_min_mpdu_spacing { IEEE80211_HT_MPDU_DENSITY_NONE = 0, IEEE80211_HT_MPDU_DENSITY_0_25 = 1, IEEE80211_HT_MPDU_DENSITY_0_5 = 2, IEEE80211_HT_MPDU_DENSITY_1 = 3, IEEE80211_HT_MPDU_DENSITY_2 = 4, IEEE80211_HT_MPDU_DENSITY_4 = 5, IEEE80211_HT_MPDU_DENSITY_8 = 6, IEEE80211_HT_MPDU_DENSITY_16 = 7 }; struct ieee80211_ht_info { u8 control_chan; u8 ht_param; __le16 operation_mode; __le16 stbc_param; u8 basic_set[16]; } __attribute__ ((packed)); enum { WLAN_ERP_PREAMBLE_SHORT = 0, WLAN_ERP_PREAMBLE_LONG = 1, }; enum ieee80211_statuscode { WLAN_STATUS_SUCCESS = 0, WLAN_STATUS_UNSPECIFIED_FAILURE = 1, WLAN_STATUS_CAPS_UNSUPPORTED = 10, WLAN_STATUS_REASSOC_NO_ASSOC = 11, WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, WLAN_STATUS_CHALLENGE_FAIL = 15, WLAN_STATUS_AUTH_TIMEOUT = 16, WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, WLAN_STATUS_ASSOC_DENIED_RATES = 18, WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30, WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31, WLAN_STATUS_INVALID_IE = 40, WLAN_STATUS_INVALID_GROUP_CIPHER = 41, WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, WLAN_STATUS_INVALID_AKMP = 43, WLAN_STATUS_UNSUPP_RSN_VERSION = 44, WLAN_STATUS_INVALID_RSN_IE_CAP = 45, WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, WLAN_STATUS_UNSPECIFIED_QOS = 32, WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33, WLAN_STATUS_ASSOC_DENIED_LOWACK = 34, WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35, WLAN_STATUS_REQUEST_DECLINED = 37, WLAN_STATUS_INVALID_QOS_PARAM = 38, WLAN_STATUS_CHANGE_TSPEC = 39, WLAN_STATUS_WAIT_TS_DELAY = 47, WLAN_STATUS_NO_DIRECT_LINK = 48, WLAN_STATUS_STA_NOT_PRESENT = 49, WLAN_STATUS_STA_NOT_QSTA = 50, WLAN_STATUS_ANTI_CLOG_REQUIRED = 76, WLAN_STATUS_FCG_NOT_SUPP = 78, WLAN_STATUS_STA_NO_TBTT = 78, }; enum ieee80211_reasoncode { WLAN_REASON_UNSPECIFIED = 1, WLAN_REASON_PREV_AUTH_NOT_VALID = 2, WLAN_REASON_DEAUTH_LEAVING = 3, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, WLAN_REASON_DISASSOC_AP_BUSY = 5, WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, WLAN_REASON_DISASSOC_BAD_POWER = 10, WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, WLAN_REASON_INVALID_IE = 13, WLAN_REASON_MIC_FAILURE = 14, WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, WLAN_REASON_IE_DIFFERENT = 17, WLAN_REASON_INVALID_GROUP_CIPHER = 18, WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, WLAN_REASON_INVALID_AKMP = 20, WLAN_REASON_UNSUPP_RSN_VERSION = 21, WLAN_REASON_INVALID_RSN_IE_CAP = 22, WLAN_REASON_IEEE8021X_FAILED = 23, WLAN_REASON_CIPHER_SUITE_REJECTED = 24, WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, WLAN_REASON_DISASSOC_LOW_ACK = 34, WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35, WLAN_REASON_QSTA_LEAVE_QBSS = 36, WLAN_REASON_QSTA_NOT_USE = 37, WLAN_REASON_QSTA_REQUIRE_SETUP = 38, WLAN_REASON_QSTA_TIMEOUT = 39, WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45, WLAN_REASON_MESH_PEER_CANCELED = 52, WLAN_REASON_MESH_MAX_PEERS = 53, WLAN_REASON_MESH_CONFIG = 54, WLAN_REASON_MESH_CLOSE = 55, WLAN_REASON_MESH_MAX_RETRIES = 56, WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57, WLAN_REASON_MESH_INVALID_GTK = 58, WLAN_REASON_MESH_INCONSISTENT_PARAM = 59, WLAN_REASON_MESH_INVALID_SECURITY = 60, WLAN_REASON_MESH_PATH_ERROR = 61, WLAN_REASON_MESH_PATH_NOFORWARD = 62, WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63, WLAN_REASON_MAC_EXISTS_IN_MBSS = 64, WLAN_REASON_MESH_CHAN_REGULATORY = 65, WLAN_REASON_MESH_CHAN = 66, }; enum ieee80211_eid { WLAN_EID_SSID = 0, WLAN_EID_SUPP_RATES = 1, WLAN_EID_FH_PARAMS = 2, WLAN_EID_DS_PARAMS = 3, WLAN_EID_CF_PARAMS = 4, WLAN_EID_TIM = 5, WLAN_EID_IBSS_PARAMS = 6, WLAN_EID_CHALLENGE = 16, WLAN_EID_COUNTRY = 7, WLAN_EID_HP_PARAMS = 8, WLAN_EID_HP_TABLE = 9, WLAN_EID_REQUEST = 10, WLAN_EID_QBSS_LOAD = 11, WLAN_EID_EDCA_PARAM_SET = 12, WLAN_EID_TSPEC = 13, WLAN_EID_TCLAS = 14, WLAN_EID_SCHEDULE = 15, WLAN_EID_TS_DELAY = 43, WLAN_EID_TCLAS_PROCESSING = 44, WLAN_EID_QOS_CAPA = 46, WLAN_EID_LINK_ID = 101, WLAN_EID_MESH_CONFIG = 113, WLAN_EID_MESH_ID = 114, WLAN_EID_LINK_METRIC_REPORT = 115, WLAN_EID_CONGESTION_NOTIFICATION = 116, WLAN_EID_PEER_MGMT = 117, WLAN_EID_CHAN_SWITCH_PARAM = 118, WLAN_EID_MESH_AWAKE_WINDOW = 119, WLAN_EID_BEACON_TIMING = 120, WLAN_EID_MCCAOP_SETUP_REQ = 121, WLAN_EID_MCCAOP_SETUP_RESP = 122, WLAN_EID_MCCAOP_ADVERT = 123, WLAN_EID_MCCAOP_TEARDOWN = 124, WLAN_EID_GANN = 125, WLAN_EID_RANN = 126, WLAN_EID_PREQ = 130, WLAN_EID_PREP = 131, WLAN_EID_PERR = 132, WLAN_EID_PXU = 137, WLAN_EID_PXUC = 138, WLAN_EID_AUTH_MESH_PEER_EXCH = 139, WLAN_EID_MIC = 140, WLAN_EID_PWR_CONSTRAINT = 32, WLAN_EID_PWR_CAPABILITY = 33, WLAN_EID_TPC_REQUEST = 34, WLAN_EID_TPC_REPORT = 35, WLAN_EID_SUPPORTED_CHANNELS = 36, WLAN_EID_CHANNEL_SWITCH = 37, WLAN_EID_MEASURE_REQUEST = 38, WLAN_EID_MEASURE_REPORT = 39, WLAN_EID_QUIET = 40, WLAN_EID_IBSS_DFS = 41, WLAN_EID_ERP_INFO = 42, WLAN_EID_EXT_SUPP_RATES = 50, WLAN_EID_HT_CAPABILITY = 45, WLAN_EID_HT_INFORMATION = 61, WLAN_EID_RSN = 48, WLAN_EID_MMIE = 76, WLAN_EID_WPA = 221, WLAN_EID_GENERIC = 221, WLAN_EID_VENDOR_SPECIFIC = 221, WLAN_EID_QOS_PARAMETER = 222, WLAN_EID_AP_CHAN_REPORT = 51, WLAN_EID_NEIGHBOR_REPORT = 52, WLAN_EID_RCPI = 53, WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, WLAN_EID_ANTENNA_INFO = 64, WLAN_EID_RSNI = 65, WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, WLAN_EID_BSS_AC_ACCESS_DELAY = 68, WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, WLAN_EID_MULTIPLE_BSSID = 71, WLAN_EID_BSS_COEX_2040 = 72, WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, WLAN_EID_EXT_CAPABILITY = 127, WLAN_EID_MOBILITY_DOMAIN = 54, WLAN_EID_FAST_BSS_TRANSITION = 55, WLAN_EID_TIMEOUT_INTERVAL = 56, WLAN_EID_RIC_DATA = 57, WLAN_EID_RIC_DESCRIPTOR = 75, WLAN_EID_DSE_REGISTERED_LOCATION = 58, WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, WLAN_EID_EXT_CHANSWITCH_ANN = 60, }; enum ieee80211_category { WLAN_CATEGORY_SPECTRUM_MGMT = 0, WLAN_CATEGORY_QOS = 1, WLAN_CATEGORY_DLS = 2, WLAN_CATEGORY_BACK = 3, WLAN_CATEGORY_PUBLIC = 4, WLAN_CATEGORY_HT = 7, WLAN_CATEGORY_SA_QUERY = 8, WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, WLAN_CATEGORY_TDLS = 12, WLAN_CATEGORY_MESH_ACTION = 13, WLAN_CATEGORY_MULTIHOP_ACTION = 14, WLAN_CATEGORY_SELF_PROTECTED = 15, WLAN_CATEGORY_WMM = 17, WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, WLAN_CATEGORY_VENDOR_SPECIFIC = 127, }; enum ieee80211_spectrum_mgmt_actioncode { WLAN_ACTION_SPCT_MSR_REQ = 0, WLAN_ACTION_SPCT_MSR_RPRT = 1, WLAN_ACTION_SPCT_TPC_REQ = 2, WLAN_ACTION_SPCT_TPC_RPRT = 3, WLAN_ACTION_SPCT_CHL_SWITCH = 4, }; enum ieee80211_ht_actioncode { WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0, WLAN_HT_ACTION_SMPS = 1, WLAN_HT_ACTION_PSMP = 2, WLAN_HT_ACTION_PCO_PHASE = 3, WLAN_HT_ACTION_CSI = 4, WLAN_HT_ACTION_NONCOMPRESSED_BF = 5, WLAN_HT_ACTION_COMPRESSED_BF = 6, WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, }; enum ieee80211_self_protected_actioncode { WLAN_SP_RESERVED = 0, WLAN_SP_MESH_PEERING_OPEN = 1, WLAN_SP_MESH_PEERING_CONFIRM = 2, WLAN_SP_MESH_PEERING_CLOSE = 3, WLAN_SP_MGK_INFORM = 4, WLAN_SP_MGK_ACK = 5, }; enum ieee80211_mesh_actioncode { WLAN_MESH_ACTION_LINK_METRIC_REPORT, WLAN_MESH_ACTION_HWMP_PATH_SELECTION, WLAN_MESH_ACTION_GATE_ANNOUNCEMENT, WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION, WLAN_MESH_ACTION_MCCA_SETUP_REQUEST, WLAN_MESH_ACTION_MCCA_SETUP_REPLY, WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST, WLAN_MESH_ACTION_MCCA_ADVERTISEMENT, WLAN_MESH_ACTION_MCCA_TEARDOWN, WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST, WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE, }; enum ieee80211_key_len { WLAN_KEY_LEN_WEP40 = 5, WLAN_KEY_LEN_WEP104 = 13, WLAN_KEY_LEN_CCMP = 16, WLAN_KEY_LEN_TKIP = 32, WLAN_KEY_LEN_AES_CMAC = 16, }; enum ieee80211_pub_actioncode { WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, }; enum ieee80211_tdls_actioncode { WLAN_TDLS_SETUP_REQUEST = 0, WLAN_TDLS_SETUP_RESPONSE = 1, WLAN_TDLS_SETUP_CONFIRM = 2, WLAN_TDLS_TEARDOWN = 3, WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4, WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5, WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6, WLAN_TDLS_PEER_PSM_REQUEST = 7, WLAN_TDLS_PEER_PSM_RESPONSE = 8, WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9, WLAN_TDLS_DISCOVERY_REQUEST = 10, }; enum { IEEE80211_PATH_PROTOCOL_HWMP = 0, IEEE80211_PATH_PROTOCOL_VENDOR = 255, }; enum { IEEE80211_PATH_METRIC_AIRTIME = 0, IEEE80211_PATH_METRIC_VENDOR = 255, }; struct ieee80211_country_ie_triplet { union { struct { u8 first_channel; u8 num_channels; s8 max_power; } __attribute__ ((packed)) chans; struct { u8 reg_extension_id; u8 reg_class; u8 coverage_class; } __attribute__ ((packed)) ext; }; } __attribute__ ((packed)); enum ieee80211_timeout_interval_type { WLAN_TIMEOUT_REASSOC_DEADLINE = 1 , WLAN_TIMEOUT_KEY_LIFETIME = 2 , WLAN_TIMEOUT_ASSOC_COMEBACK = 3 , }; enum ieee80211_back_actioncode { WLAN_ACTION_ADDBA_REQ = 0, WLAN_ACTION_ADDBA_RESP = 1, WLAN_ACTION_DELBA = 2, }; enum ieee80211_back_parties { WLAN_BACK_RECIPIENT = 0, WLAN_BACK_INITIATOR = 1, }; enum ieee80211_sa_query_action { WLAN_ACTION_SA_QUERY_REQUEST = 0, WLAN_ACTION_SA_QUERY_RESPONSE = 1, }; enum ieee80211_tspec_status_code { IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0, IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1, }; struct ieee80211_tspec_ie { u8 element_id; u8 len; u8 oui[3]; u8 oui_type; u8 oui_subtype; u8 version; __le16 tsinfo; u8 tsinfo_resvd; __le16 nominal_msdu; __le16 max_msdu; __le32 min_service_int; __le32 max_service_int; __le32 inactivity_int; __le32 suspension_int; __le32 service_start_time; __le32 min_data_rate; __le32 mean_data_rate; __le32 peak_data_rate; __le32 max_burst_size; __le32 delay_bound; __le32 min_phy_rate; __le16 sba; __le16 medium_time; } __attribute__((packed)); static inline __attribute__((no_instrument_function)) u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return (u8 *)hdr + 30; else return (u8 *)hdr + 24; } static inline __attribute__((no_instrument_function)) u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return hdr->addr4; if (ieee80211_has_fromds(hdr->frame_control)) return hdr->addr3; return hdr->addr2; } static inline __attribute__((no_instrument_function)) u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) { if (ieee80211_has_tods(hdr->frame_control)) return hdr->addr3; else return hdr->addr1; } static inline __attribute__((no_instrument_function)) bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) { if (ieee80211_is_disassoc(hdr->frame_control) || ieee80211_is_deauth(hdr->frame_control)) return true; if (ieee80211_is_action(hdr->frame_control)) { u8 *category; if (ieee80211_has_protected(hdr->frame_control)) return true; category = ((u8 *) hdr) + 24; return *category != WLAN_CATEGORY_PUBLIC && *category != WLAN_CATEGORY_HT && *category != WLAN_CATEGORY_SELF_PROTECTED && *category != WLAN_CATEGORY_VENDOR_SPECIFIC; } return false; } static inline __attribute__((no_instrument_function)) bool ieee80211_is_public_action(struct ieee80211_hdr *hdr, size_t len) { struct ieee80211_mgmt *mgmt = (void *)hdr; if (len < __builtin_offsetof(struct ieee80211_mgmt,u.action.u)) return false; if (!ieee80211_is_action(hdr->frame_control)) return false; return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC; } static inline __attribute__((no_instrument_function)) int ieee80211_fhss_chan_to_freq(int channel) { if ((channel > 1) && (channel < 96)) return channel + 2400; else return -1; } static inline __attribute__((no_instrument_function)) int ieee80211_freq_to_fhss_chan(int freq) { if ((freq > 2401) && (freq < 2496)) return freq - 2400; else return -1; } static inline __attribute__((no_instrument_function)) int ieee80211_dsss_chan_to_freq(int channel) { if ((channel > 0) && (channel < 14)) return 2407 + (channel * 5); else if (channel == 14) return 2484; else return -1; } static inline __attribute__((no_instrument_function)) int ieee80211_freq_to_dsss_chan(int freq) { if ((freq >= 2410) && (freq < 2475)) return (freq - 2405) / 5; else if ((freq >= 2482) && (freq < 2487)) return 14; else return -1; } static inline __attribute__((no_instrument_function)) int ieee80211_ofdm_chan_to_freq(int s_freq, int channel) { if ((channel > 0) && (channel <= 200) && (s_freq >= 4000)) return s_freq + (channel * 5); else return -1; } static inline __attribute__((no_instrument_function)) int ieee80211_freq_to_ofdm_chan(int s_freq, int freq) { if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) && (s_freq >= 4000)) return (freq + 2 - s_freq) / 5; else return -1; } static inline __attribute__((no_instrument_function)) unsigned long ieee80211_tu_to_usec(unsigned long tu) { return 1024 * tu; } static inline __attribute__((no_instrument_function)) bool ieee80211_check_tim(struct ieee80211_tim_ie *tim, u8 tim_len, u16 aid) { u8 mask; u8 index, indexn1, indexn2; if (ldv__builtin_expect(!!(!tim || tim_len < sizeof(*tim)), 0)) return false; aid &= 0x3fff; index = aid / 8; mask = 1 << (aid & 7); indexn1 = tim->bitmap_ctrl & 0xfe; indexn2 = tim_len + indexn1 - 4; if (index < indexn1 || index > indexn2) return false; index -= indexn1; return !!(tim->virtual_map[index] & mask); } struct file_operations; struct debugfs_blob_wrapper { void *data; unsigned long size; }; struct debugfs_reg32 { char *name; unsigned long offset; }; struct debugfs_regset32 { struct debugfs_reg32 *regs; int nregs; void *base; }; extern struct dentry *arch_debugfs_dir; extern const struct file_operations debugfs_file_operations; extern const struct inode_operations debugfs_link_operations; struct dentry *debugfs_create_file(const char *name, umode_t mode, struct dentry *parent, void *data, const struct file_operations *fops); struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, const char *dest); void debugfs_remove(struct dentry *dentry); void debugfs_remove_recursive(struct dentry *dentry); struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, struct dentry *new_dir, const char *new_name); struct dentry *debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, u8 *value); struct dentry *debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, u16 *value); struct dentry *debugfs_create_u32(const char *name, umode_t mode, struct dentry *parent, u32 *value); struct dentry *debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, u64 *value); struct dentry *debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent, u8 *value); struct dentry *debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent, u16 *value); struct dentry *debugfs_create_x32(const char *name, umode_t mode, struct dentry *parent, u32 *value); struct dentry *debugfs_create_x64(const char *name, umode_t mode, struct dentry *parent, u64 *value); struct dentry *debugfs_create_size_t(const char *name, umode_t mode, struct dentry *parent, size_t *value); struct dentry *debugfs_create_bool(const char *name, umode_t mode, struct dentry *parent, u32 *value); struct dentry *debugfs_create_blob(const char *name, umode_t mode, struct dentry *parent, struct debugfs_blob_wrapper *blob); struct dentry *debugfs_create_regset32(const char *name, umode_t mode, struct dentry *parent, struct debugfs_regset32 *regset); int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, int nregs, void *base, char *prefix); bool debugfs_initialized(void); enum nl80211_commands { NL80211_CMD_UNSPEC, NL80211_CMD_GET_WIPHY, NL80211_CMD_SET_WIPHY, NL80211_CMD_NEW_WIPHY, NL80211_CMD_DEL_WIPHY, NL80211_CMD_GET_INTERFACE, NL80211_CMD_SET_INTERFACE, NL80211_CMD_NEW_INTERFACE, NL80211_CMD_DEL_INTERFACE, NL80211_CMD_GET_KEY, NL80211_CMD_SET_KEY, NL80211_CMD_NEW_KEY, NL80211_CMD_DEL_KEY, NL80211_CMD_GET_BEACON, NL80211_CMD_SET_BEACON, NL80211_CMD_START_AP, NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, NL80211_CMD_STOP_AP, NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, NL80211_CMD_GET_STATION, NL80211_CMD_SET_STATION, NL80211_CMD_NEW_STATION, NL80211_CMD_DEL_STATION, NL80211_CMD_GET_MPATH, NL80211_CMD_SET_MPATH, NL80211_CMD_NEW_MPATH, NL80211_CMD_DEL_MPATH, NL80211_CMD_SET_BSS, NL80211_CMD_SET_REG, NL80211_CMD_REQ_SET_REG, NL80211_CMD_GET_MESH_CONFIG, NL80211_CMD_SET_MESH_CONFIG, NL80211_CMD_SET_MGMT_EXTRA_IE , NL80211_CMD_GET_REG, NL80211_CMD_GET_SCAN, NL80211_CMD_TRIGGER_SCAN, NL80211_CMD_NEW_SCAN_RESULTS, NL80211_CMD_SCAN_ABORTED, NL80211_CMD_REG_CHANGE, NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, NL80211_CMD_DEAUTHENTICATE, NL80211_CMD_DISASSOCIATE, NL80211_CMD_MICHAEL_MIC_FAILURE, NL80211_CMD_REG_BEACON_HINT, NL80211_CMD_JOIN_IBSS, NL80211_CMD_LEAVE_IBSS, NL80211_CMD_TESTMODE, NL80211_CMD_CONNECT, NL80211_CMD_ROAM, NL80211_CMD_DISCONNECT, NL80211_CMD_SET_WIPHY_NETNS, NL80211_CMD_GET_SURVEY, NL80211_CMD_NEW_SURVEY_RESULTS, NL80211_CMD_SET_PMKSA, NL80211_CMD_DEL_PMKSA, NL80211_CMD_FLUSH_PMKSA, NL80211_CMD_REMAIN_ON_CHANNEL, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, NL80211_CMD_SET_TX_BITRATE_MASK, NL80211_CMD_REGISTER_FRAME, NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME, NL80211_CMD_FRAME, NL80211_CMD_ACTION = NL80211_CMD_FRAME, NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_SET_POWER_SAVE, NL80211_CMD_GET_POWER_SAVE, NL80211_CMD_SET_CQM, NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, NL80211_CMD_SET_WDS_PEER, NL80211_CMD_FRAME_WAIT_CANCEL, NL80211_CMD_JOIN_MESH, NL80211_CMD_LEAVE_MESH, NL80211_CMD_UNPROT_DEAUTHENTICATE, NL80211_CMD_UNPROT_DISASSOCIATE, NL80211_CMD_NEW_PEER_CANDIDATE, NL80211_CMD_GET_WOWLAN, NL80211_CMD_SET_WOWLAN, NL80211_CMD_START_SCHED_SCAN, NL80211_CMD_STOP_SCHED_SCAN, NL80211_CMD_SCHED_SCAN_RESULTS, NL80211_CMD_SCHED_SCAN_STOPPED, NL80211_CMD_SET_REKEY_OFFLOAD, NL80211_CMD_PMKSA_CANDIDATE, NL80211_CMD_TDLS_OPER, NL80211_CMD_TDLS_MGMT, NL80211_CMD_UNEXPECTED_FRAME, NL80211_CMD_PROBE_CLIENT, NL80211_CMD_REGISTER_BEACONS, NL80211_CMD_UNEXPECTED_4ADDR_FRAME, NL80211_CMD_SET_NOACK_MAP, __NL80211_CMD_AFTER_LAST, NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 }; enum nl80211_attrs { NL80211_ATTR_UNSPEC, NL80211_ATTR_WIPHY, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_IFINDEX, NL80211_ATTR_IFNAME, NL80211_ATTR_IFTYPE, NL80211_ATTR_MAC, NL80211_ATTR_KEY_DATA, NL80211_ATTR_KEY_IDX, NL80211_ATTR_KEY_CIPHER, NL80211_ATTR_KEY_SEQ, NL80211_ATTR_KEY_DEFAULT, NL80211_ATTR_BEACON_INTERVAL, NL80211_ATTR_DTIM_PERIOD, NL80211_ATTR_BEACON_HEAD, NL80211_ATTR_BEACON_TAIL, NL80211_ATTR_STA_AID, NL80211_ATTR_STA_FLAGS, NL80211_ATTR_STA_LISTEN_INTERVAL, NL80211_ATTR_STA_SUPPORTED_RATES, NL80211_ATTR_STA_VLAN, NL80211_ATTR_STA_INFO, NL80211_ATTR_WIPHY_BANDS, NL80211_ATTR_MNTR_FLAGS, NL80211_ATTR_MESH_ID, NL80211_ATTR_STA_PLINK_ACTION, NL80211_ATTR_MPATH_NEXT_HOP, NL80211_ATTR_MPATH_INFO, NL80211_ATTR_BSS_CTS_PROT, NL80211_ATTR_BSS_SHORT_PREAMBLE, NL80211_ATTR_BSS_SHORT_SLOT_TIME, NL80211_ATTR_HT_CAPABILITY, NL80211_ATTR_SUPPORTED_IFTYPES, NL80211_ATTR_REG_ALPHA2, NL80211_ATTR_REG_RULES, NL80211_ATTR_MESH_CONFIG, NL80211_ATTR_BSS_BASIC_RATES, NL80211_ATTR_WIPHY_TXQ_PARAMS, NL80211_ATTR_WIPHY_FREQ, NL80211_ATTR_WIPHY_CHANNEL_TYPE, NL80211_ATTR_KEY_DEFAULT_MGMT, NL80211_ATTR_MGMT_SUBTYPE, NL80211_ATTR_IE, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, NL80211_ATTR_SCAN_FREQUENCIES, NL80211_ATTR_SCAN_SSIDS, NL80211_ATTR_GENERATION, NL80211_ATTR_BSS, NL80211_ATTR_REG_INITIATOR, NL80211_ATTR_REG_TYPE, NL80211_ATTR_SUPPORTED_COMMANDS, NL80211_ATTR_FRAME, NL80211_ATTR_SSID, NL80211_ATTR_AUTH_TYPE, NL80211_ATTR_REASON_CODE, NL80211_ATTR_KEY_TYPE, NL80211_ATTR_MAX_SCAN_IE_LEN, NL80211_ATTR_CIPHER_SUITES, NL80211_ATTR_FREQ_BEFORE, NL80211_ATTR_FREQ_AFTER, NL80211_ATTR_FREQ_FIXED, NL80211_ATTR_WIPHY_RETRY_SHORT, NL80211_ATTR_WIPHY_RETRY_LONG, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, NL80211_ATTR_WIPHY_RTS_THRESHOLD, NL80211_ATTR_TIMED_OUT, NL80211_ATTR_USE_MFP, NL80211_ATTR_STA_FLAGS2, NL80211_ATTR_CONTROL_PORT, NL80211_ATTR_TESTDATA, NL80211_ATTR_PRIVACY, NL80211_ATTR_DISCONNECTED_BY_AP, NL80211_ATTR_STATUS_CODE, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, NL80211_ATTR_CIPHER_SUITE_GROUP, NL80211_ATTR_WPA_VERSIONS, NL80211_ATTR_AKM_SUITES, NL80211_ATTR_REQ_IE, NL80211_ATTR_RESP_IE, NL80211_ATTR_PREV_BSSID, NL80211_ATTR_KEY, NL80211_ATTR_KEYS, NL80211_ATTR_PID, NL80211_ATTR_4ADDR, NL80211_ATTR_SURVEY_INFO, NL80211_ATTR_PMKID, NL80211_ATTR_MAX_NUM_PMKIDS, NL80211_ATTR_DURATION, NL80211_ATTR_COOKIE, NL80211_ATTR_WIPHY_COVERAGE_CLASS, NL80211_ATTR_TX_RATES, NL80211_ATTR_FRAME_MATCH, NL80211_ATTR_ACK, NL80211_ATTR_PS_STATE, NL80211_ATTR_CQM, NL80211_ATTR_LOCAL_STATE_CHANGE, NL80211_ATTR_AP_ISOLATE, NL80211_ATTR_WIPHY_TX_POWER_SETTING, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, NL80211_ATTR_TX_FRAME_TYPES, NL80211_ATTR_RX_FRAME_TYPES, NL80211_ATTR_FRAME_TYPE, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, NL80211_ATTR_SUPPORT_IBSS_RSN, NL80211_ATTR_WIPHY_ANTENNA_TX, NL80211_ATTR_WIPHY_ANTENNA_RX, NL80211_ATTR_MCAST_RATE, NL80211_ATTR_OFFCHANNEL_TX_OK, NL80211_ATTR_BSS_HT_OPMODE, NL80211_ATTR_KEY_DEFAULT_TYPES, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, NL80211_ATTR_MESH_SETUP, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, NL80211_ATTR_SUPPORT_MESH_AUTH, NL80211_ATTR_STA_PLINK_STATE, NL80211_ATTR_WOWLAN_TRIGGERS, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, NL80211_ATTR_SCHED_SCAN_INTERVAL, NL80211_ATTR_INTERFACE_COMBINATIONS, NL80211_ATTR_SOFTWARE_IFTYPES, NL80211_ATTR_REKEY_DATA, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, NL80211_ATTR_SCAN_SUPP_RATES, NL80211_ATTR_HIDDEN_SSID, NL80211_ATTR_IE_PROBE_RESP, NL80211_ATTR_IE_ASSOC_RESP, NL80211_ATTR_STA_WME, NL80211_ATTR_SUPPORT_AP_UAPSD, NL80211_ATTR_ROAM_SUPPORT, NL80211_ATTR_SCHED_SCAN_MATCH, NL80211_ATTR_MAX_MATCH_SETS, NL80211_ATTR_PMKSA_CANDIDATE, NL80211_ATTR_TX_NO_CCK_RATE, NL80211_ATTR_TDLS_ACTION, NL80211_ATTR_TDLS_DIALOG_TOKEN, NL80211_ATTR_TDLS_OPERATION, NL80211_ATTR_TDLS_SUPPORT, NL80211_ATTR_TDLS_EXTERNAL_SETUP, NL80211_ATTR_DEVICE_AP_SME, NL80211_ATTR_DONT_WAIT_FOR_ACK, NL80211_ATTR_FEATURE_FLAGS, NL80211_ATTR_PROBE_RESP_OFFLOAD, NL80211_ATTR_PROBE_RESP, NL80211_ATTR_DFS_REGION, NL80211_ATTR_DISABLE_HT, NL80211_ATTR_HT_CAPABILITY_MASK, NL80211_ATTR_NOACK_MAP, NL80211_ATTR_INACTIVITY_TIMEOUT, NL80211_ATTR_RX_SIGNAL_DBM, NL80211_ATTR_BG_SCAN_PERIOD, __NL80211_ATTR_AFTER_LAST, NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 }; enum nl80211_iftype { NL80211_IFTYPE_UNSPECIFIED, NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_WDS, NL80211_IFTYPE_MONITOR, NL80211_IFTYPE_MESH_POINT, NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, NUM_NL80211_IFTYPES, NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 }; enum nl80211_sta_flags { __NL80211_STA_FLAG_INVALID, NL80211_STA_FLAG_AUTHORIZED, NL80211_STA_FLAG_SHORT_PREAMBLE, NL80211_STA_FLAG_WME, NL80211_STA_FLAG_MFP, NL80211_STA_FLAG_AUTHENTICATED, NL80211_STA_FLAG_TDLS_PEER, __NL80211_STA_FLAG_AFTER_LAST, NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 }; struct nl80211_sta_flag_update { __u32 mask; __u32 set; } __attribute__((packed)); enum nl80211_rate_info { __NL80211_RATE_INFO_INVALID, NL80211_RATE_INFO_BITRATE, NL80211_RATE_INFO_MCS, NL80211_RATE_INFO_40_MHZ_WIDTH, NL80211_RATE_INFO_SHORT_GI, __NL80211_RATE_INFO_AFTER_LAST, NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 }; enum nl80211_sta_bss_param { __NL80211_STA_BSS_PARAM_INVALID, NL80211_STA_BSS_PARAM_CTS_PROT, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, NL80211_STA_BSS_PARAM_DTIM_PERIOD, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, __NL80211_STA_BSS_PARAM_AFTER_LAST, NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 }; enum nl80211_sta_info { __NL80211_STA_INFO_INVALID, NL80211_STA_INFO_INACTIVE_TIME, NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, NL80211_STA_INFO_LLID, NL80211_STA_INFO_PLID, NL80211_STA_INFO_PLINK_STATE, NL80211_STA_INFO_SIGNAL, NL80211_STA_INFO_TX_BITRATE, NL80211_STA_INFO_RX_PACKETS, NL80211_STA_INFO_TX_PACKETS, NL80211_STA_INFO_TX_RETRIES, NL80211_STA_INFO_TX_FAILED, NL80211_STA_INFO_SIGNAL_AVG, NL80211_STA_INFO_RX_BITRATE, NL80211_STA_INFO_BSS_PARAM, NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_BEACON_LOSS, __NL80211_STA_INFO_AFTER_LAST, NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 }; enum nl80211_mpath_flags { NL80211_MPATH_FLAG_ACTIVE = 1<<0, NL80211_MPATH_FLAG_RESOLVING = 1<<1, NL80211_MPATH_FLAG_SN_VALID = 1<<2, NL80211_MPATH_FLAG_FIXED = 1<<3, NL80211_MPATH_FLAG_RESOLVED = 1<<4, }; enum nl80211_mpath_info { __NL80211_MPATH_INFO_INVALID, NL80211_MPATH_INFO_FRAME_QLEN, NL80211_MPATH_INFO_SN, NL80211_MPATH_INFO_METRIC, NL80211_MPATH_INFO_EXPTIME, NL80211_MPATH_INFO_FLAGS, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, NL80211_MPATH_INFO_DISCOVERY_RETRIES, __NL80211_MPATH_INFO_AFTER_LAST, NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 }; enum nl80211_band_attr { __NL80211_BAND_ATTR_INVALID, NL80211_BAND_ATTR_FREQS, NL80211_BAND_ATTR_RATES, NL80211_BAND_ATTR_HT_MCS_SET, NL80211_BAND_ATTR_HT_CAPA, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, __NL80211_BAND_ATTR_AFTER_LAST, NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 }; enum nl80211_frequency_attr { __NL80211_FREQUENCY_ATTR_INVALID, NL80211_FREQUENCY_ATTR_FREQ, NL80211_FREQUENCY_ATTR_DISABLED, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, NL80211_FREQUENCY_ATTR_NO_IBSS, NL80211_FREQUENCY_ATTR_RADAR, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, __NL80211_FREQUENCY_ATTR_AFTER_LAST, NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 }; enum nl80211_bitrate_attr { __NL80211_BITRATE_ATTR_INVALID, NL80211_BITRATE_ATTR_RATE, NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, __NL80211_BITRATE_ATTR_AFTER_LAST, NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 }; enum nl80211_reg_initiator { NL80211_REGDOM_SET_BY_CORE, NL80211_REGDOM_SET_BY_USER, NL80211_REGDOM_SET_BY_DRIVER, NL80211_REGDOM_SET_BY_COUNTRY_IE, }; enum nl80211_reg_type { NL80211_REGDOM_TYPE_COUNTRY, NL80211_REGDOM_TYPE_WORLD, NL80211_REGDOM_TYPE_CUSTOM_WORLD, NL80211_REGDOM_TYPE_INTERSECTION, }; enum nl80211_reg_rule_attr { __NL80211_REG_RULE_ATTR_INVALID, NL80211_ATTR_REG_RULE_FLAGS, NL80211_ATTR_FREQ_RANGE_START, NL80211_ATTR_FREQ_RANGE_END, NL80211_ATTR_FREQ_RANGE_MAX_BW, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, NL80211_ATTR_POWER_RULE_MAX_EIRP, __NL80211_REG_RULE_ATTR_AFTER_LAST, NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 }; enum nl80211_sched_scan_match_attr { __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, NL80211_ATTR_SCHED_SCAN_MATCH_SSID, __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, NL80211_SCHED_SCAN_MATCH_ATTR_MAX = __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 }; enum nl80211_reg_rule_flags { NL80211_RRF_NO_OFDM = 1<<0, NL80211_RRF_NO_CCK = 1<<1, NL80211_RRF_NO_INDOOR = 1<<2, NL80211_RRF_NO_OUTDOOR = 1<<3, NL80211_RRF_DFS = 1<<4, NL80211_RRF_PTP_ONLY = 1<<5, NL80211_RRF_PTMP_ONLY = 1<<6, NL80211_RRF_PASSIVE_SCAN = 1<<7, NL80211_RRF_NO_IBSS = 1<<8, }; enum nl80211_dfs_regions { NL80211_DFS_UNSET = 0, NL80211_DFS_FCC = 1, NL80211_DFS_ETSI = 2, NL80211_DFS_JP = 3, }; enum nl80211_survey_info { __NL80211_SURVEY_INFO_INVALID, NL80211_SURVEY_INFO_FREQUENCY, NL80211_SURVEY_INFO_NOISE, NL80211_SURVEY_INFO_IN_USE, NL80211_SURVEY_INFO_CHANNEL_TIME, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, NL80211_SURVEY_INFO_CHANNEL_TIME_RX, NL80211_SURVEY_INFO_CHANNEL_TIME_TX, __NL80211_SURVEY_INFO_AFTER_LAST, NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 }; enum nl80211_mntr_flags { __NL80211_MNTR_FLAG_INVALID, NL80211_MNTR_FLAG_FCSFAIL, NL80211_MNTR_FLAG_PLCPFAIL, NL80211_MNTR_FLAG_CONTROL, NL80211_MNTR_FLAG_OTHER_BSS, NL80211_MNTR_FLAG_COOK_FRAMES, __NL80211_MNTR_FLAG_AFTER_LAST, NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 }; enum nl80211_meshconf_params { __NL80211_MESHCONF_INVALID, NL80211_MESHCONF_RETRY_TIMEOUT, NL80211_MESHCONF_CONFIRM_TIMEOUT, NL80211_MESHCONF_HOLDING_TIMEOUT, NL80211_MESHCONF_MAX_PEER_LINKS, NL80211_MESHCONF_MAX_RETRIES, NL80211_MESHCONF_TTL, NL80211_MESHCONF_AUTO_OPEN_PLINKS, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, NL80211_MESHCONF_PATH_REFRESH_TIME, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, NL80211_MESHCONF_HWMP_ROOTMODE, NL80211_MESHCONF_ELEMENT_TTL, NL80211_MESHCONF_HWMP_RANN_INTERVAL, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, NL80211_MESHCONF_FORWARDING, NL80211_MESHCONF_RSSI_THRESHOLD, __NL80211_MESHCONF_ATTR_AFTER_LAST, NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 }; enum nl80211_mesh_setup_params { __NL80211_MESH_SETUP_INVALID, NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, NL80211_MESH_SETUP_IE, NL80211_MESH_SETUP_USERSPACE_AUTH, NL80211_MESH_SETUP_USERSPACE_AMPE, __NL80211_MESH_SETUP_ATTR_AFTER_LAST, NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1 }; enum nl80211_txq_attr { __NL80211_TXQ_ATTR_INVALID, NL80211_TXQ_ATTR_QUEUE, NL80211_TXQ_ATTR_TXOP, NL80211_TXQ_ATTR_CWMIN, NL80211_TXQ_ATTR_CWMAX, NL80211_TXQ_ATTR_AIFS, __NL80211_TXQ_ATTR_AFTER_LAST, NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 }; enum nl80211_txq_q { NL80211_TXQ_Q_VO, NL80211_TXQ_Q_VI, NL80211_TXQ_Q_BE, NL80211_TXQ_Q_BK }; enum nl80211_channel_type { NL80211_CHAN_NO_HT, NL80211_CHAN_HT20, NL80211_CHAN_HT40MINUS, NL80211_CHAN_HT40PLUS }; enum nl80211_bss { __NL80211_BSS_INVALID, NL80211_BSS_BSSID, NL80211_BSS_FREQUENCY, NL80211_BSS_TSF, NL80211_BSS_BEACON_INTERVAL, NL80211_BSS_CAPABILITY, NL80211_BSS_INFORMATION_ELEMENTS, NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_STATUS, NL80211_BSS_SEEN_MS_AGO, NL80211_BSS_BEACON_IES, __NL80211_BSS_AFTER_LAST, NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 }; enum nl80211_bss_status { NL80211_BSS_STATUS_AUTHENTICATED, NL80211_BSS_STATUS_ASSOCIATED, NL80211_BSS_STATUS_IBSS_JOINED, }; enum nl80211_auth_type { NL80211_AUTHTYPE_OPEN_SYSTEM, NL80211_AUTHTYPE_SHARED_KEY, NL80211_AUTHTYPE_FT, NL80211_AUTHTYPE_NETWORK_EAP, __NL80211_AUTHTYPE_NUM, NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1, NL80211_AUTHTYPE_AUTOMATIC }; enum nl80211_key_type { NL80211_KEYTYPE_GROUP, NL80211_KEYTYPE_PAIRWISE, NL80211_KEYTYPE_PEERKEY, NUM_NL80211_KEYTYPES }; enum nl80211_mfp { NL80211_MFP_NO, NL80211_MFP_REQUIRED, }; enum nl80211_wpa_versions { NL80211_WPA_VERSION_1 = 1 << 0, NL80211_WPA_VERSION_2 = 1 << 1, }; enum nl80211_key_default_types { __NL80211_KEY_DEFAULT_TYPE_INVALID, NL80211_KEY_DEFAULT_TYPE_UNICAST, NL80211_KEY_DEFAULT_TYPE_MULTICAST, NUM_NL80211_KEY_DEFAULT_TYPES }; enum nl80211_key_attributes { __NL80211_KEY_INVALID, NL80211_KEY_DATA, NL80211_KEY_IDX, NL80211_KEY_CIPHER, NL80211_KEY_SEQ, NL80211_KEY_DEFAULT, NL80211_KEY_DEFAULT_MGMT, NL80211_KEY_TYPE, NL80211_KEY_DEFAULT_TYPES, __NL80211_KEY_AFTER_LAST, NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 }; enum nl80211_tx_rate_attributes { __NL80211_TXRATE_INVALID, NL80211_TXRATE_LEGACY, NL80211_TXRATE_MCS, __NL80211_TXRATE_AFTER_LAST, NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 }; enum nl80211_band { NL80211_BAND_2GHZ, NL80211_BAND_5GHZ, }; enum nl80211_ps_state { NL80211_PS_DISABLED, NL80211_PS_ENABLED, }; enum nl80211_attr_cqm { __NL80211_ATTR_CQM_INVALID, NL80211_ATTR_CQM_RSSI_THOLD, NL80211_ATTR_CQM_RSSI_HYST, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, NL80211_ATTR_CQM_PKT_LOSS_EVENT, __NL80211_ATTR_CQM_AFTER_LAST, NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 }; enum nl80211_cqm_rssi_threshold_event { NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, }; enum nl80211_tx_power_setting { NL80211_TX_POWER_AUTOMATIC, NL80211_TX_POWER_LIMITED, NL80211_TX_POWER_FIXED, }; enum nl80211_wowlan_packet_pattern_attr { __NL80211_WOWLAN_PKTPAT_INVALID, NL80211_WOWLAN_PKTPAT_MASK, NL80211_WOWLAN_PKTPAT_PATTERN, NUM_NL80211_WOWLAN_PKTPAT, MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1, }; struct nl80211_wowlan_pattern_support { __u32 max_patterns; __u32 min_pattern_len; __u32 max_pattern_len; } __attribute__((packed)); enum nl80211_wowlan_triggers { __NL80211_WOWLAN_TRIG_INVALID, NL80211_WOWLAN_TRIG_ANY, NL80211_WOWLAN_TRIG_DISCONNECT, NL80211_WOWLAN_TRIG_MAGIC_PKT, NL80211_WOWLAN_TRIG_PKT_PATTERN, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, NL80211_WOWLAN_TRIG_RFKILL_RELEASE, NUM_NL80211_WOWLAN_TRIG, MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 }; enum nl80211_iface_limit_attrs { NL80211_IFACE_LIMIT_UNSPEC, NL80211_IFACE_LIMIT_MAX, NL80211_IFACE_LIMIT_TYPES, NUM_NL80211_IFACE_LIMIT, MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 }; enum nl80211_if_combination_attrs { NL80211_IFACE_COMB_UNSPEC, NL80211_IFACE_COMB_LIMITS, NL80211_IFACE_COMB_MAXNUM, NL80211_IFACE_COMB_STA_AP_BI_MATCH, NL80211_IFACE_COMB_NUM_CHANNELS, NUM_NL80211_IFACE_COMB, MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 }; enum nl80211_plink_state { NL80211_PLINK_LISTEN, NL80211_PLINK_OPN_SNT, NL80211_PLINK_OPN_RCVD, NL80211_PLINK_CNF_RCVD, NL80211_PLINK_ESTAB, NL80211_PLINK_HOLDING, NL80211_PLINK_BLOCKED, NUM_NL80211_PLINK_STATES, MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 }; enum nl80211_rekey_data { __NL80211_REKEY_DATA_INVALID, NL80211_REKEY_DATA_KEK, NL80211_REKEY_DATA_KCK, NL80211_REKEY_DATA_REPLAY_CTR, NUM_NL80211_REKEY_DATA, MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 }; enum nl80211_hidden_ssid { NL80211_HIDDEN_SSID_NOT_IN_USE, NL80211_HIDDEN_SSID_ZERO_LEN, NL80211_HIDDEN_SSID_ZERO_CONTENTS }; enum nl80211_sta_wme_attr { __NL80211_STA_WME_INVALID, NL80211_STA_WME_UAPSD_QUEUES, NL80211_STA_WME_MAX_SP, __NL80211_STA_WME_AFTER_LAST, NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 }; enum nl80211_pmksa_candidate_attr { __NL80211_PMKSA_CANDIDATE_INVALID, NL80211_PMKSA_CANDIDATE_INDEX, NL80211_PMKSA_CANDIDATE_BSSID, NL80211_PMKSA_CANDIDATE_PREAUTH, NUM_NL80211_PMKSA_CANDIDATE, MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1 }; enum nl80211_tdls_operation { NL80211_TDLS_DISCOVERY_REQ, NL80211_TDLS_SETUP, NL80211_TDLS_TEARDOWN, NL80211_TDLS_ENABLE_LINK, NL80211_TDLS_DISABLE_LINK, }; enum nl80211_feature_flags { NL80211_FEATURE_SK_TX_STATUS = 1 << 0, NL80211_FEATURE_HT_IBSS = 1 << 1, NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, }; enum nl80211_probe_resp_offload_support_attr { NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, }; enum environment_cap { ENVIRON_ANY, ENVIRON_INDOOR, ENVIRON_OUTDOOR, }; struct regulatory_request { int wiphy_idx; enum nl80211_reg_initiator initiator; char alpha2[2]; u8 dfs_region; bool intersect; bool processed; enum environment_cap country_ie_env; struct list_head list; }; struct ieee80211_freq_range { u32 start_freq_khz; u32 end_freq_khz; u32 max_bandwidth_khz; }; struct ieee80211_power_rule { u32 max_antenna_gain; u32 max_eirp; }; struct ieee80211_reg_rule { struct ieee80211_freq_range freq_range; struct ieee80211_power_rule power_rule; u32 flags; }; struct ieee80211_regdomain { u32 n_reg_rules; char alpha2[2]; u8 dfs_region; struct ieee80211_reg_rule reg_rules[]; }; enum ieee80211_band { IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, IEEE80211_NUM_BANDS }; enum ieee80211_channel_flags { IEEE80211_CHAN_DISABLED = 1<<0, IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, IEEE80211_CHAN_NO_IBSS = 1<<2, IEEE80211_CHAN_RADAR = 1<<3, IEEE80211_CHAN_NO_HT40PLUS = 1<<4, IEEE80211_CHAN_NO_HT40MINUS = 1<<5, }; struct ieee80211_channel { enum ieee80211_band band; u16 center_freq; u16 hw_value; u32 flags; int max_antenna_gain; int max_power; int max_reg_power; bool beacon_found; u32 orig_flags; int orig_mag, orig_mpwr; }; enum ieee80211_rate_flags { IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, IEEE80211_RATE_MANDATORY_A = 1<<1, IEEE80211_RATE_MANDATORY_B = 1<<2, IEEE80211_RATE_MANDATORY_G = 1<<3, IEEE80211_RATE_ERP_G = 1<<4, }; struct ieee80211_rate { u32 flags; u16 bitrate; u16 hw_value, hw_value_short; }; struct ieee80211_sta_ht_cap { u16 cap; bool ht_supported; u8 ampdu_factor; u8 ampdu_density; struct ieee80211_mcs_info mcs; }; struct ieee80211_supported_band { struct ieee80211_channel *channels; struct ieee80211_rate *bitrates; enum ieee80211_band band; int n_channels; int n_bitrates; struct ieee80211_sta_ht_cap ht_cap; }; struct vif_params { int use_4addr; }; struct key_params { u8 *key; u8 *seq; int key_len; int seq_len; u32 cipher; }; enum survey_info_flags { SURVEY_INFO_NOISE_DBM = 1<<0, SURVEY_INFO_IN_USE = 1<<1, SURVEY_INFO_CHANNEL_TIME = 1<<2, SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, }; struct survey_info { struct ieee80211_channel *channel; u64 channel_time; u64 channel_time_busy; u64 channel_time_ext_busy; u64 channel_time_rx; u64 channel_time_tx; u32 filled; s8 noise; }; struct cfg80211_crypto_settings { u32 wpa_versions; u32 cipher_group; int n_ciphers_pairwise; u32 ciphers_pairwise[5]; int n_akm_suites; u32 akm_suites[2]; bool control_port; __be16 control_port_ethertype; bool control_port_no_encrypt; }; struct cfg80211_beacon_data { const u8 *head, *tail; const u8 *beacon_ies; const u8 *proberesp_ies; const u8 *assocresp_ies; const u8 *probe_resp; size_t head_len, tail_len; size_t beacon_ies_len; size_t proberesp_ies_len; size_t assocresp_ies_len; size_t probe_resp_len; }; struct cfg80211_ap_settings { struct cfg80211_beacon_data beacon; int beacon_interval, dtim_period; const u8 *ssid; size_t ssid_len; enum nl80211_hidden_ssid hidden_ssid; struct cfg80211_crypto_settings crypto; bool privacy; enum nl80211_auth_type auth_type; int inactivity_timeout; }; enum plink_actions { PLINK_ACTION_INVALID, PLINK_ACTION_OPEN, PLINK_ACTION_BLOCK, }; enum station_parameters_apply_mask { STATION_PARAM_APPLY_UAPSD = (1UL << (0)), }; struct station_parameters { u8 *supported_rates; struct net_device *vlan; u32 sta_flags_mask, sta_flags_set; u32 sta_modify_mask; int listen_interval; u16 aid; u8 supported_rates_len; u8 plink_action; u8 plink_state; struct ieee80211_ht_cap *ht_capa; u8 uapsd_queues; u8 max_sp; }; enum station_info_flags { STATION_INFO_INACTIVE_TIME = 1<<0, STATION_INFO_RX_BYTES = 1<<1, STATION_INFO_TX_BYTES = 1<<2, STATION_INFO_LLID = 1<<3, STATION_INFO_PLID = 1<<4, STATION_INFO_PLINK_STATE = 1<<5, STATION_INFO_SIGNAL = 1<<6, STATION_INFO_TX_BITRATE = 1<<7, STATION_INFO_RX_PACKETS = 1<<8, STATION_INFO_TX_PACKETS = 1<<9, STATION_INFO_TX_RETRIES = 1<<10, STATION_INFO_TX_FAILED = 1<<11, STATION_INFO_RX_DROP_MISC = 1<<12, STATION_INFO_SIGNAL_AVG = 1<<13, STATION_INFO_RX_BITRATE = 1<<14, STATION_INFO_BSS_PARAM = 1<<15, STATION_INFO_CONNECTED_TIME = 1<<16, STATION_INFO_ASSOC_REQ_IES = 1<<17, STATION_INFO_STA_FLAGS = 1<<18, STATION_INFO_BEACON_LOSS_COUNT = 1<<19 }; enum rate_info_flags { RATE_INFO_FLAGS_MCS = 1<<0, RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, RATE_INFO_FLAGS_SHORT_GI = 1<<2, }; struct rate_info { u8 flags; u8 mcs; u16 legacy; }; enum bss_param_flags { BSS_PARAM_FLAGS_CTS_PROT = 1<<0, BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, }; struct sta_bss_parameters { u8 flags; u8 dtim_period; u16 beacon_interval; }; struct station_info { u32 filled; u32 connected_time; u32 inactive_time; u32 rx_bytes; u32 tx_bytes; u16 llid; u16 plid; u8 plink_state; s8 signal; s8 signal_avg; struct rate_info txrate; struct rate_info rxrate; u32 rx_packets; u32 tx_packets; u32 tx_retries; u32 tx_failed; u32 rx_dropped_misc; struct sta_bss_parameters bss_param; struct nl80211_sta_flag_update sta_flags; int generation; const u8 *assoc_req_ies; size_t assoc_req_ies_len; u32 beacon_loss_count; }; enum monitor_flags { MONITOR_FLAG_FCSFAIL = 1<_net); } static inline __attribute__((no_instrument_function)) void wiphy_net_set(struct wiphy *wiphy, struct net *net) { write_pnet(&wiphy->_net, net); } static inline __attribute__((no_instrument_function)) void *wiphy_priv(struct wiphy *wiphy) { do { if (ldv__builtin_expect(!!(!wiphy), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/net/cfg80211.h"), "i" (2133), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return &wiphy->priv; } static inline __attribute__((no_instrument_function)) struct wiphy *priv_to_wiphy(void *priv) { do { if (ldv__builtin_expect(!!(!priv), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/net/cfg80211.h"), "i" (2144), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return ({ const typeof( ((struct wiphy *)0)->priv ) *__mptr = (priv); (struct wiphy *)( (char *)__mptr - __builtin_offsetof(struct wiphy,priv) );}); } static inline __attribute__((no_instrument_function)) void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) { wiphy->dev.parent = dev; } static inline __attribute__((no_instrument_function)) struct device *wiphy_dev(struct wiphy *wiphy) { return wiphy->dev.parent; } static inline __attribute__((no_instrument_function)) const char *wiphy_name(const struct wiphy *wiphy) { return dev_name(&wiphy->dev); } struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); extern int wiphy_register(struct wiphy *wiphy); extern void wiphy_unregister(struct wiphy *wiphy); extern void wiphy_free(struct wiphy *wiphy); struct cfg80211_conn; struct cfg80211_internal_bss; struct cfg80211_cached_keys; struct wireless_dev { struct wiphy *wiphy; enum nl80211_iftype iftype; struct list_head list; struct net_device *netdev; struct list_head mgmt_registrations; spinlock_t mgmt_registrations_lock; struct mutex mtx; struct work_struct cleanup_work; bool use_4addr; u8 ssid[32]; u8 ssid_len, mesh_id_len, mesh_id_up_len; enum { CFG80211_SME_IDLE, CFG80211_SME_CONNECTING, CFG80211_SME_CONNECTED, } sme_state; struct cfg80211_conn *conn; struct cfg80211_cached_keys *connect_keys; struct list_head event_list; spinlock_t event_lock; struct cfg80211_internal_bss *current_bss; struct ieee80211_channel *channel; bool ps; int ps_timeout; int beacon_interval; u32 ap_unexpected_nlpid; struct { struct cfg80211_ibss_params ibss; struct cfg80211_connect_params connect; struct cfg80211_cached_keys *keys; u8 *ie; size_t ie_len; u8 bssid[6], prev_bssid[6]; u8 ssid[32]; s8 default_key, default_mgmt_key; bool prev_bssid_valid; } wext; }; static inline __attribute__((no_instrument_function)) void *wdev_priv(struct wireless_dev *wdev) { do { if (ldv__builtin_expect(!!(!wdev), 0)) do { asm volatile("1:\tud2\n" ".pushsection __bug_table,\"a\"\n" "2:\t.long 1b - 2b, %c0 - 2b\n" "\t.word %c1, 0\n" "\t.org 2b+%c2\n" ".popsection" : : "i" ("include/net/cfg80211.h"), "i" (2321), "i" (sizeof(struct bug_entry))); do { } while (1); } while (0); } while(0); return wiphy_priv(wdev->wiphy); } extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); extern int ieee80211_frequency_to_channel(int freq); extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, int freq); static inline __attribute__((no_instrument_function)) struct ieee80211_channel * ieee80211_get_channel(struct wiphy *wiphy, int freq) { return __ieee80211_get_channel(wiphy, freq); } struct ieee80211_rate * ieee80211_get_response_rate(struct ieee80211_supported_band *sband, u32 basic_rates, int bitrate); struct radiotap_align_size { uint8_t align:4, size:4; }; struct ieee80211_radiotap_namespace { const struct radiotap_align_size *align_size; int n_bits; uint32_t oui; uint8_t subns; }; struct ieee80211_radiotap_vendor_namespaces { const struct ieee80211_radiotap_namespace *ns; int n_ns; }; struct ieee80211_radiotap_iterator { struct ieee80211_radiotap_header *_rtheader; const struct ieee80211_radiotap_vendor_namespaces *_vns; const struct ieee80211_radiotap_namespace *current_namespace; unsigned char *_arg, *_next_ns_data; __le32 *_next_bitmap; unsigned char *this_arg; int this_arg_index; int this_arg_size; int is_radiotap_ns; int _max_length; int _arg_index; uint32_t _bitmap_shifter; int _reset_on_ext; }; extern int ieee80211_radiotap_iterator_init( struct ieee80211_radiotap_iterator *iterator, struct ieee80211_radiotap_header *radiotap_header, int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); extern int ieee80211_radiotap_iterator_next( struct ieee80211_radiotap_iterator *iterator); extern const unsigned char rfc1042_header[6]; extern const unsigned char bridge_tunnel_header[6]; unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); unsigned int __attribute__((__const__)) ieee80211_hdrlen(__le16 fc); int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, enum nl80211_iftype iftype); int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, enum nl80211_iftype iftype, u8 *bssid, bool qos); void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, const u8 *addr, enum nl80211_iftype iftype, const unsigned int extra_headroom, bool has_80211_header); unsigned int cfg80211_classify8021d(struct sk_buff *skb); const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, const u8 *ies, int len); extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); extern void wiphy_apply_custom_regulatory( struct wiphy *wiphy, const struct ieee80211_regdomain *regd); extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz, const struct ieee80211_reg_rule **reg_rule); void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); void cfg80211_sched_scan_results(struct wiphy *wiphy); void cfg80211_sched_scan_stopped(struct wiphy *wiphy); struct cfg80211_bss * __attribute__((warn_unused_result)) cfg80211_inform_bss_frame(struct wiphy *wiphy, struct ieee80211_channel *channel, struct ieee80211_mgmt *mgmt, size_t len, s32 signal, gfp_t gfp); struct cfg80211_bss * __attribute__((warn_unused_result)) cfg80211_inform_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, u64 tsf, u16 capability, u16 beacon_interval, const u8 *ie, size_t ielen, s32 signal, gfp_t gfp); struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, size_t ssid_len, u16 capa_mask, u16 capa_val); static inline __attribute__((no_instrument_function)) struct cfg80211_bss * cfg80211_get_ibss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *ssid, size_t ssid_len) { return cfg80211_get_bss(wiphy, channel, ((void *)0), ssid, ssid_len, (1<<1), (1<<1)); } struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *meshid, size_t meshidlen, const u8 *meshcfg); void cfg80211_ref_bss(struct cfg80211_bss *bss); void cfg80211_put_bss(struct cfg80211_bss *bss); void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, const u8 *buf, size_t len); void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, enum nl80211_key_type key_type, int key_id, const u8 *tsc, gfp_t gfp); void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); void wiphy_rfkill_start_polling(struct wiphy *wiphy); void wiphy_rfkill_stop_polling(struct wiphy *wiphy); struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen); int cfg80211_testmode_reply(struct sk_buff *skb); struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp); void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, u16 status, gfp_t gfp); void cfg80211_roamed(struct net_device *dev, struct ieee80211_channel *channel, const u8 *bssid, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); void cfg80211_disconnected(struct net_device *dev, u16 reason, u8 *ie, size_t ie_len, gfp_t gfp); void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type, unsigned int duration, gfp_t gfp); void cfg80211_remain_on_channel_expired(struct net_device *dev, u64 cookie, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type, gfp_t gfp); void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, struct station_info *sinfo, gfp_t gfp); void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, const u8 *buf, size_t len, gfp_t gfp); void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, const u8 *buf, size_t len, bool ack, gfp_t gfp); void cfg80211_cqm_rssi_notify(struct net_device *dev, enum nl80211_cqm_rssi_threshold_event rssi_event, gfp_t gfp); void cfg80211_cqm_pktloss_notify(struct net_device *dev, const u8 *peer, u32 num_packets, gfp_t gfp); void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, const u8 *replay_ctr, gfp_t gfp); void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, const u8 *bssid, bool preauth, gfp_t gfp); bool cfg80211_rx_spurious_frame(struct net_device *dev, const u8 *addr, gfp_t gfp); bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, const u8 *addr, gfp_t gfp); void cfg80211_probe_status(struct net_device *dev, const u8 *addr, u64 cookie, bool acked, gfp_t gfp); void cfg80211_report_obss_beacon(struct wiphy *wiphy, const u8 *frame, size_t len, int freq, int sig_dbm, gfp_t gfp); int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type); u16 cfg80211_calculate_bitrate(struct rate_info *rate); struct device; enum ieee80211_max_queues { IEEE80211_MAX_QUEUES = 4, }; enum ieee80211_ac_numbers { IEEE80211_AC_VO = 0, IEEE80211_AC_VI = 1, IEEE80211_AC_BE = 2, IEEE80211_AC_BK = 3, }; struct ieee80211_tx_queue_params { u16 txop; u16 cw_min; u16 cw_max; u8 aifs; bool uapsd; }; struct ieee80211_low_level_stats { unsigned int dot11ACKFailureCount; unsigned int dot11RTSFailureCount; unsigned int dot11FCSErrorCount; unsigned int dot11RTSSuccessCount; }; enum ieee80211_bss_change { BSS_CHANGED_ASSOC = 1<<0, BSS_CHANGED_ERP_CTS_PROT = 1<<1, BSS_CHANGED_ERP_PREAMBLE = 1<<2, BSS_CHANGED_ERP_SLOT = 1<<3, BSS_CHANGED_HT = 1<<4, BSS_CHANGED_BASIC_RATES = 1<<5, BSS_CHANGED_BEACON_INT = 1<<6, BSS_CHANGED_BSSID = 1<<7, BSS_CHANGED_BEACON = 1<<8, BSS_CHANGED_BEACON_ENABLED = 1<<9, BSS_CHANGED_CQM = 1<<10, BSS_CHANGED_IBSS = 1<<11, BSS_CHANGED_ARP_FILTER = 1<<12, BSS_CHANGED_QOS = 1<<13, BSS_CHANGED_IDLE = 1<<14, BSS_CHANGED_SSID = 1<<15, BSS_CHANGED_AP_PROBE_RESP = 1<<16, }; enum ieee80211_rssi_event { RSSI_EVENT_HIGH, RSSI_EVENT_LOW, }; struct ieee80211_bss_conf { const u8 *bssid; bool assoc, ibss_joined; u16 aid; bool use_cts_prot; bool use_short_preamble; bool use_short_slot; bool enable_beacon; u8 dtim_period; u16 beacon_int; u16 assoc_capability; u64 last_tsf; u32 basic_rates; int mcast_rate[IEEE80211_NUM_BANDS]; u16 ht_operation_mode; s32 cqm_rssi_thold; u32 cqm_rssi_hyst; enum nl80211_channel_type channel_type; __be32 arp_addr_list[4]; u8 arp_addr_cnt; bool arp_filter_enabled; bool qos; bool idle; u8 ssid[32]; size_t ssid_len; bool hidden_ssid; }; enum mac80211_tx_control_flags { IEEE80211_TX_CTL_REQ_TX_STATUS = (1UL << (0)), IEEE80211_TX_CTL_ASSIGN_SEQ = (1UL << (1)), IEEE80211_TX_CTL_NO_ACK = (1UL << (2)), IEEE80211_TX_CTL_CLEAR_PS_FILT = (1UL << (3)), IEEE80211_TX_CTL_FIRST_FRAGMENT = (1UL << (4)), IEEE80211_TX_CTL_SEND_AFTER_DTIM = (1UL << (5)), IEEE80211_TX_CTL_AMPDU = (1UL << (6)), IEEE80211_TX_CTL_INJECTED = (1UL << (7)), IEEE80211_TX_STAT_TX_FILTERED = (1UL << (8)), IEEE80211_TX_STAT_ACK = (1UL << (9)), IEEE80211_TX_STAT_AMPDU = (1UL << (10)), IEEE80211_TX_STAT_AMPDU_NO_BACK = (1UL << (11)), IEEE80211_TX_CTL_RATE_CTRL_PROBE = (1UL << (12)), IEEE80211_TX_INTFL_NEED_TXPROCESSING = (1UL << (14)), IEEE80211_TX_INTFL_RETRIED = (1UL << (15)), IEEE80211_TX_INTFL_DONT_ENCRYPT = (1UL << (16)), IEEE80211_TX_CTL_NO_PS_BUFFER = (1UL << (17)), IEEE80211_TX_CTL_MORE_FRAMES = (1UL << (18)), IEEE80211_TX_INTFL_RETRANSMISSION = (1UL << (19)), IEEE80211_TX_INTFL_NL80211_FRAME_TX = (1UL << (21)), IEEE80211_TX_CTL_LDPC = (1UL << (22)), IEEE80211_TX_CTL_STBC = (1UL << (23)) | (1UL << (24)), IEEE80211_TX_CTL_TX_OFFCHAN = (1UL << (25)), IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = (1UL << (26)), IEEE80211_TX_CTL_NO_CCK_RATE = (1UL << (27)), IEEE80211_TX_STATUS_EOSP = (1UL << (28)), IEEE80211_TX_CTL_USE_MINRATE = (1UL << (29)), IEEE80211_TX_CTL_DONTFRAG = (1UL << (30)), }; enum mac80211_rate_control_flags { IEEE80211_TX_RC_USE_RTS_CTS = (1UL << (0)), IEEE80211_TX_RC_USE_CTS_PROTECT = (1UL << (1)), IEEE80211_TX_RC_USE_SHORT_PREAMBLE = (1UL << (2)), IEEE80211_TX_RC_MCS = (1UL << (3)), IEEE80211_TX_RC_GREEN_FIELD = (1UL << (4)), IEEE80211_TX_RC_40_MHZ_WIDTH = (1UL << (5)), IEEE80211_TX_RC_DUP_DATA = (1UL << (6)), IEEE80211_TX_RC_SHORT_GI = (1UL << (7)), }; struct ieee80211_tx_rate { s8 idx; u8 count; u8 flags; } __attribute__((packed)); struct ieee80211_tx_info { u32 flags; u8 band; u8 antenna_sel_tx; u16 ack_frame_id; union { struct { union { struct { struct ieee80211_tx_rate rates[ 5]; s8 rts_cts_rate_idx; }; unsigned long jiffies; }; struct ieee80211_vif *vif; struct ieee80211_key_conf *hw_key; struct ieee80211_sta *sta; } control; struct { struct ieee80211_tx_rate rates[5]; u8 ampdu_ack_len; int ack_signal; u8 ampdu_len; } status; struct { struct ieee80211_tx_rate driver_rates[ 5]; void *rate_driver_data[ 24 / sizeof(void *)]; }; void *driver_data[ 40 / sizeof(void *)]; }; }; struct ieee80211_sched_scan_ies { u8 *ie[IEEE80211_NUM_BANDS]; size_t len[IEEE80211_NUM_BANDS]; }; static inline __attribute__((no_instrument_function)) struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) { return (struct ieee80211_tx_info *)skb->cb; } static inline __attribute__((no_instrument_function)) struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb) { return (struct ieee80211_rx_status *)skb->cb; } static inline __attribute__((no_instrument_function)) void ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) { int i; ; ; ; for (i = 0; i < 5; i++) info->status.rates[i].count = 0; ; memset(&info->status.ampdu_ack_len, 0, sizeof(struct ieee80211_tx_info) - __builtin_offsetof(struct ieee80211_tx_info,status.ampdu_ack_len)); } enum mac80211_rx_flags { RX_FLAG_MMIC_ERROR = 1<<0, RX_FLAG_DECRYPTED = 1<<1, RX_FLAG_MMIC_STRIPPED = 1<<3, RX_FLAG_IV_STRIPPED = 1<<4, RX_FLAG_FAILED_FCS_CRC = 1<<5, RX_FLAG_FAILED_PLCP_CRC = 1<<6, RX_FLAG_MACTIME_MPDU = 1<<7, RX_FLAG_SHORTPRE = 1<<8, RX_FLAG_HT = 1<<9, RX_FLAG_40MHZ = 1<<10, RX_FLAG_SHORT_GI = 1<<11, RX_FLAG_NO_SIGNAL_VAL = 1<<12, }; struct ieee80211_rx_status { u64 mactime; enum ieee80211_band band; int freq; int signal; int antenna; int rate_idx; int flag; unsigned int rx_flags; }; enum ieee80211_conf_flags { IEEE80211_CONF_MONITOR = (1<<0), IEEE80211_CONF_PS = (1<<1), IEEE80211_CONF_IDLE = (1<<2), IEEE80211_CONF_OFFCHANNEL = (1<<3), }; enum ieee80211_conf_changed { IEEE80211_CONF_CHANGE_SMPS = (1UL << (1)), IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = (1UL << (2)), IEEE80211_CONF_CHANGE_MONITOR = (1UL << (3)), IEEE80211_CONF_CHANGE_PS = (1UL << (4)), IEEE80211_CONF_CHANGE_POWER = (1UL << (5)), IEEE80211_CONF_CHANGE_CHANNEL = (1UL << (6)), IEEE80211_CONF_CHANGE_RETRY_LIMITS = (1UL << (7)), IEEE80211_CONF_CHANGE_IDLE = (1UL << (8)), }; enum ieee80211_smps_mode { IEEE80211_SMPS_AUTOMATIC, IEEE80211_SMPS_OFF, IEEE80211_SMPS_STATIC, IEEE80211_SMPS_DYNAMIC, IEEE80211_SMPS_NUM_MODES, }; struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; int max_sleep_period; u16 listen_interval; u8 ps_dtim_period; u8 long_frame_max_tx_count, short_frame_max_tx_count; struct ieee80211_channel *channel; enum nl80211_channel_type channel_type; enum ieee80211_smps_mode smps_mode; }; struct ieee80211_channel_switch { u64 timestamp; bool block_tx; struct ieee80211_channel *channel; u8 count; }; enum ieee80211_vif_flags { IEEE80211_VIF_BEACON_FILTER = (1UL << (0)), IEEE80211_VIF_SUPPORTS_CQM_RSSI = (1UL << (1)), }; struct ieee80211_vif { enum nl80211_iftype type; struct ieee80211_bss_conf bss_conf; u8 addr[6]; bool p2p; u32 driver_flags; u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); }; static inline __attribute__((no_instrument_function)) bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) { return vif->type == NL80211_IFTYPE_MESH_POINT; return false; } enum ieee80211_key_flags { IEEE80211_KEY_FLAG_WMM_STA = 1<<0, IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, }; struct ieee80211_key_conf { u32 cipher; u8 icv_len; u8 iv_len; u8 hw_key_idx; u8 flags; s8 keyidx; u8 keylen; u8 key[0]; }; enum set_key_cmd { SET_KEY, DISABLE_KEY, }; enum ieee80211_sta_state { IEEE80211_STA_NOTEXIST, IEEE80211_STA_NONE, IEEE80211_STA_AUTH, IEEE80211_STA_ASSOC, IEEE80211_STA_AUTHORIZED, }; struct ieee80211_sta { u32 supp_rates[IEEE80211_NUM_BANDS]; u8 addr[6]; u16 aid; struct ieee80211_sta_ht_cap ht_cap; bool wme; u8 uapsd_queues; u8 max_sp; u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); }; enum sta_notify_cmd { STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, }; enum ieee80211_hw_flags { IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, IEEE80211_HW_SIGNAL_DBM = 1<<6, IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7, IEEE80211_HW_SPECTRUM_MGMT = 1<<8, IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, IEEE80211_HW_SUPPORTS_PS = 1<<10, IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, IEEE80211_HW_MFP_CAPABLE = 1<<13, IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, IEEE80211_HW_CONNECTION_MONITOR = 1<<19, IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, IEEE80211_HW_AP_LINK_PS = 1<<22, IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, }; struct ieee80211_hw { struct ieee80211_conf conf; struct wiphy *wiphy; const char *rate_control_algorithm; void *priv; u32 flags; unsigned int extra_tx_headroom; int channel_change_time; int vif_data_size; int sta_data_size; int napi_weight; u16 queues; u16 max_listen_interval; s8 max_signal; u8 max_rates; u8 max_report_rates; u8 max_rate_tries; u8 max_rx_aggregation_subframes; u8 max_tx_aggregation_subframes; }; struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy); static inline __attribute__((no_instrument_function)) void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) { set_wiphy_dev(hw->wiphy, dev); } static inline __attribute__((no_instrument_function)) void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) { ({ size_t __len = (6); void *__ret; if (__builtin_constant_p(6) && __len >= 64) __ret = __memcpy((hw->wiphy->perm_addr), (addr), __len); else __ret = __builtin_memcpy((hw->wiphy->perm_addr), (addr), __len); __ret; }); } static inline __attribute__((no_instrument_function)) struct ieee80211_rate * ieee80211_get_tx_rate(const struct ieee80211_hw *hw, const struct ieee80211_tx_info *c) { if (({ static bool __attribute__ ((__section__(".data.unlikely"))) __warned; int __ret_warn_once = !!(c->control.rates[0].idx < 0); if (ldv__builtin_expect(!!(__ret_warn_once), 0)) if (({ int __ret_warn_on = !!(!__warned); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/net/mac80211.h", 1330); ldv__builtin_expect(!!(__ret_warn_on), 0); })) __warned = true; ldv__builtin_expect(!!(__ret_warn_once), 0); })) return ((void *)0); return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; } static inline __attribute__((no_instrument_function)) struct ieee80211_rate * ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw, const struct ieee80211_tx_info *c) { if (c->control.rts_cts_rate_idx < 0) return ((void *)0); return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx]; } static inline __attribute__((no_instrument_function)) struct ieee80211_rate * ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, const struct ieee80211_tx_info *c, int idx) { if (c->control.rates[idx + 1].idx < 0) return ((void *)0); return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx]; } void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); enum ieee80211_filter_flags { FIF_PROMISC_IN_BSS = 1<<0, FIF_ALLMULTI = 1<<1, FIF_FCSFAIL = 1<<2, FIF_PLCPFAIL = 1<<3, FIF_BCN_PRBRESP_PROMISC = 1<<4, FIF_CONTROL = 1<<5, FIF_OTHER_BSS = 1<<6, FIF_PSPOLL = 1<<7, FIF_PROBE_REQ = 1<<8, }; enum ieee80211_ampdu_mlme_action { IEEE80211_AMPDU_RX_START, IEEE80211_AMPDU_RX_STOP, IEEE80211_AMPDU_TX_START, IEEE80211_AMPDU_TX_STOP, IEEE80211_AMPDU_TX_OPERATIONAL, }; enum ieee80211_frame_release_type { IEEE80211_FRAME_RELEASE_PSPOLL, IEEE80211_FRAME_RELEASE_UAPSD, }; struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); void (*tx_frags)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct sk_buff_head *skbs); int (*start)(struct ieee80211_hw *hw); void (*stop)(struct ieee80211_hw *hw); int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); int (*resume)(struct ieee80211_hw *hw); int (*add_interface)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); int (*change_interface)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum nl80211_iftype new_type, bool p2p); void (*remove_interface)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); int (*config)(struct ieee80211_hw *hw, u32 changed); void (*bss_info_changed)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, u32 changed); u64 (*prepare_multicast)(struct ieee80211_hw *hw, struct netdev_hw_addr_list *mc_list); void (*configure_filter)(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 multicast); int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key); void (*update_tkip_key)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_key_conf *conf, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); void (*set_rekey_data)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_gtk_rekey_data *data); int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_scan_request *req); void (*cancel_hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); int (*sched_scan_start)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_sched_scan_request *req, struct ieee80211_sched_scan_ies *ies); void (*sched_scan_stop)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void (*sw_scan_start)(struct ieee80211_hw *hw); void (*sw_scan_complete)(struct ieee80211_hw *hw); int (*get_stats)(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32, u16 *iv16); int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd, struct ieee80211_sta *sta); int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, enum ieee80211_sta_state old_state, enum ieee80211_sta_state new_state); int (*conf_tx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params); u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 tsf); void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); int (*tx_last_beacon)(struct ieee80211_hw *hw); int (*ampdu_action)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size); int (*get_survey)(struct ieee80211_hw *hw, int idx, struct survey_info *survey); void (*rfkill_poll)(struct ieee80211_hw *hw); void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, struct netlink_callback *cb, void *data, int len); void (*flush)(struct ieee80211_hw *hw, bool drop); void (*channel_switch)(struct ieee80211_hw *hw, struct ieee80211_channel_switch *ch_switch); int (*napi_poll)(struct ieee80211_hw *hw, int budget); int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); int (*remain_on_channel)(struct ieee80211_hw *hw, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type, int duration); int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); void (*get_ringparam)(struct ieee80211_hw *hw, u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); bool (*tx_frames_pending)(struct ieee80211_hw *hw); int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const struct cfg80211_bitrate_mask *mask); void (*rssi_callback)(struct ieee80211_hw *hw, enum ieee80211_rssi_event rssi_event); void (*allow_buffered_frames)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tids, int num_frames, enum ieee80211_frame_release_type reason, bool more_data); void (*release_buffered_frames)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tids, int num_frames, enum ieee80211_frame_release_type reason, bool more_data); }; struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, const struct ieee80211_ops *ops); int ieee80211_register_hw(struct ieee80211_hw *hw); struct ieee80211_tpt_blink { int throughput; int blink_time; }; enum ieee80211_tpt_led_trigger_flags { IEEE80211_TPT_LEDTRIG_FL_RADIO = (1UL << (0)), IEEE80211_TPT_LEDTRIG_FL_WORK = (1UL << (1)), IEEE80211_TPT_LEDTRIG_FL_CONNECTED = (1UL << (2)), }; extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw); extern char *__ieee80211_create_tpt_led_trigger( struct ieee80211_hw *hw, unsigned int flags, const struct ieee80211_tpt_blink *blink_table, unsigned int blink_table_len); static inline __attribute__((no_instrument_function)) char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) { return __ieee80211_get_tx_led_name(hw); } static inline __attribute__((no_instrument_function)) char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) { return __ieee80211_get_rx_led_name(hw); } static inline __attribute__((no_instrument_function)) char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) { return __ieee80211_get_assoc_led_name(hw); } static inline __attribute__((no_instrument_function)) char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) { return __ieee80211_get_radio_led_name(hw); } static inline __attribute__((no_instrument_function)) char * ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, const struct ieee80211_tpt_blink *blink_table, unsigned int blink_table_len) { return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table, blink_table_len); } void ieee80211_unregister_hw(struct ieee80211_hw *hw); void ieee80211_free_hw(struct ieee80211_hw *hw); void ieee80211_restart_hw(struct ieee80211_hw *hw); void ieee80211_napi_schedule(struct ieee80211_hw *hw); void ieee80211_napi_complete(struct ieee80211_hw *hw); void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); static inline __attribute__((no_instrument_function)) void ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb) { local_bh_disable(); ieee80211_rx(hw, skb); local_bh_enable(); } int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start); static inline __attribute__((no_instrument_function)) int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta, bool start) { int ret; local_bh_disable(); ret = ieee80211_sta_ps_transition(sta, start); local_bh_enable(); return ret; } void ieee80211_sta_set_buffered(struct ieee80211_sta *sta, u8 tid, bool buffered); void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb); static inline __attribute__((no_instrument_function)) void ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) { local_bh_disable(); ieee80211_tx_status(hw, skb); local_bh_enable(); } void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 *tim_offset, u16 *tim_length); static inline __attribute__((no_instrument_function)) struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { return ieee80211_beacon_get_tim(hw, vif, ((void *)0), ((void *)0)); } struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif); struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif); struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif); struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const u8 *ssid, size_t ssid_len, const u8 *ie, size_t ie_len); void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_info *frame_txctl, struct ieee80211_rts *rts); __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_info *frame_txctl); void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_info *frame_txctl, struct ieee80211_cts *cts); __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_info *frame_txctl); __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, struct ieee80211_rate *rate); struct sk_buff * ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, u32 iv32, u16 *p1k); static inline __attribute__((no_instrument_function)) void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, struct sk_buff *skb, u16 *p1k) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); u32 iv32 = get_unaligned_le32(&data[4]); ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k); } void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, const u8 *ta, u32 iv32, u16 *p1k); void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, struct sk_buff *skb, u8 *p2k); struct ieee80211_key_seq { union { struct { u32 iv32; u16 iv16; } tkip; struct { u8 pn[6]; } ccmp; struct { u8 pn[6]; } aes_cmac; }; }; void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, struct ieee80211_key_seq *seq); void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, int tid, struct ieee80211_key_seq *seq); void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid, const u8 *replay_ctr, gfp_t gfp); void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); void ieee80211_stop_queues(struct ieee80211_hw *hw); void ieee80211_wake_queues(struct ieee80211_hw *hw); void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); void ieee80211_sched_scan_results(struct ieee80211_hw *hw); void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, void (*iterator)(void *data, u8 *mac, struct ieee80211_vif *vif), void *data); void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, void (*iterator)(void *data, u8 *mac, struct ieee80211_vif *vif), void *data); void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work); void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *dwork, unsigned long delay); int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid, u16 timeout); void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, u16 tid); int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid); void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, u16 tid); struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *addr); struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const u8 *addr, const u8 *localaddr); void ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, bool block); void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); void ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void (*iter)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key, void *data), void *iter_data); struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void ieee80211_beacon_loss(struct ieee80211_vif *vif); void ieee80211_connection_loss(struct ieee80211_vif *vif); void ieee80211_resume_disconnect(struct ieee80211_vif *vif); void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif); void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif); void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, enum nl80211_cqm_rssi_threshold_event rssi_event, gfp_t gfp); unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif); void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); void ieee80211_request_smps(struct ieee80211_vif *vif, enum ieee80211_smps_mode smps_mode); void ieee80211_key_removed(struct ieee80211_key_conf *key_conf); void ieee80211_ready_on_channel(struct ieee80211_hw *hw); void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap, const u8 *addr); void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); enum rate_control_changed { IEEE80211_RC_HT_CHANGED = (1UL << (0)), IEEE80211_RC_SMPS_CHANGED = (1UL << (1)), }; struct ieee80211_tx_rate_control { struct ieee80211_hw *hw; struct ieee80211_supported_band *sband; struct ieee80211_bss_conf *bss_conf; struct sk_buff *skb; struct ieee80211_tx_rate reported_rate; bool rts, short_preamble; u8 max_rate_idx; u32 rate_idx_mask; u8 rate_idx_mcs_mask[10]; bool bss; }; struct rate_control_ops { struct module *module; const char *name; void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); void (*free)(void *priv); void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta); void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta, u32 changed, enum nl80211_channel_type oper_chan_type); void (*free_sta)(void *priv, struct ieee80211_sta *sta, void *priv_sta); void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta, struct sk_buff *skb); void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_rate_control *txrc); void (*add_sta_debugfs)(void *priv, void *priv_sta, struct dentry *dir); void (*remove_sta_debugfs)(void *priv, void *priv_sta); }; static inline __attribute__((no_instrument_function)) int rate_supported(struct ieee80211_sta *sta, enum ieee80211_band band, int index) { return (sta == ((void *)0) || sta->supp_rates[band] & (1UL << (index))); } bool rate_control_send_low(struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_rate_control *txrc); static inline __attribute__((no_instrument_function)) s8 rate_lowest_index(struct ieee80211_supported_band *sband, struct ieee80211_sta *sta) { int i; for (i = 0; i < sband->n_bitrates; i++) if (rate_supported(sta, sband->band, i)) return i; ({ static bool __attribute__ ((__section__(".data.unlikely"))) __warned; int __ret_warn_once = !!(1); if (ldv__builtin_expect(!!(__ret_warn_once), 0)) if (({ int __ret_warn_on = !!(!__warned); if (ldv__builtin_expect(!!(__ret_warn_on), 0)) warn_slowpath_null("include/net/mac80211.h", 3630); ldv__builtin_expect(!!(__ret_warn_on), 0); })) __warned = true; ldv__builtin_expect(!!(__ret_warn_once), 0); }); return 0; } static inline __attribute__((no_instrument_function)) bool rate_usable_index_exists(struct ieee80211_supported_band *sband, struct ieee80211_sta *sta) { unsigned int i; for (i = 0; i < sband->n_bitrates; i++) if (rate_supported(sta, sband->band, i)) return true; return false; } int ieee80211_rate_control_register(struct rate_control_ops *ops); void ieee80211_rate_control_unregister(struct rate_control_ops *ops); static inline __attribute__((no_instrument_function)) bool conf_is_ht20(struct ieee80211_conf *conf) { return conf->channel_type == NL80211_CHAN_HT20; } static inline __attribute__((no_instrument_function)) bool conf_is_ht40_minus(struct ieee80211_conf *conf) { return conf->channel_type == NL80211_CHAN_HT40MINUS; } static inline __attribute__((no_instrument_function)) bool conf_is_ht40_plus(struct ieee80211_conf *conf) { return conf->channel_type == NL80211_CHAN_HT40PLUS; } static inline __attribute__((no_instrument_function)) bool conf_is_ht40(struct ieee80211_conf *conf) { return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); } static inline __attribute__((no_instrument_function)) bool conf_is_ht(struct ieee80211_conf *conf) { return conf->channel_type != NL80211_CHAN_NO_HT; } static inline __attribute__((no_instrument_function)) enum nl80211_iftype ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p) { if (p2p) { switch (type) { case NL80211_IFTYPE_STATION: return NL80211_IFTYPE_P2P_CLIENT; case NL80211_IFTYPE_AP: return NL80211_IFTYPE_P2P_GO; default: break; } } return type; } static inline __attribute__((no_instrument_function)) enum nl80211_iftype ieee80211_vif_type_p2p(struct ieee80211_vif *vif) { return ieee80211_iftype_p2p(vif->type, vif->p2p); } void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, int rssi_min_thold, int rssi_max_thold); void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); struct device; enum led_brightness { LED_OFF = 0, LED_HALF = 127, LED_FULL = 255, }; struct led_classdev { const char *name; int brightness; int max_brightness; int flags; void (*brightness_set)(struct led_classdev *led_cdev, enum led_brightness brightness); enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); int (*blink_set)(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off); struct device *dev; struct list_head node; const char *default_trigger; unsigned long blink_delay_on, blink_delay_off; struct timer_list blink_timer; int blink_brightness; struct rw_semaphore trigger_lock; struct led_trigger *trigger; struct list_head trig_list; void *trigger_data; }; extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); extern void led_classdev_unregister(struct led_classdev *led_cdev); extern void led_classdev_suspend(struct led_classdev *led_cdev); extern void led_classdev_resume(struct led_classdev *led_cdev); extern void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off); extern void led_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness); struct led_trigger { const char *name; void (*activate)(struct led_classdev *led_cdev); void (*deactivate)(struct led_classdev *led_cdev); rwlock_t leddev_list_lock; struct list_head led_cdevs; struct list_head next_trig; }; extern int led_trigger_register(struct led_trigger *trigger); extern void led_trigger_unregister(struct led_trigger *trigger); extern void led_trigger_register_simple(const char *name, struct led_trigger **trigger); extern void led_trigger_unregister_simple(struct led_trigger *trigger); extern void led_trigger_event(struct led_trigger *trigger, enum led_brightness event); extern void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, unsigned long *delay_off); extern void ledtrig_ide_activity(void); struct led_info { const char *name; const char *default_trigger; int flags; }; struct led_platform_data { int num_leds; struct led_info *leds; }; struct gpio_led { const char *name; const char *default_trigger; unsigned gpio; unsigned active_low : 1; unsigned retain_state_suspended : 1; unsigned default_state : 2; }; struct gpio_led_platform_data { int num_leds; const struct gpio_led *leds; int (*gpio_blink_set)(unsigned gpio, int state, unsigned long *delay_on, unsigned long *delay_off); }; struct platform_device *gpio_led_register_device( int id, const struct gpio_led_platform_data *pdata); struct bootrec { __le32 code; __le32 len; u32 data[10]; } __attribute__((packed)); struct bootrec_desc { __le16 modes; __le16 flags; __le32 rx_start; __le32 rx_end; u8 headroom; u8 tailroom; u8 tx_queues; u8 tx_depth; u8 privacy_caps; u8 rx_keycache_size; u8 time_size; u8 padding; u8 rates[16]; u8 padding2[4]; __le16 rx_mtu; } __attribute__((packed)); struct bootrec_comp_id { __le32 fw_variant; } __attribute__((packed)); struct bootrec_comp_ver { char fw_version[24]; } __attribute__((packed)); struct bootrec_end { __le16 crc; u8 padding[2]; u8 md5[16]; } __attribute__((packed)); struct p54_tx_info { u32 start_addr; u32 end_addr; union { void *data[16 / sizeof(void *)]; struct { u32 extra_len; }; }; }; struct p54_edcf_queue_param { __le16 aifs; __le16 cwmin; __le16 cwmax; __le16 txop; } __attribute__((packed)); struct p54_rssi_db_entry { u16 freq; s16 mul; s16 add; s16 longbow_unkn; s16 longbow_unk2; }; struct p54_cal_database { size_t entries; size_t entry_size; size_t offset; size_t len; u8 data[0]; }; enum fw_state { FW_STATE_OFF, FW_STATE_BOOTING, FW_STATE_READY, FW_STATE_RESET, FW_STATE_RESETTING, }; struct p54_led_dev { struct ieee80211_hw *hw_dev; struct led_classdev led_dev; char name[31 + 1]; unsigned int toggled; unsigned int index; unsigned int registered; }; struct p54_tx_queue_stats { unsigned int len; unsigned int limit; unsigned int count; }; struct p54_common { struct ieee80211_hw *hw; struct ieee80211_vif *vif; void (*tx)(struct ieee80211_hw *dev, struct sk_buff *skb); int (*open)(struct ieee80211_hw *dev); void (*stop)(struct ieee80211_hw *dev); struct sk_buff_head tx_pending; struct sk_buff_head tx_queue; struct mutex conf_mutex; u32 rx_start; u32 rx_end; u16 rx_mtu; u8 headroom; u8 tailroom; unsigned int tx_hdr_len; unsigned int fw_var; unsigned int fw_interface; u8 version; bool use_short_slot; spinlock_t tx_stats_lock; struct p54_tx_queue_stats tx_stats[8]; struct p54_edcf_queue_param qos_params[8]; u16 rxhw; u8 rx_diversity_mask; u8 tx_diversity_mask; unsigned int output_power; struct p54_rssi_db_entry *cur_rssi; struct ieee80211_channel *curchan; struct survey_info *survey; unsigned int chan_num; struct completion stat_comp; bool update_stats; struct { unsigned int timestamp; unsigned int cached_cca; unsigned int cached_tx; unsigned int cached_rssi; u64 active; u64 cca; u64 tx; u64 rssi; } survey_raw; int noise; struct pda_iq_autocal_entry *iq_autocal; unsigned int iq_autocal_len; struct p54_cal_database *curve_data; struct p54_cal_database *output_limit; struct p54_cal_database *rssi_db; struct ieee80211_supported_band *band_table[IEEE80211_NUM_BANDS]; u8 mac_addr[6]; u8 bssid[6]; u8 mc_maclist[4][6]; u16 wakeup_timer; unsigned int filter_flags; int mc_maclist_num; int mode; u32 tsf_low32, tsf_high32; u32 basic_rate_mask; u16 aid; u8 coverage_class; bool phy_idle; bool phy_ps; bool powersave_override; __le32 beacon_req_id; struct completion beacon_comp; u8 privacy_caps; u8 rx_keycache_size; unsigned long *used_rxkeys; struct p54_led_dev leds[4]; struct delayed_work led_work; u16 softled_state; struct ieee80211_low_level_stats stats; struct delayed_work work; void *eeprom; struct completion eeprom_comp; struct mutex eeprom_mutex; }; int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb); void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb); int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw); int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len); int p54_read_eeprom(struct ieee80211_hw *dev); struct ieee80211_hw *p54_init_common(size_t priv_data_len); int p54_register_common(struct ieee80211_hw *dev, struct device *pdev); void p54_free_common(struct ieee80211_hw *dev); void p54_unregister_common(struct ieee80211_hw *dev); enum p54_control_frame_types { P54_CONTROL_TYPE_SETUP = 0, P54_CONTROL_TYPE_SCAN, P54_CONTROL_TYPE_TRAP, P54_CONTROL_TYPE_DCFINIT, P54_CONTROL_TYPE_RX_KEYCACHE, P54_CONTROL_TYPE_TIM, P54_CONTROL_TYPE_PSM, P54_CONTROL_TYPE_TXCANCEL, P54_CONTROL_TYPE_TXDONE, P54_CONTROL_TYPE_BURST, P54_CONTROL_TYPE_STAT_READBACK, P54_CONTROL_TYPE_BBP, P54_CONTROL_TYPE_EEPROM_READBACK, P54_CONTROL_TYPE_LED, P54_CONTROL_TYPE_GPIO, P54_CONTROL_TYPE_TIMER, P54_CONTROL_TYPE_MODULATION, P54_CONTROL_TYPE_SYNTH_CONFIG, P54_CONTROL_TYPE_DETECTOR_VALUE, P54_CONTROL_TYPE_XBOW_SYNTH_CFG, P54_CONTROL_TYPE_CCE_QUIET, P54_CONTROL_TYPE_PSM_STA_UNLOCK, P54_CONTROL_TYPE_PCS, P54_CONTROL_TYPE_BT_BALANCER = 28, P54_CONTROL_TYPE_GROUP_ADDRESS_TABLE = 30, P54_CONTROL_TYPE_ARPTABLE = 31, P54_CONTROL_TYPE_BT_OPTIONS = 35, }; struct p54_hdr { __le16 flags; __le16 len; __le32 req_id; __le16 type; u8 rts_tries; u8 tries; u8 data[0]; } __attribute__((packed)); struct exp_if { __le16 role; __le16 if_id; __le16 variant; __le16 btm_compat; __le16 top_compat; } __attribute__((packed)); struct dep_if { __le16 role; __le16 if_id; __le16 variant; } __attribute__((packed)); struct p54_eeprom_lm86 { union { struct { __le16 offset; __le16 len; u8 data[0]; } __attribute__((packed)) v1; struct { __le32 offset; __le16 len; u8 magic2; u8 pad; u8 magic[4]; u8 data[0]; } __attribute__((packed)) v2; } __attribute__((packed)); } __attribute__((packed)); enum p54_rx_decrypt_status { P54_DECRYPT_NONE = 0, P54_DECRYPT_OK, P54_DECRYPT_NOKEY, P54_DECRYPT_NOMICHAEL, P54_DECRYPT_NOCKIPMIC, P54_DECRYPT_FAIL_WEP, P54_DECRYPT_FAIL_TKIP, P54_DECRYPT_FAIL_MICHAEL, P54_DECRYPT_FAIL_CKIPKP, P54_DECRYPT_FAIL_CKIPMIC, P54_DECRYPT_FAIL_AESCCMP }; struct p54_rx_data { __le16 flags; __le16 len; __le16 freq; u8 antenna; u8 rate; u8 rssi; u8 quality; u8 decrypt_status; u8 rssi_raw; __le32 tsf32; __le32 unalloc0; u8 align[0]; } __attribute__((packed)); enum p54_trap_type { P54_TRAP_SCAN = 0, P54_TRAP_TIMER, P54_TRAP_BEACON_TX, P54_TRAP_FAA_RADIO_ON, P54_TRAP_FAA_RADIO_OFF, P54_TRAP_RADAR, P54_TRAP_NO_BEACON, P54_TRAP_TBTT, P54_TRAP_SCO_ENTER, P54_TRAP_SCO_EXIT }; struct p54_trap { __le16 event; __le16 frequency; } __attribute__((packed)); enum p54_frame_sent_status { P54_TX_OK = 0, P54_TX_FAILED, P54_TX_PSM, P54_TX_PSM_CANCELLED = 4 }; struct p54_frame_sent { u8 status; u8 tries; u8 ack_rssi; u8 quality; __le16 seq; u8 antenna; u8 padding; } __attribute__((packed)); enum p54_tx_data_crypt { P54_CRYPTO_NONE = 0, P54_CRYPTO_WEP, P54_CRYPTO_TKIP, P54_CRYPTO_TKIPMICHAEL, P54_CRYPTO_CCX_WEPMIC, P54_CRYPTO_CCX_KPMIC, P54_CRYPTO_CCX_KP, P54_CRYPTO_AESCCMP }; enum p54_tx_data_queue { P54_QUEUE_BEACON = 0, P54_QUEUE_FWSCAN = 1, P54_QUEUE_MGMT = 2, P54_QUEUE_CAB = 3, P54_QUEUE_DATA = 4, P54_QUEUE_AC_NUM = 4, P54_QUEUE_AC_VO = 4, P54_QUEUE_AC_VI = 5, P54_QUEUE_AC_BE = 6, P54_QUEUE_AC_BK = 7, P54_QUEUE_NUM = 8, }; struct p54_tx_data { u8 rateset[8]; u8 rts_rate_idx; u8 crypt_offset; u8 key_type; u8 key_len; u8 key[16]; u8 hw_queue; u8 backlog; __le16 durations[4]; u8 tx_antenna; union { struct { u8 cts_rate; __le16 output_power; } __attribute__((packed)) longbow; struct { u8 output_power; u8 cts_rate; u8 unalloc; } __attribute__((packed)) normal; } __attribute__((packed)); u8 unalloc2[2]; u8 align[0]; } __attribute__((packed)); struct p54_setup_mac { __le16 mac_mode; u8 mac_addr[6]; u8 bssid[6]; u8 rx_antenna; u8 rx_align; union { struct { __le32 basic_rate_mask; u8 rts_rates[8]; __le32 rx_addr; __le16 max_rx; __le16 rxhw; __le16 wakeup_timer; __le16 unalloc0; } __attribute__((packed)) v1; struct { __le32 rx_addr; __le16 max_rx; __le16 rxhw; __le16 timer; __le16 truncate; __le32 basic_rate_mask; u8 sbss_offset; u8 mcast_window; u8 rx_rssi_threshold; u8 rx_ed_threshold; __le32 ref_clock; __le16 lpf_bandwidth; __le16 osc_start_delay; } __attribute__((packed)) v2; } __attribute__((packed)); } __attribute__((packed)); struct p54_scan_head { __le16 mode; __le16 dwell; u8 scan_params[20]; __le16 freq; } __attribute__((packed)); struct p54_pa_curve_data_sample { u8 rf_power; u8 pa_detector; u8 data_barker; u8 data_bpsk; u8 data_qpsk; u8 data_16qam; u8 data_64qam; u8 padding; } __attribute__((packed)); struct p54_scan_body { u8 pa_points_per_curve; u8 val_barker; u8 val_bpsk; u8 val_qpsk; u8 val_16qam; u8 val_64qam; struct p54_pa_curve_data_sample curve_data[8]; u8 dup_bpsk; u8 dup_qpsk; u8 dup_16qam; u8 dup_64qam; } __attribute__((packed)); struct p54_channel_output_limit_longbow { __le16 rf_power_points[12]; } __attribute__((packed)); struct p54_pa_curve_data_sample_longbow { __le16 rf_power; __le16 pa_detector; struct { __le16 data[4]; } points[3] __attribute__((packed)); } __attribute__((packed)); struct p54_scan_body_longbow { struct p54_channel_output_limit_longbow power_limits; struct p54_pa_curve_data_sample_longbow curve_data[8]; __le16 unkn[6]; } __attribute__((packed)); union p54_scan_body_union { struct p54_scan_body normal; struct p54_scan_body_longbow longbow; } __attribute__((packed)); struct p54_scan_tail_rate { __le32 basic_rate_mask; u8 rts_rates[8]; } __attribute__((packed)); struct p54_led { __le16 flags; __le16 mask[2]; __le16 delay[2]; } __attribute__((packed)); struct p54_edcf { u8 flags; u8 slottime; u8 sifs; u8 eofpad; struct p54_edcf_queue_param queue[8]; u8 mapping[4]; __le16 frameburst; __le16 round_trip_delay; } __attribute__((packed)); struct p54_statistics { __le32 rx_success; __le32 rx_bad_fcs; __le32 rx_abort; __le32 rx_abort_phy; __le32 rts_success; __le32 rts_fail; __le32 tsf32; __le32 airtime; __le32 noise; __le32 sample_noise[8]; __le32 sample_cca; __le32 sample_tx; } __attribute__((packed)); struct p54_xbow_synth { __le16 magic1; __le16 magic2; __le16 freq; u32 padding[5]; } __attribute__((packed)); struct p54_timer { __le32 interval; } __attribute__((packed)); struct p54_keycache { u8 entry; u8 key_id; u8 mac[6]; u8 padding[2]; u8 key_type; u8 key_len; u8 key[24]; } __attribute__((packed)); struct p54_burst { u8 flags; u8 queue; u8 backlog; u8 pad; __le16 durations[32]; } __attribute__((packed)); struct p54_psm_interval { __le16 interval; __le16 periods; } __attribute__((packed)); struct p54_psm { __le16 mode; __le16 aid; struct p54_psm_interval intervals[4]; u8 beacon_rssi_skip_max; u8 rssi_delta_threshold; u8 nr; u8 exclude[1]; } __attribute__((packed)); struct p54_group_address_table { __le16 filter_enable; __le16 num_address; u8 mac_list[4][6]; } __attribute__((packed)); struct p54_txcancel { __le32 req_id; } __attribute__((packed)); struct p54_sta_unlock { u8 addr[6]; u16 padding; } __attribute__((packed)); struct p54_tim { u8 count; u8 padding[3]; __le16 entry[8]; } __attribute__((packed)); struct p54_cce_quiet { __le32 period; } __attribute__((packed)); struct p54_bt_balancer { __le16 prio_thresh; __le16 acl_thresh; } __attribute__((packed)); struct p54_arp_table { __le16 filter_enable; u8 ipv4_addr[4]; } __attribute__((packed)); int p54_set_leds(struct p54_common *priv); int p54_init_leds(struct p54_common *priv); void p54_unregister_leds(struct p54_common *priv); void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb); int p54_tx_cancel(struct p54_common *priv, __le32 req_id); void p54_tx(struct p54_common *priv, struct sk_buff *skb); int p54_init_xbow_synth(struct p54_common *priv); int p54_scan(struct p54_common *priv, u16 mode, u16 dwell); int p54_sta_unlock(struct p54_common *priv, u8 *addr); int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set); int p54_setup_mac(struct p54_common *priv); int p54_set_ps(struct p54_common *priv); int p54_fetch_statistics(struct p54_common *priv); int p54_set_groupfilter(struct p54_common *priv); int p54_set_edcf(struct p54_common *priv); int p54_upload_key(struct p54_common *priv, u8 algo, int slot, u8 idx, u8 len, u8 *addr, u8* key); int p54_download_eeprom(struct p54_common *priv, void *buf, u16 offset, u16 len); struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *p, const u16 freq); u8 *p54_find_ie(struct sk_buff *skb, u8 ie); struct p54p_csr { __le32 dev_int; u8 unused_1[12]; __le32 int_ident; __le32 int_ack; __le32 int_enable; u8 unused_2[4]; union { __le32 ring_control_base; __le32 gen_purp_com[2]; }; u8 unused_3[8]; __le32 direct_mem_base; u8 unused_4[44]; __le32 dma_addr; __le32 dma_len; __le32 dma_ctrl; u8 unused_5[12]; __le32 ctrl_stat; u8 unused_6[1924]; u8 cardbus_cis[0x800]; u8 direct_mem_win[0x1000]; } __attribute__((packed)); struct net2280_regs { __le32 devinit; __le32 eectl; __le32 eeclkfreq; u32 _unused0; __le32 pciirqenb0; __le32 pciirqenb1; __le32 cpu_irqenb0; __le32 cpu_irqenb1; u32 _unused1; __le32 usbirqenb1; __le32 irqstat0; __le32 irqstat1; __le32 idxaddr; __le32 idxdata; __le32 fifoctl; u32 _unused2; __le32 memaddr; __le32 memdata0; __le32 memdata1; u32 _unused3; __le32 gpioctl; __le32 gpiostat; } __attribute__((packed)); struct net2280_usb_regs { __le32 stdrsp; __le32 prodvendid; __le32 relnum; __le32 usbctl; __le32 usbstat; __le32 xcvrdiag; __le32 setup0123; __le32 setup4567; u32 _unused0; __le32 ouraddr; __le32 ourconfig; } __attribute__((packed)); struct net2280_pci_regs { __le32 pcimstctl; __le32 pcimstaddr; __le32 pcimstdata; __le32 pcimststat; } __attribute__((packed)); struct net2280_dma_regs { __le32 dmactl; __le32 dmastat; u32 _unused0[2]; __le32 dmacount; __le32 dmaaddr; __le32 dmadesc; u32 _unused1; } __attribute__((packed)); struct net2280_dep_regs { __le32 dep_cfg; __le32 dep_rsp; u32 _unused[2]; } __attribute__((packed)); struct net2280_ep_regs { __le32 ep_cfg; __le32 ep_rsp; __le32 ep_irqenb; __le32 ep_stat; __le32 ep_avail; __le32 ep_data; u32 _unused0[2]; } __attribute__((packed)); struct net2280_reg_write { __le16 port; __le32 addr; __le32 val; } __attribute__((packed)); struct net2280_reg_read { __le16 port; __le32 addr; } __attribute__((packed)); struct net2280_tx_hdr { __le32 device_addr; __le16 len; __le16 follower; u8 padding[8]; } __attribute__((packed)); struct lm87_tx_hdr { __le32 device_addr; __le32 chksum; } __attribute__((packed)); enum net2280_op_type { NET2280_BRG_U32 = 0x001F, NET2280_BRG_CFG_U32 = 0x000F, NET2280_BRG_CFG_U16 = 0x0003, NET2280_DEV_U32 = 0x080F, NET2280_DEV_CFG_U32 = 0x088F, NET2280_DEV_CFG_U16 = 0x0883 }; struct x2_header { u8 signature[4]; __le32 fw_load_addr; __le32 fw_length; __le32 crc; } __attribute__((packed)); enum p54u_pipe_addr { P54U_PIPE_DATA = 0x01, P54U_PIPE_MGMT = 0x02, P54U_PIPE_3 = 0x03, P54U_PIPE_4 = 0x04, P54U_PIPE_BRG = 0x0d, P54U_PIPE_DEV = 0x0e, P54U_PIPE_INT = 0x0f }; struct p54u_rx_info { struct urb *urb; struct ieee80211_hw *dev; }; enum p54u_hw_type { P54U_INVALID_HW, P54U_NET2280, P54U_3887, __NUM_P54U_HWTYPES, }; struct p54u_priv { struct p54_common common; struct usb_device *udev; struct usb_interface *intf; int (*upload_fw)(struct ieee80211_hw *dev); enum p54u_hw_type hw_type; spinlock_t lock; struct sk_buff_head rx_queue; struct usb_anchor submitted; const struct firmware *fw; }; static const char __mod_author31[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "author" "=" "Michael Wu "; static const char __mod_description32[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "description" "=" "Prism54 USB wireless driver"; static const char __mod_license33[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "license" "=" "GPL"; static const char __mod_alias34[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "alias" "=" "prism54usb"; static const char __mod_firmware35[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "firmware" "=" "isl3886usb"; static const char __mod_firmware36[] __attribute__((__used__)) __attribute__((section(".modinfo"), unused, aligned(1))) = "firmware" "=" "isl3887usb"; static struct usb_device_id p54u_table[] __attribute__ ((__section__(".devinit.data"))) = { {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0411), .idProduct = (0x0050)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x045e), .idProduct = (0x00c2)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0506), .idProduct = (0x0a11)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x06b9), .idProduct = (0x0120)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0707), .idProduct = (0xee06)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x07aa), .idProduct = (0x001c)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0x4501)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0x4502)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0x5501)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0846), .idProduct = (0x4200)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0846), .idProduct = (0x4210)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0846), .idProduct = (0x4220)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x09aa), .idProduct = (0x1000)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0bf8), .idProduct = (0x1007)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0cde), .idProduct = (0x0006)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0db0), .idProduct = (0x6826)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x107b), .idProduct = (0x55f2)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x124a), .idProduct = (0x4023)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1435), .idProduct = (0x0210)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x15a9), .idProduct = (0x0002)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1630), .idProduct = (0x0005)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x182d), .idProduct = (0x096b)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1915), .idProduct = (0x2234)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1915), .idProduct = (0x2235)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x2001), .idProduct = (0x3701)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x2001), .idProduct = (0x3703)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x2001), .idProduct = (0x3762)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x5041), .idProduct = (0x2234)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x5041), .idProduct = (0x2235)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0471), .idProduct = (0x1230)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x050d), .idProduct = (0x7050)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0572), .idProduct = (0x2000)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0572), .idProduct = (0x2002)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x06a9), .idProduct = (0x000e)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x06b9), .idProduct = (0x0121)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0707), .idProduct = (0xee13)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0x4521)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0xc501)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x083a), .idProduct = (0xf503)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0846), .idProduct = (0x4240)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0915), .idProduct = (0x2000)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0915), .idProduct = (0x2002)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0baf), .idProduct = (0x0118)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0bf8), .idProduct = (0x1009)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0cde), .idProduct = (0x0008)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0cde), .idProduct = (0x0015)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x0d8e), .idProduct = (0x3762)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x124a), .idProduct = (0x4025)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1260), .idProduct = (0xee22)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x13b1), .idProduct = (0x000a)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x13B1), .idProduct = (0x000C)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1413), .idProduct = (0x5400)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1435), .idProduct = (0x0427)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1668), .idProduct = (0x1050)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x1740), .idProduct = (0x1000)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x2001), .idProduct = (0x3704)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x2001), .idProduct = (0x3705)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x413c), .idProduct = (0x5513)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x413c), .idProduct = (0x8102)}, {.match_flags = (0x0001 | 0x0002), .idVendor = (0x413c), .idProduct = (0x8104)}, {} }; extern const struct usb_device_id __mod_usb_device_table __attribute__ ((unused, alias("p54u_table"))); static const struct { u32 intf; enum p54u_hw_type type; const char *fw; const char *fw_legacy; char hw[20]; } p54u_fwlist[__NUM_P54U_HWTYPES] = { { .type = P54U_NET2280, .intf = 0x4c4d3836, .fw = "isl3886usb", .fw_legacy = "isl3890usb", .hw = "ISL3886 + net2280", }, { .type = P54U_3887, .intf = 0x4c4d3837, .fw = "isl3887usb", .fw_legacy = "isl3887usb_bare", .hw = "ISL3887", }, }; static void p54u_rx_cb(struct urb *urb) { struct sk_buff *skb = (struct sk_buff *) urb->context; struct p54u_rx_info *info = (struct p54u_rx_info *)skb->cb; struct ieee80211_hw *dev = info->dev; struct p54u_priv *priv = dev->priv; skb_unlink(skb, &priv->rx_queue); if (ldv__builtin_expect(!!(urb->status), 0)) { dev_kfree_skb_irq(skb); return; } skb_put(skb, urb->actual_length); if (priv->hw_type == P54U_NET2280) skb_pull(skb, priv->common.tx_hdr_len); if (priv->common.fw_interface == 0x4c4d3837) { skb_pull(skb, 4); skb_put(skb, 4); } if (p54_rx(dev, skb)) { skb = dev_alloc_skb(priv->common.rx_mtu + 32); if (ldv__builtin_expect(!!(!skb), 0)) { return; } info = (struct p54u_rx_info *) skb->cb; info->urb = urb; info->dev = dev; urb->transfer_buffer = skb_tail_pointer(skb); urb->context = skb; } else { if (priv->hw_type == P54U_NET2280) skb_push(skb, priv->common.tx_hdr_len); if (priv->common.fw_interface == 0x4c4d3837) { skb_push(skb, 4); skb_put(skb, 4); } skb_reset_tail_pointer(skb); skb_trim(skb, 0); urb->transfer_buffer = skb_tail_pointer(skb); } skb_queue_tail(&priv->rx_queue, skb); usb_anchor_urb(urb, &priv->submitted); if (usb_submit_urb(urb, ((( gfp_t)0x20u)))) { skb_unlink(skb, &priv->rx_queue); usb_unanchor_urb(urb); dev_kfree_skb_irq(skb); } } static void p54u_tx_cb(struct urb *urb) { struct sk_buff *skb = urb->context; struct ieee80211_hw *dev = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); p54_free_skb(dev, skb); } static void p54u_tx_dummy_cb(struct urb *urb) { } static void p54u_free_urbs(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; usb_kill_anchored_urbs(&priv->submitted); } static int p54u_init_urbs(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; struct urb *entry = ((void *)0); struct sk_buff *skb; struct p54u_rx_info *info; int ret = 0; while (skb_queue_len(&priv->rx_queue) < 32) { skb = __dev_alloc_skb(priv->common.rx_mtu + 32, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (!skb) { ret = -12; goto err; } entry = usb_alloc_urb(0, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (!entry) { ret = -12; goto err; } usb_fill_bulk_urb(entry, priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DATA) | 0x80), skb_tail_pointer(skb), priv->common.rx_mtu + 32, p54u_rx_cb, skb); info = (struct p54u_rx_info *) skb->cb; info->urb = entry; info->dev = dev; skb_queue_tail(&priv->rx_queue, skb); usb_anchor_urb(entry, &priv->submitted); ret = usb_submit_urb(entry, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (ret) { skb_unlink(skb, &priv->rx_queue); usb_unanchor_urb(entry); goto err; } usb_free_urb(entry); entry = ((void *)0); } return 0; err: usb_free_urb(entry); kfree_skb(skb); p54u_free_urbs(dev); return ret; } static __le32 p54u_lm87_chksum(const __le32 *data, size_t length) { u32 chk = 0; length >>= 2; while (length--) { chk ^= (( __u32)(__le32)(*data++)); chk = (chk >> 5) ^ (chk << 3); } return (( __le32)(__u32)(chk)); } static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb) { struct p54u_priv *priv = dev->priv; struct urb *data_urb; struct lm87_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); data_urb = usb_alloc_urb(0, ((( gfp_t)0x20u))); if (!data_urb) { p54_free_skb(dev, skb); return; } hdr->chksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len); hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id; usb_fill_bulk_urb(data_urb, priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DATA)), hdr, skb->len + sizeof(*hdr), ((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> flags) == (( __le16)(__u16)(((1UL << (15)) + (1UL << (0)))))) ? p54u_tx_cb : p54u_tx_dummy_cb, skb); data_urb->transfer_flags |= 0x0040; usb_anchor_urb(data_urb, &priv->submitted); if (usb_submit_urb(data_urb, ((( gfp_t)0x20u)))) { usb_unanchor_urb(data_urb); p54_free_skb(dev, skb); } usb_free_urb(data_urb); } static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) { struct p54u_priv *priv = dev->priv; struct urb *int_urb = ((void *)0), *data_urb = ((void *)0); struct net2280_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); struct net2280_reg_write *reg = ((void *)0); int err = -12; reg = kmalloc(sizeof(*reg), ((( gfp_t)0x20u))); if (!reg) goto out; int_urb = usb_alloc_urb(0, ((( gfp_t)0x20u))); if (!int_urb) goto out; data_urb = usb_alloc_urb(0, ((( gfp_t)0x20u))); if (!data_urb) goto out; reg->port = (( __le16)(__u16)(NET2280_DEV_U32)); reg->addr = (( __le32)(__u32)(0x40000000)); reg->val = (( __le32)(__u32)(0x0040)); memset(hdr, 0, sizeof(*hdr)); hdr->len = (( __le16)(__u16)(skb->len)); hdr->device_addr = ((struct p54_hdr *) skb->data)->req_id; usb_fill_bulk_urb(int_urb, priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DEV)), reg, sizeof(*reg), p54u_tx_dummy_cb, dev); int_urb->transfer_flags |= 0x0100 | 0x0040; reg = ((void *)0); usb_fill_bulk_urb(data_urb, priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DATA)), hdr, skb->len + sizeof(*hdr), ((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> flags) == (( __le16)(__u16)(((1UL << (15)) + (1UL << (0)))))) ? p54u_tx_cb : p54u_tx_dummy_cb, skb); data_urb->transfer_flags |= 0x0040; usb_anchor_urb(int_urb, &priv->submitted); err = usb_submit_urb(int_urb, ((( gfp_t)0x20u))); if (err) { usb_unanchor_urb(int_urb); goto out; } usb_anchor_urb(data_urb, &priv->submitted); err = usb_submit_urb(data_urb, ((( gfp_t)0x20u))); if (err) { usb_unanchor_urb(data_urb); goto out; } out: usb_free_urb(int_urb); usb_free_urb(data_urb); if (err) { kfree(reg); p54_free_skb(dev, skb); } } static int p54u_write(struct p54u_priv *priv, struct net2280_reg_write *buf, enum net2280_op_type type, __le32 addr, __le32 val) { unsigned int ep; int alen; if (type & 0x0800) ep = ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DEV)); else ep = ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_BRG)); buf->port = (( __le16)(__u16)(type)); buf->addr = addr; buf->val = val; return usb_bulk_msg(priv->udev, ep, buf, sizeof(*buf), &alen, 1000); } static int p54u_read(struct p54u_priv *priv, void *buf, enum net2280_op_type type, __le32 addr, __le32 *val) { struct net2280_reg_read *read = buf; __le32 *reg = buf; unsigned int ep; int alen, err; if (type & 0x0800) ep = P54U_PIPE_DEV; else ep = P54U_PIPE_BRG; read->port = (( __le16)(__u16)(type)); read->addr = addr; err = usb_bulk_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, ep)), read, sizeof(*read), &alen, 1000); if (err) return err; err = usb_bulk_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, ep) | 0x80), reg, sizeof(*reg), &alen, 1000); if (err) return err; *val = *reg; return 0; } static int p54u_bulk_msg(struct p54u_priv *priv, unsigned int ep, void *data, size_t len) { int alen; return usb_bulk_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, ep)), data, len, &alen, 2000); } static int p54u_device_reset(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; int ret, lock = (priv->intf->condition != USB_INTERFACE_BINDING); if (lock) { ret = usb_lock_device_for_reset(priv->udev, priv->intf); if (ret < 0) { dev_err(&priv->udev->dev, "(p54usb) unable to lock " "device for reset (%d)!\n", ret); return ret; } } ret = usb_reset_device(priv->udev); if (lock) device_unlock(&(priv->udev)->dev); if (ret) dev_err(&priv->udev->dev, "(p54usb) unable to reset " "device (%d)!\n", ret); return ret; } static const char p54u_romboot_3887[] = "~~~~"; static int p54u_firmware_reset_3887(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; u8 *buf; int ret; buf = kmemdup(p54u_romboot_3887, 4, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (!buf) return -12; ret = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 4); kfree(buf); if (ret) dev_err(&priv->udev->dev, "(p54usb) unable to jump to " "boot ROM (%d)!\n", ret); return ret; } static const char p54u_firmware_upload_3887[] = "<\r"; static int p54u_upload_firmware_3887(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; int err, alen; u8 carry = 0; u8 *buf, *tmp; const u8 *data; unsigned int left, remains, block_size; struct x2_header *hdr; unsigned long timeout; err = p54u_firmware_reset_3887(dev); if (err) return err; tmp = buf = kmalloc(2048, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (!buf) { dev_err(&priv->udev->dev, "(p54usb) cannot allocate firmware" "upload buffer!\n"); return -12; } left = block_size = ({ typeof((size_t)2048) _min1 = ((size_t)2048); typeof(priv->fw->size) _min2 = (priv->fw->size); (void) (&_min1 == &_min2); _min1 < _min2 ? _min1 : _min2; }); strcpy(buf, p54u_firmware_upload_3887); left -= strlen(p54u_firmware_upload_3887); tmp += strlen(p54u_firmware_upload_3887); data = priv->fw->data; remains = priv->fw->size; hdr = (struct x2_header *)(buf + strlen(p54u_firmware_upload_3887)); ({ size_t __len = (4); void *__ret; if (__builtin_constant_p(4) && __len >= 64) __ret = __memcpy((hdr->signature), ("x2 "), __len); else __ret = __builtin_memcpy((hdr->signature), ("x2 "), __len); __ret; }); hdr->fw_load_addr = (( __le32)(__u32)(0x20000)); hdr->fw_length = (( __le32)(__u32)(priv->fw->size)); hdr->crc = (( __le32)(__u32)(~crc32_le(~0, (void *)&hdr->fw_load_addr, sizeof(u32)*2))) ; left -= sizeof(*hdr); tmp += sizeof(*hdr); while (remains) { while (left--) { if (carry) { *tmp++ = carry; carry = 0; remains--; continue; } switch (*data) { case '~': *tmp++ = '}'; carry = '^'; break; case '}': *tmp++ = '}'; carry = ']'; break; default: *tmp++ = *data; remains--; break; } data++; } err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_size); if (err) { dev_err(&priv->udev->dev, "(p54usb) firmware " "upload failed!\n"); goto err_upload_failed; } tmp = buf; left = block_size = ({ typeof((unsigned int)2048) _min1 = ((unsigned int)2048); typeof(remains) _min2 = (remains); (void) (&_min1 == &_min2); _min1 < _min2 ? _min1 : _min2; }); } *((__le32 *)buf) = (( __le32)(__u32)(~crc32_le(~0, priv->fw->data, priv->fw->size))) ; err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, sizeof(u32)); if (err) { dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n"); goto err_upload_failed; } timeout = jiffies + msecs_to_jiffies(1000); while (!(err = usb_bulk_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DATA) | 0x80), buf, 128, &alen, 1000))) { if (alen > 2 && !memcmp(buf, "OK", 2)) break; if (alen > 5 && !memcmp(buf, "ERROR", 5)) { err = -22; break; } if ((({ unsigned long __dummy; typeof(jiffies) __dummy2; (void)(&__dummy == &__dummy2); 1; }) && ({ unsigned long __dummy; typeof(timeout) __dummy2; (void)(&__dummy == &__dummy2); 1; }) && ((long)(timeout) - (long)(jiffies) < 0))) { dev_err(&priv->udev->dev, "(p54usb) firmware boot " "timed out!\n"); err = -110; break; } } if (err) { dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n"); goto err_upload_failed; } buf[0] = 'g'; buf[1] = '\r'; err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 2); if (err) { dev_err(&priv->udev->dev, "(p54usb) firmware boot failed!\n"); goto err_upload_failed; } timeout = jiffies + msecs_to_jiffies(1000); while (!(err = usb_bulk_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_DATA) | 0x80), buf, 128, &alen, 1000))) { if (alen > 0 && buf[0] == 'g') break; if ((({ unsigned long __dummy; typeof(jiffies) __dummy2; (void)(&__dummy == &__dummy2); 1; }) && ({ unsigned long __dummy; typeof(timeout) __dummy2; (void)(&__dummy == &__dummy2); 1; }) && ((long)(timeout) - (long)(jiffies) < 0))) { err = -110; break; } } if (err) goto err_upload_failed; err_upload_failed: kfree(buf); return err; } static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; const struct p54p_csr *devreg = (const struct p54p_csr *) 0x40000000; int err, alen; void *buf; __le32 reg; unsigned int remains, offset; const u8 *data; buf = kmalloc(512, ((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u))); if (!buf) { dev_err(&priv->udev->dev, "(p54usb) firmware buffer " "alloc failed!\n"); return -12; } do { err = p54u_read(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x50)), ®); if (err) goto fail; } while (0); reg |= (( __le32)(__u32)((1 << 1))); reg &= (( __le32)(__u32)(~(1 << 0))); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x50)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(100) && (100)<=5) ? ({ if (__builtin_constant_p((100)*1000)) { if (((100)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((100)*1000) * 0x10c7ul); } else { __udelay((100)*1000); } }) : ({unsigned long __ms=(100); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); reg |= (( __le32)(__u32)((1 << 0))); reg &= (( __le32)(__u32)(~(1 << 1))); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x50)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(100) && (100)<=5) ? ({ if (__builtin_constant_p((100)*1000)) { if (((100)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((100)*1000) * 0x10c7ul); } else { __udelay((100)*1000); } }) : ({unsigned long __ms=(100); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x00)), (( __le32)(__u32)((2 << 8) | (1 << 5) | (1 << 2)))); if (err) goto fail; } while (0) ; ( (__builtin_constant_p(20) && (20)<=5) ? ({ if (__builtin_constant_p((20)*1000)) { if (((20)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((20)*1000) * 0x10c7ul); } else { __udelay((20)*1000); } }) : ({unsigned long __ms=(20); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); do { err = p54u_write(priv, buf, NET2280_BRG_CFG_U16, (( __le32)(__u32)((u32)(unsigned long)0x04)), (( __le32)(__u32)(0x2 | 0x4))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_CFG_U32, (( __le32)(__u32)((u32)(unsigned long)0x10)), (( __le32)(__u32)(0x10000000))); if (err) goto fail; } while (0) ; do { err = p54u_read(priv, buf, NET2280_BRG_CFG_U16, (( __le32)(__u32)((u32)(unsigned long)0x06)), ®); if (err) goto fail; } while (0); reg |= (( __le32)(__u32)(0x2000)); do { err = p54u_write(priv, buf, NET2280_BRG_CFG_U16, (( __le32)(__u32)((u32)(unsigned long)0x06)), reg); if (err) goto fail; } while (0); do { err = p54u_read(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x88)), ®); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x324)), (( __le32)(__u32)((1 << 2)))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x364)), (( __le32)(__u32)((1 << 2)))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_CFG_U32, (( __le32)(__u32)((u32)(unsigned long)0x18)), (( __le32)(__u32)(0x20000000))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_CFG_U16, (( __le32)(__u32)((u32)(unsigned long)0x10000 | 0x04)), (( __le32)(__u32)(0x2 | 0x4))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_CFG_U16, (( __le32)(__u32)((u32)(unsigned long)0x10000 | 0x40)), 0); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_DEV_CFG_U32, (( __le32)(__u32)((u32)(unsigned long)0x10000 | 0x10)), (( __le32)(__u32)(0x40000000))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x24)), 0); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x2c)), (( __le32)(__u32)((1 << 24)))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_enable)), 0); if (err) goto fail; } while (0); do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), ®); if (err) goto fail; } while (0); reg &= (( __le32)(__u32)(~0x10000000)); reg &= (( __le32)(__u32)(~0x20000000)); reg &= (( __le32)(__u32)(~0x00800000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(20) && (20)<=5) ? ({ if (__builtin_constant_p((20)*1000)) { if (((20)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((20)*1000) * 0x10c7ul); } else { __udelay((20)*1000); } }) : ({unsigned long __ms=(20); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); reg |= (( __le32)(__u32)(0x10000000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(20) && (20)<=5) ? ({ if (__builtin_constant_p((20)*1000)) { if (((20)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((20)*1000) * 0x10c7ul); } else { __udelay((20)*1000); } }) : ({unsigned long __ms=(20); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); reg &= (( __le32)(__u32)(~0x10000000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(100) && (100)<=5) ? ({ if (__builtin_constant_p((100)*1000)) { if (((100)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((100)*1000) * 0x10c7ul); } else { __udelay((100)*1000); } }) : ({unsigned long __ms=(100); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ident)), ®); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ack)), reg); if (err) goto fail; } while (0); remains = priv->fw->size; data = priv->fw->data; offset = 0x20000; while (remains) { unsigned int block_len = ({ typeof(remains) _min1 = (remains); typeof((unsigned int)512) _min2 = ((unsigned int)512); (void) (&_min1 == &_min2); _min1 < _min2 ? _min1 : _min2; }); ({ size_t __len = (block_len); void *__ret; if (__builtin_constant_p(block_len) && __len >= 64) __ret = __memcpy((buf), (data), __len); else __ret = __builtin_memcpy((buf), (data), __len); __ret; }); err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_len); if (err) { dev_err(&priv->udev->dev, "(p54usb) firmware block " "upload failed\n"); goto fail; } do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->direct_mem_base)), (( __le32)(__u32)(0xc0000f00))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)0x0020 | (unsigned long)&devreg->direct_mem_win)), 0); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)0x0020 | (unsigned long)&devreg->direct_mem_win)), (( __le32)(__u32)(1))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)0x0024 | (unsigned long)&devreg->direct_mem_win)), (( __le32)(__u32)(block_len))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)0x0028 | (unsigned long)&devreg->direct_mem_win)), (( __le32)(__u32)(offset))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->dma_addr)), (( __le32)(__u32)(0x20000000))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->dma_len)), (( __le32)(__u32)(block_len >> 2))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->dma_ctrl)), (( __le32)(__u32)(0x00000004))); if (err) goto fail; } while (0) ; ( (__builtin_constant_p(10) && (10)<=5) ? ({ if (__builtin_constant_p((10)*1000)) { if (((10)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((10)*1000) * 0x10c7ul); } else { __udelay((10)*1000); } }) : ({unsigned long __ms=(10); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)0x002C | (unsigned long)&devreg->direct_mem_win)), ®); if (err) goto fail; } while (0) ; if (!(reg & (( __le32)(__u32)(0x00000001))) || !(reg & (( __le32)(__u32)(0x00000002)))) { dev_err(&priv->udev->dev, "(p54usb) firmware DMA " "transfer failed\n"); goto fail; } do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x32c)), (( __le32)(__u32)((1 << 9)))); if (err) goto fail; } while (0) ; remains -= block_len; data += block_len; offset += block_len; } do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), ®); if (err) goto fail; } while (0); reg &= (( __le32)(__u32)(~0x10000000)); reg &= (( __le32)(__u32)(~0x00800000)); reg |= (( __le32)(__u32)(0x20000000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(20) && (20)<=5) ? ({ if (__builtin_constant_p((20)*1000)) { if (((20)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((20)*1000) * 0x10c7ul); } else { __udelay((20)*1000); } }) : ({unsigned long __ms=(20); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); reg |= (( __le32)(__u32)(0x10000000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); reg &= (( __le32)(__u32)(~0x10000000)); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->ctrl_stat)), reg); if (err) goto fail; } while (0); ( (__builtin_constant_p(100) && (100)<=5) ? ({ if (__builtin_constant_p((100)*1000)) { if (((100)*1000) / 20000 >= 1) __bad_udelay(); else __const_udelay(((100)*1000) * 0x10c7ul); } else { __udelay((100)*1000); } }) : ({unsigned long __ms=(100); while (__ms--) ({ if (__builtin_constant_p(1000)) { if ((1000) / 20000 >= 1) __bad_udelay(); else __const_udelay((1000) * 0x10c7ul); } else { __udelay(1000); } });})); do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ident)), ®); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ack)), reg); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_enable)), (( __le32)(__u32)(0x0004))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x2c)), (( __le32)(__u32)((1 << 24)))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x24)), (( __le32)(__u32)((1 << 24) | (1 << 31)))); if (err) goto fail; } while (0) ; do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->dev_int)), (( __le32)(__u32)(0x0001))); if (err) goto fail; } while (0) ; err = usb_interrupt_msg(priv->udev, ((3 << 30) | __create_pipe(priv->udev, P54U_PIPE_INT) | 0x80), buf, sizeof(__le32), &alen, 1000); if (err || alen != sizeof(__le32)) goto fail; do { err = p54u_read(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ident)), ®); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_DEV_U32, (( __le32)(__u32)((u32)(unsigned long)&devreg->int_ack)), reg); if (err) goto fail; } while (0); if (!(reg & (( __le32)(__u32)(0x0004)))) err = -22; do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x24)), 0); if (err) goto fail; } while (0); do { err = p54u_write(priv, buf, NET2280_BRG_U32, (( __le32)(__u32)((u32)(unsigned long)0x2c)), (( __le32)(__u32)((1 << 24)))); if (err) goto fail; } while (0) ; fail: kfree(buf); return err; } static int p54u_load_firmware(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; int err, i; ; for (i = 0; i < __NUM_P54U_HWTYPES; i++) if (p54u_fwlist[i].type == priv->hw_type) break; if (i == __NUM_P54U_HWTYPES) return -95; err = request_firmware(&priv->fw, p54u_fwlist[i].fw, &priv->udev->dev); if (err) { dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " "(%d)!\n", p54u_fwlist[i].fw, err); err = request_firmware(&priv->fw, p54u_fwlist[i].fw_legacy, &priv->udev->dev); if (err) return err; } err = p54_parse_firmware(dev, priv->fw); if (err) goto out; if (priv->common.fw_interface != p54u_fwlist[i].intf) { dev_err(&priv->udev->dev, "wrong firmware, please get " "a firmware for \"%s\" and try again.\n", p54u_fwlist[i].hw); err = -22; } out: if (err) release_firmware(priv->fw); return err; } static int p54u_open(struct ieee80211_hw *dev) { struct p54u_priv *priv = dev->priv; int err; err = p54u_init_urbs(dev); if (err) { return err; } priv->common.open = p54u_init_urbs; return 0; } static void p54u_stop(struct ieee80211_hw *dev) { p54u_free_urbs(dev); } static int __attribute__ ((__section__(".devinit.text"))) __attribute__((no_instrument_function)) p54u_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); struct ieee80211_hw *dev; struct p54u_priv *priv; int err; unsigned int i, recognized_pipes; dev = p54_init_common(sizeof(*priv)); if (!dev) { dev_err(&udev->dev, "(p54usb) ieee80211 alloc failed\n"); return -12; } priv = dev->priv; priv->hw_type = P54U_INVALID_HW; SET_IEEE80211_DEV(dev, &intf->dev); usb_set_intfdata(intf, dev); priv->udev = udev; priv->intf = intf; skb_queue_head_init(&priv->rx_queue); init_usb_anchor(&priv->submitted); usb_get_dev(udev); i = intf->altsetting->desc.bNumEndpoints; recognized_pipes = 0; while (i--) { switch (intf->altsetting->endpoint[i].desc.bEndpointAddress) { case P54U_PIPE_DATA: case P54U_PIPE_MGMT: case P54U_PIPE_BRG: case P54U_PIPE_DEV: case P54U_PIPE_DATA | 0x80: case P54U_PIPE_MGMT | 0x80: case P54U_PIPE_BRG | 0x80: case P54U_PIPE_DEV | 0x80: case P54U_PIPE_INT | 0x80: recognized_pipes++; } } priv->common.open = p54u_open; priv->common.stop = p54u_stop; if (recognized_pipes < 9) { udev->reset_resume = 1; err = p54u_device_reset(dev); priv->hw_type = P54U_3887; dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); priv->common.tx_hdr_len = sizeof(struct lm87_tx_hdr); priv->common.tx = p54u_tx_lm87; priv->upload_fw = p54u_upload_firmware_3887; } else { priv->hw_type = P54U_NET2280; dev->extra_tx_headroom += sizeof(struct net2280_tx_hdr); priv->common.tx_hdr_len = sizeof(struct net2280_tx_hdr); priv->common.tx = p54u_tx_net2280; priv->upload_fw = p54u_upload_firmware_net2280; } err = p54u_load_firmware(dev); if (err) goto err_free_dev; err = priv->upload_fw(dev); if (err) goto err_free_fw; p54u_open(dev); err = p54_read_eeprom(dev); p54u_stop(dev); if (err) goto err_free_fw; err = p54_register_common(dev, &udev->dev); if (err) goto err_free_fw; return 0; err_free_fw: release_firmware(priv->fw); err_free_dev: p54_free_common(dev); usb_set_intfdata(intf, ((void *)0)); usb_put_dev(udev); return err; } static void __attribute__ ((__section__(".devexit.text"))) __attribute__((no_instrument_function)) p54u_disconnect(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); struct p54u_priv *priv; if (!dev) return; p54_unregister_common(dev); priv = dev->priv; usb_put_dev(interface_to_usbdev(intf)); release_firmware(priv->fw); p54_free_common(dev); } static int p54u_pre_reset(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); if (!dev) return -19; p54u_stop(dev); return 0; } static int p54u_resume(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); struct p54u_priv *priv; if (!dev) return -19; priv = dev->priv; if (ldv__builtin_expect(!!(!(priv->upload_fw && priv->fw)), 0)) return 0; return priv->upload_fw(dev); } static int p54u_post_reset(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); struct p54u_priv *priv; int err; err = p54u_resume(intf); if (err) return err; priv = dev->priv; if (priv->common.mode != NL80211_IFTYPE_UNSPECIFIED) ieee80211_restart_hw(dev); return 0; } static int p54u_suspend(struct usb_interface *intf, pm_message_t message) { return p54u_pre_reset(intf); } static struct usb_driver p54u_driver = { .name = "p54usb", .id_table = p54u_table, .probe = p54u_probe, .disconnect = p54u_disconnect, .pre_reset = p54u_pre_reset, .post_reset = p54u_post_reset, .suspend = p54u_suspend, .resume = p54u_resume, .reset_resume = p54u_resume, .soft_unbind = 1, }; static int __attribute__ ((__section__(".init.text"))) __attribute__((no_instrument_function)) p54u_driver_init(void) { return usb_register_driver(&(p54u_driver), (&__this_module), "p54usb"); } static inline __attribute__((no_instrument_function)) initcall_t __inittest(void) { return p54u_driver_init; } int init_module(void) __attribute__((alias("p54u_driver_init")));; static void __attribute__ ((__section__(".exit.text"))) __attribute__((no_instrument_function)) p54u_driver_exit(void) { usb_deregister(&(p54u_driver)); } static inline __attribute__((no_instrument_function)) exitcall_t __exittest(void) { return p54u_driver_exit; } void cleanup_module(void) __attribute__((alias("p54u_driver_exit")));;; void ldv_check_final_state(void); void ldv_check_return_value(int res); void ldv_initialize(void); int __VERIFIER_nondet_int(void); int LDV_IN_INTERRUPT; void main(void) { struct usb_interface * var_group1; const struct usb_device_id * var_p54u_probe_18_p1; static int res_p54u_probe_18; pm_message_t var_p54u_suspend_23_p1; LDV_IN_INTERRUPT=1; ldv_initialize(); int ldv_s_p54u_driver_usb_driver = 0; while( __VERIFIER_nondet_int() || !(ldv_s_p54u_driver_usb_driver == 0) ) { switch(__VERIFIER_nondet_int()) { case 0: { if(ldv_s_p54u_driver_usb_driver==0) { res_p54u_probe_18 = p54u_probe( var_group1, var_p54u_probe_18_p1); ldv_check_return_value(res_p54u_probe_18); if(res_p54u_probe_18) goto ldv_module_exit; ldv_s_p54u_driver_usb_driver++; } } break; case 1: { if(ldv_s_p54u_driver_usb_driver==1) { p54u_suspend( var_group1, var_p54u_suspend_23_p1); ldv_s_p54u_driver_usb_driver++; } } break; case 2: { if(ldv_s_p54u_driver_usb_driver==2) { p54u_resume( var_group1); ldv_s_p54u_driver_usb_driver++; } } break; case 3: { if(ldv_s_p54u_driver_usb_driver==3) { p54u_pre_reset( var_group1); ldv_s_p54u_driver_usb_driver++; } } break; case 4: { if(ldv_s_p54u_driver_usb_driver==4) { p54u_post_reset( var_group1); ldv_s_p54u_driver_usb_driver++; } } break; case 5: { if(ldv_s_p54u_driver_usb_driver==5) { p54u_disconnect( var_group1); ldv_s_p54u_driver_usb_driver=0; } } break; default: break; } } ldv_module_exit: ldv_final: ldv_check_final_state(); return; } void ldv_blast_assert(void) { ERROR: __VERIFIER_error(); } int __VERIFIER_nondet_int(void); void *__VERIFIER_nondet_pointer(void); unsigned long ldv_undefined_ulong(void); int ldv_mutex = 1; int mutex_lock_interruptible(struct mutex *lock) { int nondetermined; ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex = 2; return 0; } else { return -4; } } int __attribute__((warn_unused_result)) mutex_lock_killable(struct mutex *lock) { int nondetermined; ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex = 2; return 0; } else { return -4; } } int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock) { int atomic_value_after_dec; ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex = 2; return 1; } return 0; } void mutex_lock(struct mutex *lock) { ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); ldv_mutex = 2; } int mutex_trylock(struct mutex *lock) { int nondetermined; ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex = 2; return 1; } else { return 0; } } void mutex_unlock(struct mutex *lock) { ((ldv_mutex == 2) ? 0 : ldv_blast_assert()); ldv_mutex = 1; } void ldv_check_final_state(void) { ((ldv_mutex == 1) ? 0 : ldv_blast_assert()); } long ldv__builtin_expect(long val, long res) { return val; }