Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323667
b: refs/heads/master
c: 2bcd355
h: refs/heads/master
i:
  323665: 88999d3
  323663: 1ca0f4b
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Aug 10, 2012
1 parent dc10ec3 commit 9940e7e
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 239cc47819ec5e1acde42d416755c332ed5cf2c8
refs/heads/master: 2bcd355b71dafa5793a680c5db043abe9f708418
13 changes: 12 additions & 1 deletion trunk/tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/s390x/s390/ -e s/parisc64/parisc/ \
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
-e s/sh[234].*/sh/ )
NO_PERF_REGS := 1

CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar

# Additional ARCH settings for x86
ifeq ($(ARCH),i386)
ARCH := x86
ARCH := x86
NO_PERF_REGS := 0
endif
ifeq ($(ARCH),x86_64)
ARCH := x86
Expand All @@ -74,6 +76,7 @@ ifeq ($(ARCH),x86_64)
ARCH_CFLAGS := -DARCH_X86_64
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
endif
NO_PERF_REGS := 0
endif

# Treat warnings as errors unless directed not to
Expand Down Expand Up @@ -326,6 +329,7 @@ LIB_H += $(TRACE_EVENT_DIR)event-parse.h
LIB_H += util/target.h
LIB_H += util/rblist.h
LIB_H += util/intlist.h
LIB_H += util/perf_regs.h

LIB_OBJS += $(OUTPUT)util/abspath.o
LIB_OBJS += $(OUTPUT)util/alias.o
Expand Down Expand Up @@ -704,6 +708,13 @@ else
endif
endif

ifeq ($(NO_PERF_REGS),0)
ifeq ($(ARCH),x86)
LIB_H += arch/x86/include/perf_regs.h
endif
else
BASIC_CFLAGS += -DNO_PERF_REGS
endif

ifdef NO_STRLCPY
BASIC_CFLAGS += -DNO_STRLCPY
Expand Down
80 changes: 80 additions & 0 deletions trunk/tools/perf/arch/x86/include/perf_regs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef ARCH_PERF_REGS_H
#define ARCH_PERF_REGS_H

#include <stdlib.h>
#include "../../util/types.h"
#include "../../../../../arch/x86/include/asm/perf_regs.h"

#ifndef ARCH_X86_64
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
#else
#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
(1ULL << PERF_REG_X86_ES) | \
(1ULL << PERF_REG_X86_FS) | \
(1ULL << PERF_REG_X86_GS))
#define PERF_REGS_MASK (((1ULL << PERF_REG_X86_64_MAX) - 1) & ~REG_NOSUPPORT)
#endif
#define PERF_REG_IP PERF_REG_X86_IP
#define PERF_REG_SP PERF_REG_X86_SP

static inline const char *perf_reg_name(int id)
{
switch (id) {
case PERF_REG_X86_AX:
return "AX";
case PERF_REG_X86_BX:
return "BX";
case PERF_REG_X86_CX:
return "CX";
case PERF_REG_X86_DX:
return "DX";
case PERF_REG_X86_SI:
return "SI";
case PERF_REG_X86_DI:
return "DI";
case PERF_REG_X86_BP:
return "BP";
case PERF_REG_X86_SP:
return "SP";
case PERF_REG_X86_IP:
return "IP";
case PERF_REG_X86_FLAGS:
return "FLAGS";
case PERF_REG_X86_CS:
return "CS";
case PERF_REG_X86_SS:
return "SS";
case PERF_REG_X86_DS:
return "DS";
case PERF_REG_X86_ES:
return "ES";
case PERF_REG_X86_FS:
return "FS";
case PERF_REG_X86_GS:
return "GS";
#ifdef ARCH_X86_64
case PERF_REG_X86_R8:
return "R8";
case PERF_REG_X86_R9:
return "R9";
case PERF_REG_X86_R10:
return "R10";
case PERF_REG_X86_R11:
return "R11";
case PERF_REG_X86_R12:
return "R12";
case PERF_REG_X86_R13:
return "R13";
case PERF_REG_X86_R14:
return "R14";
case PERF_REG_X86_R15:
return "R15";
#endif /* ARCH_X86_64 */
default:
return NULL;
}

return NULL;
}

#endif /* ARCH_PERF_REGS_H */
14 changes: 14 additions & 0 deletions trunk/tools/perf/util/perf_regs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef __PERF_REGS_H
#define __PERF_REGS_H

#ifndef NO_PERF_REGS
#include <perf_regs.h>
#else
#define PERF_REGS_MASK 0

static inline const char *perf_reg_name(int id __used)
{
return NULL;
}
#endif /* NO_PERF_REGS */
#endif /* __PERF_REGS_H */

0 comments on commit 9940e7e

Please sign in to comment.