return __builtin_bswap64(val);
}
+#ifdef __SIZEOF_INT128__
static inline __attribute__((always_inline))
unsigned __int128 bpf_ntoh128(unsigned __int128 val) {
return (((unsigned __int128)bpf_ntohll(val) << 64) | (u64)bpf_ntohll(val >> 64));
}
+#endif
static inline __attribute__((always_inline))
u16 bpf_htons(u16 val) {
return bpf_ntohll(val);
}
+#ifdef __SIZEOF_INT128__
static inline __attribute__((always_inline))
unsigned __int128 bpf_hton128(unsigned __int128 val) {
return bpf_ntoh128(val);
}
+#endif
static inline __attribute__((always_inline))
u64 load_dword(void *skb, u64 off) {
}
#define MASK(_n) ((_n) < 64 ? (1ull << (_n)) - 1 : ((u64)-1LL))
+#ifdef __SIZEOF_INT128__
#define MASK128(_n) ((_n) < 128 ? ((unsigned __int128)1 << (_n)) - 1 : ((unsigned __int128)-1))
+#endif
static inline __attribute__((always_inline))
unsigned int bpf_log2(unsigned int v)
}
static inline __attribute__((always_inline))
-unsigned int bpf_log2l(unsigned long v)
+unsigned int bpf_log2l(unsigned long long v)
{
unsigned int hi = v >> 32;
if (hi)
#define PT_REGS_RC(x) ((x)->regs[0])
#define PT_REGS_SP(x) ((x)->sp)
#define PT_REGS_IP(x) ((x)->pc)
+#elif defined(__arm__)
+#define PT_REGS_PARM1(x) ((x)->uregs[0])
+#define PT_REGS_PARM2(x) ((x)->uregs[1])
+#define PT_REGS_PARM3(x) ((x)->uregs[2])
+#define PT_REGS_PARM4(x) ((x)->uregs[3])
+#define PT_REGS_PARM5(x) ((x)->uregs[4])
+#define PT_REGS_PARM6(x) ((x)->uregs[5])
+#define PT_REGS_RET(x) ((x)->uregs[14])
+#define PT_REGS_FP(x) ((x)->uregs[11])
+#define PT_REGS_RC(x) ((x)->uregs[0])
+#define PT_REGS_SP(x) ((x)->uregs[13])
+#define PT_REGS_IP(x) ((x)->uregs[12])
#else
#error "bcc does not support this platform yet"
#endif
lib.bpf_module_license.argtypes = [ct.c_void_p]
lib.bpf_module_kern_version.restype = ct.c_uint
lib.bpf_module_kern_version.argtypes = [ct.c_void_p]
-lib.bpf_num_functions.restype = ct.c_ulonglong
+lib.bpf_num_functions.restype = ct.c_size_t
lib.bpf_num_functions.argtypes = [ct.c_void_p]
lib.bpf_function_name.restype = ct.c_char_p
-lib.bpf_function_name.argtypes = [ct.c_void_p, ct.c_ulonglong]
+lib.bpf_function_name.argtypes = [ct.c_void_p, ct.c_size_t]
lib.bpf_function_start.restype = ct.c_void_p
lib.bpf_function_start.argtypes = [ct.c_void_p, ct.c_char_p]
lib.bpf_function_size.restype = ct.c_size_t
lib.bpf_function_size.argtypes = [ct.c_void_p, ct.c_char_p]
-lib.bpf_table_id.restype = ct.c_ulonglong
+lib.bpf_table_id.restype = ct.c_size_t
lib.bpf_table_id.argtypes = [ct.c_void_p, ct.c_char_p]
lib.bpf_table_fd.restype = ct.c_int
lib.bpf_table_fd.argtypes = [ct.c_void_p, ct.c_char_p]
lib.bpf_table_type_id.restype = ct.c_int
-lib.bpf_table_type_id.argtypes = [ct.c_void_p, ct.c_ulonglong]
-lib.bpf_table_max_entries_id.restype = ct.c_ulonglong
-lib.bpf_table_max_entries_id.argtypes = [ct.c_void_p, ct.c_ulonglong]
+lib.bpf_table_type_id.argtypes = [ct.c_void_p, ct.c_size_t]
+lib.bpf_table_max_entries_id.restype = ct.c_size_t
+lib.bpf_table_max_entries_id.argtypes = [ct.c_void_p, ct.c_size_t]
lib.bpf_table_flags_id.restype = ct.c_int
-lib.bpf_table_flags_id.argtypes = [ct.c_void_p, ct.c_ulonglong]
+lib.bpf_table_flags_id.argtypes = [ct.c_void_p, ct.c_size_t]
lib.bpf_table_key_desc.restype = ct.c_char_p
lib.bpf_table_key_desc.argtypes = [ct.c_void_p, ct.c_char_p]
lib.bpf_table_leaf_desc.restype = ct.c_char_p
lib.bpf_table_leaf_desc.argtypes = [ct.c_void_p, ct.c_char_p]
lib.bpf_table_key_snprintf.restype = ct.c_int
-lib.bpf_table_key_snprintf.argtypes = [ct.c_void_p, ct.c_ulonglong,
- ct.c_char_p, ct.c_ulonglong, ct.c_void_p]
+lib.bpf_table_key_snprintf.argtypes = [ct.c_void_p, ct.c_size_t,
+ ct.c_char_p, ct.c_size_t, ct.c_void_p]
lib.bpf_table_leaf_snprintf.restype = ct.c_int
-lib.bpf_table_leaf_snprintf.argtypes = [ct.c_void_p, ct.c_ulonglong,
- ct.c_char_p, ct.c_ulonglong, ct.c_void_p]
+lib.bpf_table_leaf_snprintf.argtypes = [ct.c_void_p, ct.c_size_t,
+ ct.c_char_p, ct.c_size_t, ct.c_void_p]
lib.bpf_table_key_sscanf.restype = ct.c_int
-lib.bpf_table_key_sscanf.argtypes = [ct.c_void_p, ct.c_ulonglong,
+lib.bpf_table_key_sscanf.argtypes = [ct.c_void_p, ct.c_size_t,
ct.c_char_p, ct.c_void_p]
lib.bpf_table_leaf_sscanf.restype = ct.c_int
-lib.bpf_table_leaf_sscanf.argtypes = [ct.c_void_p, ct.c_ulonglong,
+lib.bpf_table_leaf_sscanf.argtypes = [ct.c_void_p, ct.c_size_t,
ct.c_char_p, ct.c_void_p]
# keep in sync with libbpf.h