summaryrefslogtreecommitdiffstats
path: root/kernel/tools/perf/util/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/tools/perf/util/include')
-rw-r--r--kernel/tools/perf/util/include/asm/alternative-asm.h9
-rw-r--r--kernel/tools/perf/util/include/asm/asm-offsets.h1
-rw-r--r--kernel/tools/perf/util/include/asm/byteorder.h2
-rw-r--r--kernel/tools/perf/util/include/asm/cpufeature.h9
-rw-r--r--kernel/tools/perf/util/include/asm/dwarf2.h13
-rw-r--r--kernel/tools/perf/util/include/asm/swab.h1
-rw-r--r--kernel/tools/perf/util/include/asm/system.h1
-rw-r--r--kernel/tools/perf/util/include/asm/uaccess.h14
-rw-r--r--kernel/tools/perf/util/include/asm/unistd_32.h1
-rw-r--r--kernel/tools/perf/util/include/asm/unistd_64.h1
-rw-r--r--kernel/tools/perf/util/include/dwarf-regs.h8
-rw-r--r--kernel/tools/perf/util/include/linux/bitmap.h66
-rw-r--r--kernel/tools/perf/util/include/linux/const.h1
-rw-r--r--kernel/tools/perf/util/include/linux/ctype.h1
-rw-r--r--kernel/tools/perf/util/include/linux/kernel.h107
-rw-r--r--kernel/tools/perf/util/include/linux/linkage.h13
-rw-r--r--kernel/tools/perf/util/include/linux/list.h29
-rw-r--r--kernel/tools/perf/util/include/linux/poison.h1
-rw-r--r--kernel/tools/perf/util/include/linux/rbtree.h2
-rw-r--r--kernel/tools/perf/util/include/linux/rbtree_augmented.h2
-rw-r--r--kernel/tools/perf/util/include/linux/string.h3
21 files changed, 285 insertions, 0 deletions
diff --git a/kernel/tools/perf/util/include/asm/alternative-asm.h b/kernel/tools/perf/util/include/asm/alternative-asm.h
new file mode 100644
index 000000000..3a3a0f164
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/alternative-asm.h
@@ -0,0 +1,9 @@
+#ifndef _PERF_ASM_ALTERNATIVE_ASM_H
+#define _PERF_ASM_ALTERNATIVE_ASM_H
+
+/* Just disable it so we can build arch/x86/lib/memcpy_64.S for perf bench: */
+
+#define altinstruction_entry #
+#define ALTERNATIVE_2 #
+
+#endif
diff --git a/kernel/tools/perf/util/include/asm/asm-offsets.h b/kernel/tools/perf/util/include/asm/asm-offsets.h
new file mode 100644
index 000000000..ed5389425
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/asm-offsets.h
@@ -0,0 +1 @@
+/* stub */
diff --git a/kernel/tools/perf/util/include/asm/byteorder.h b/kernel/tools/perf/util/include/asm/byteorder.h
new file mode 100644
index 000000000..2a9bdc066
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/byteorder.h
@@ -0,0 +1,2 @@
+#include <asm/types.h>
+#include "../../../../include/uapi/linux/swab.h"
diff --git a/kernel/tools/perf/util/include/asm/cpufeature.h b/kernel/tools/perf/util/include/asm/cpufeature.h
new file mode 100644
index 000000000..acffd5e4d
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/cpufeature.h
@@ -0,0 +1,9 @@
+
+#ifndef PERF_CPUFEATURE_H
+#define PERF_CPUFEATURE_H
+
+/* cpufeature.h ... dummy header file for including arch/x86/lib/memcpy_64.S */
+
+#define X86_FEATURE_REP_GOOD 0
+
+#endif /* PERF_CPUFEATURE_H */
diff --git a/kernel/tools/perf/util/include/asm/dwarf2.h b/kernel/tools/perf/util/include/asm/dwarf2.h
new file mode 100644
index 000000000..afe38199e
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/dwarf2.h
@@ -0,0 +1,13 @@
+
+#ifndef PERF_DWARF2_H
+#define PERF_DWARF2_H
+
+/* dwarf2.h ... dummy header file for including arch/x86/lib/mem{cpy,set}_64.S */
+
+#define CFI_STARTPROC
+#define CFI_ENDPROC
+#define CFI_REMEMBER_STATE
+#define CFI_RESTORE_STATE
+
+#endif /* PERF_DWARF2_H */
+
diff --git a/kernel/tools/perf/util/include/asm/swab.h b/kernel/tools/perf/util/include/asm/swab.h
new file mode 100644
index 000000000..ed5389425
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/swab.h
@@ -0,0 +1 @@
+/* stub */
diff --git a/kernel/tools/perf/util/include/asm/system.h b/kernel/tools/perf/util/include/asm/system.h
new file mode 100644
index 000000000..710cecca9
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/system.h
@@ -0,0 +1 @@
+/* Empty */
diff --git a/kernel/tools/perf/util/include/asm/uaccess.h b/kernel/tools/perf/util/include/asm/uaccess.h
new file mode 100644
index 000000000..d0f72b8fc
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/uaccess.h
@@ -0,0 +1,14 @@
+#ifndef _PERF_ASM_UACCESS_H_
+#define _PERF_ASM_UACCESS_H_
+
+#define __get_user(src, dest) \
+({ \
+ (src) = *dest; \
+ 0; \
+})
+
+#define get_user __get_user
+
+#define access_ok(type, addr, size) 1
+
+#endif
diff --git a/kernel/tools/perf/util/include/asm/unistd_32.h b/kernel/tools/perf/util/include/asm/unistd_32.h
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/unistd_32.h
@@ -0,0 +1 @@
+
diff --git a/kernel/tools/perf/util/include/asm/unistd_64.h b/kernel/tools/perf/util/include/asm/unistd_64.h
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/kernel/tools/perf/util/include/asm/unistd_64.h
@@ -0,0 +1 @@
+
diff --git a/kernel/tools/perf/util/include/dwarf-regs.h b/kernel/tools/perf/util/include/dwarf-regs.h
new file mode 100644
index 000000000..8f149655f
--- /dev/null
+++ b/kernel/tools/perf/util/include/dwarf-regs.h
@@ -0,0 +1,8 @@
+#ifndef _PERF_DWARF_REGS_H_
+#define _PERF_DWARF_REGS_H_
+
+#ifdef HAVE_DWARF_SUPPORT
+const char *get_arch_regstr(unsigned int n);
+#endif
+
+#endif
diff --git a/kernel/tools/perf/util/include/linux/bitmap.h b/kernel/tools/perf/util/include/linux/bitmap.h
new file mode 100644
index 000000000..40bd21488
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/bitmap.h
@@ -0,0 +1,66 @@
+#ifndef _PERF_BITOPS_H
+#define _PERF_BITOPS_H
+
+#include <string.h>
+#include <linux/bitops.h>
+
+#define DECLARE_BITMAP(name,bits) \
+ unsigned long name[BITS_TO_LONGS(bits)]
+
+int __bitmap_weight(const unsigned long *bitmap, int bits);
+void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+
+#define BITMAP_LAST_WORD_MASK(nbits) \
+( \
+ ((nbits) % BITS_PER_LONG) ? \
+ (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
+)
+
+#define small_const_nbits(nbits) \
+ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
+
+static inline void bitmap_zero(unsigned long *dst, int nbits)
+{
+ if (small_const_nbits(nbits))
+ *dst = 0UL;
+ else {
+ int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+ memset(dst, 0, len);
+ }
+}
+
+static inline int bitmap_weight(const unsigned long *src, int nbits)
+{
+ if (small_const_nbits(nbits))
+ return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
+ return __bitmap_weight(src, nbits);
+}
+
+static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (small_const_nbits(nbits))
+ *dst = *src1 | *src2;
+ else
+ __bitmap_or(dst, src1, src2, nbits);
+}
+
+/**
+ * test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ */
+static inline int test_and_set_bit(int nr, unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long old;
+
+ old = *p;
+ *p = old | mask;
+
+ return (old & mask) != 0;
+}
+
+#endif /* _PERF_BITOPS_H */
diff --git a/kernel/tools/perf/util/include/linux/const.h b/kernel/tools/perf/util/include/linux/const.h
new file mode 100644
index 000000000..c10a35e1a
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/const.h
@@ -0,0 +1 @@
+#include "../../../../include/uapi/linux/const.h"
diff --git a/kernel/tools/perf/util/include/linux/ctype.h b/kernel/tools/perf/util/include/linux/ctype.h
new file mode 100644
index 000000000..a53d4ee1e
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/ctype.h
@@ -0,0 +1 @@
+#include "../util.h"
diff --git a/kernel/tools/perf/util/include/linux/kernel.h b/kernel/tools/perf/util/include/linux/kernel.h
new file mode 100644
index 000000000..09e8e7aea
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/kernel.h
@@ -0,0 +1,107 @@
+#ifndef PERF_LINUX_KERNEL_H_
+#define PERF_LINUX_KERNEL_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+
+#define PERF_ALIGN(x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1)
+#define __PERF_ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#ifndef container_of
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr: the pointer to the member.
+ * @type: the type of the container struct this is embedded in.
+ * @member: the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({ \
+ const typeof(((type *)0)->member) * __mptr = (ptr); \
+ (type *)((char *)__mptr - offsetof(type, member)); })
+#endif
+
+#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
+
+#ifndef max
+#define max(x, y) ({ \
+ typeof(x) _max1 = (x); \
+ typeof(y) _max2 = (y); \
+ (void) (&_max1 == &_max2); \
+ _max1 > _max2 ? _max1 : _max2; })
+#endif
+
+#ifndef min
+#define min(x, y) ({ \
+ typeof(x) _min1 = (x); \
+ typeof(y) _min2 = (y); \
+ (void) (&_min1 == &_min2); \
+ _min1 < _min2 ? _min1 : _min2; })
+#endif
+
+#ifndef roundup
+#define roundup(x, y) ( \
+{ \
+ const typeof(y) __y = y; \
+ (((x) + (__y - 1)) / __y) * __y; \
+} \
+)
+#endif
+
+#ifndef BUG_ON
+#ifdef NDEBUG
+#define BUG_ON(cond) do { if (cond) {} } while (0)
+#else
+#define BUG_ON(cond) assert(!(cond))
+#endif
+#endif
+
+/*
+ * Both need more care to handle endianness
+ * (Don't use bitmap_copy_le() for now)
+ */
+#define cpu_to_le64(x) (x)
+#define cpu_to_le32(x) (x)
+
+static inline int
+vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
+{
+ int i;
+ ssize_t ssize = size;
+
+ i = vsnprintf(buf, size, fmt, args);
+
+ return (i >= ssize) ? (ssize - 1) : i;
+}
+
+static inline int scnprintf(char * buf, size_t size, const char * fmt, ...)
+{
+ va_list args;
+ ssize_t ssize = size;
+ int i;
+
+ va_start(args, fmt);
+ i = vsnprintf(buf, size, fmt, args);
+ va_end(args);
+
+ return (i >= ssize) ? (ssize - 1) : i;
+}
+
+/*
+ * This looks more complex than it should be. But we need to
+ * get the type for the ~ right in round_down (it needs to be
+ * as wide as the result!), and we want to evaluate the macro
+ * arguments just once each.
+ */
+#define __round_mask(x, y) ((__typeof__(x))((y)-1))
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define round_down(x, y) ((x) & ~__round_mask(x, y))
+
+#endif
diff --git a/kernel/tools/perf/util/include/linux/linkage.h b/kernel/tools/perf/util/include/linux/linkage.h
new file mode 100644
index 000000000..06387cffe
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/linkage.h
@@ -0,0 +1,13 @@
+
+#ifndef PERF_LINUX_LINKAGE_H_
+#define PERF_LINUX_LINKAGE_H_
+
+/* linkage.h ... for including arch/x86/lib/memcpy_64.S */
+
+#define ENTRY(name) \
+ .globl name; \
+ name:
+
+#define ENDPROC(name)
+
+#endif /* PERF_LINUX_LINKAGE_H_ */
diff --git a/kernel/tools/perf/util/include/linux/list.h b/kernel/tools/perf/util/include/linux/list.h
new file mode 100644
index 000000000..76ddbc726
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/list.h
@@ -0,0 +1,29 @@
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include "../../../../include/linux/list.h"
+
+#ifndef PERF_LIST_H
+#define PERF_LIST_H
+/**
+ * list_del_range - deletes range of entries from list.
+ * @begin: first element in the range to delete from the list.
+ * @end: last element in the range to delete from the list.
+ * Note: list_empty on the range of entries does not return true after this,
+ * the entries is in an undefined state.
+ */
+static inline void list_del_range(struct list_head *begin,
+ struct list_head *end)
+{
+ begin->prev->next = end->next;
+ end->next->prev = begin->prev;
+}
+
+/**
+ * list_for_each_from - iterate over a list from one of its nodes
+ * @pos: the &struct list_head to use as a loop cursor, from where to start
+ * @head: the head for your list.
+ */
+#define list_for_each_from(pos, head) \
+ for (; pos != (head); pos = pos->next)
+#endif
diff --git a/kernel/tools/perf/util/include/linux/poison.h b/kernel/tools/perf/util/include/linux/poison.h
new file mode 100644
index 000000000..fef6dbc9c
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/poison.h
@@ -0,0 +1 @@
+#include "../../../../include/linux/poison.h"
diff --git a/kernel/tools/perf/util/include/linux/rbtree.h b/kernel/tools/perf/util/include/linux/rbtree.h
new file mode 100644
index 000000000..2a030c5af
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/rbtree.h
@@ -0,0 +1,2 @@
+#include <stdbool.h>
+#include "../../../../include/linux/rbtree.h"
diff --git a/kernel/tools/perf/util/include/linux/rbtree_augmented.h b/kernel/tools/perf/util/include/linux/rbtree_augmented.h
new file mode 100644
index 000000000..9d6fcdf17
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/rbtree_augmented.h
@@ -0,0 +1,2 @@
+#include <stdbool.h>
+#include "../../../../include/linux/rbtree_augmented.h"
diff --git a/kernel/tools/perf/util/include/linux/string.h b/kernel/tools/perf/util/include/linux/string.h
new file mode 100644
index 000000000..6f19c548e
--- /dev/null
+++ b/kernel/tools/perf/util/include/linux/string.h
@@ -0,0 +1,3 @@
+#include <string.h>
+
+void *memdup(const void *src, size_t len);