mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liguang <lig.fnst@cn.fujitsu.com>
To: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@redhat.com,
	acme@ghostprotocols.net, namhyung@kernel.org, jolsa@redhat.com,
	penberg@kernel.org, linux-kernel@vger.kernel.org
Cc: liguang <lig.fnst@cn.fujitsu.com>
Subject: [PATCH 3/3] perf: add dwarf regs map for mips
Date: Tue, 26 Feb 2013 12:12:54 +0800	[thread overview]
Message-ID: <1361851974-25307-3-git-send-email-lig.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1361851974-25307-1-git-send-email-lig.fnst@cn.fujitsu.com>

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 tools/perf/arch/mips/Makefile          |    4 +++
 tools/perf/arch/mips/util/dwarf-regs.c |   33 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 tools/perf/arch/mips/Makefile
 create mode 100644 tools/perf/arch/mips/util/dwarf-regs.c

diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
new file mode 100644
index 0000000..15130b5
--- /dev/null
+++ b/tools/perf/arch/mips/Makefile
@@ -0,0 +1,4 @@
+ifndef NO_DWARF
+PERF_HAVE_DWARF_REGS := 1
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+endif
diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/util/dwarf-regs.c
new file mode 100644
index 0000000..4871489
--- /dev/null
+++ b/tools/perf/arch/mips/util/dwarf-regs.c
@@ -0,0 +1,33 @@
+/*
+ * Mapping of DWARF debug register numbers into register names.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <libio.h>
+#include <dwarf-regs.h>
+
+#define MIPS_MAX_REGS	32
+
+const char *mips_regs_table[MIPS_MAX_REGS] = {
+	"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+	"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+	"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+	"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra",
+};
+
+/**
+ * get_arch_regstr() - lookup register name from it's DWARF register number
+ * @n:	the DWARF register number
+ *
+ * get_arch_regstr() returns the name of the register in struct
+ * regdwarfnum_table from it's DWARF register number. If the register is not
+ * found in the table, this returns NULL;
+ */
+const char *get_arch_regstr(unsigned int n)
+{
+	return (n <= MIPS_MAX_REGS) ? mips_regs_table[n] : NULL;
+}
-- 
1.7.2.5


  parent reply	other threads:[~2013-02-26  4:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26  4:12 [PATCH 1/3] perf: sort command-list.txt by alphabet order liguang
2013-02-26  4:12 ` [PATCH 2/3] perf: correct a build error liguang
2013-02-26  9:06   ` Namhyung Kim
2013-02-26  4:12 ` liguang [this message]
2013-03-01  0:37 ` [PATCH 1/3] perf: sort command-list.txt by alphabet order li guang
2013-03-21 10:52 ` [tip:perf/core] perf tools: Sort command-list.txt alphabetically tip-bot for liguang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361851974-25307-3-git-send-email-lig.fnst@cn.fujitsu.com \
    --to=lig.fnst@cn.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®