summaryrefslogtreecommitdiff
path: root/src/sh/regname.c
diff options
context:
space:
mode:
authorTommi Rantala <tt.rantala@gmail.com>2012-08-16 13:10:29 +0300
committerTommi Rantala <tt.rantala@gmail.com>2012-09-28 14:50:03 +0300
commit8d5b1aeeffb80515197fd7aeee0b3fbfac904ecd (patch)
tree70898dc1bf11f5e99a6cb32998eb734e579da8c0 /src/sh/regname.c
parent7d77ef4d82b3eca8ca3a869cd313428026a122a7 (diff)
downloadlibunwind-8d5b1aeeffb80515197fd7aeee0b3fbfac904ecd.tar.gz
SuperH port
Add support for the 32bit SuperH architecture running Linux. Specifically, support is added for SH4, and support for earlier SH versions and to the 64bit SH5 are left out. This was tested in qemu with a little-endian SH4 debian image & GCC 4.7 cross compiler.
Diffstat (limited to 'src/sh/regname.c')
-rw-r--r--src/sh/regname.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/sh/regname.c b/src/sh/regname.c
new file mode 100644
index 00000000..dcab2405
--- /dev/null
+++ b/src/sh/regname.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *const regname[] =
+ {
+ [UNW_SH_R0] = "r0",
+ [UNW_SH_R1] = "r1",
+ [UNW_SH_R2] = "r2",
+ [UNW_SH_R3] = "r3",
+ [UNW_SH_R4] = "r4",
+ [UNW_SH_R5] = "r5",
+ [UNW_SH_R6] = "r6",
+ [UNW_SH_R7] = "r7",
+ [UNW_SH_R8] = "r8",
+ [UNW_SH_R9] = "r9",
+ [UNW_SH_R10] = "r10",
+ [UNW_SH_R11] = "r11",
+ [UNW_SH_R12] = "r12",
+ [UNW_SH_R13] = "r13",
+ [UNW_SH_R14] = "r14",
+ [UNW_SH_R15] = "r15",
+ [UNW_SH_PC] = "pc",
+ [UNW_SH_PR] = "pr",
+ };
+
+PROTECTED const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname) && regname[reg] != NULL)
+ return regname[reg];
+ else
+ return "???";
+}