summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeng, Yimin (NSB - CN/Shanghai) <yimin.deng@nokia-sbell.com>2018-04-18 03:12:45 +0000
committerDave Watson <davejwatson@fb.com>2018-04-24 10:34:47 -0700
commitfba2ae7b2c43d3e706849c8098930683cbd0e322 (patch)
tree55dc096997a479b8bea2a6561df6629775dd84fa
parent2be1c2754a2f8dbeeb838fd9e6e1422f912efab7 (diff)
downloadlibunwind-fba2ae7b2c43d3e706849c8098930683cbd0e322.tar.gz
mipsN32: A modification suggestion to support mips N32
-rw-r--r--include/libunwind-mips.h2
-rw-r--r--include/tdep-mips/libunwind_i.h8
-rw-r--r--src/mips/Gcreate_addr_space.c8
-rw-r--r--src/mips/Gregs.c3
4 files changed, 19 insertions, 2 deletions
diff --git a/include/libunwind-mips.h b/include/libunwind-mips.h
index 97c95e24..ced34b20 100644
--- a/include/libunwind-mips.h
+++ b/include/libunwind-mips.h
@@ -98,7 +98,7 @@ typedef enum
UNW_MIPS_R30,
UNW_MIPS_R31,
- UNW_MIPS_PC = 34,
+ UNW_MIPS_PC = 64,
/* FIXME: Other registers! */
diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h
index 3fe40c0c..0c0fd3cf 100644
--- a/include/tdep-mips/libunwind_i.h
+++ b/include/tdep-mips/libunwind_i.h
@@ -247,6 +247,14 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
0, c->as_arg);
else if (c->as->abi == UNW_MIPS_ABI_O32)
return read_s32 (c, DWARF_GET_LOC (loc), val);
+ else if (c->as->abi == UNW_MIPS_ABI_N32) {
+ if (tdep_big_endian(c->as))
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc) + 4, val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ }
else
return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
diff --git a/src/mips/Gcreate_addr_space.c b/src/mips/Gcreate_addr_space.c
index 493d03db..c2408b95 100644
--- a/src/mips/Gcreate_addr_space.c
+++ b/src/mips/Gcreate_addr_space.c
@@ -58,7 +58,15 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
as->big_endian = (byte_order == __BIG_ENDIAN);
/* FIXME! There is no way to specify the ABI. */
+#if _MIPS_SIM == _ABIO32
as->abi = UNW_MIPS_ABI_O32;
+#elif _MIPS_SIM == _ABIN32
+ as->abi = UNW_MIPS_ABI_N32;
+#elif _MIPS_SIM == _ABI64
+ as->abi = UNW_MIPS_ABI_N64;
+#else
+# error Unsupported ABI
+#endif
as->addr_size = 4;
return as;
diff --git a/src/mips/Gregs.c b/src/mips/Gregs.c
index 95194022..e967324d 100644
--- a/src/mips/Gregs.c
+++ b/src/mips/Gregs.c
@@ -63,7 +63,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
case UNW_MIPS_R26:
case UNW_MIPS_R27:
case UNW_MIPS_R28:
- case UNW_MIPS_R29:
+
case UNW_MIPS_R30:
case UNW_MIPS_R31:
loc = c->dwarf.loc[reg - UNW_MIPS_R0];
@@ -75,6 +75,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
loc = c->dwarf.loc[reg];
break;
+ case UNW_MIPS_R29:
case UNW_MIPS_CFA:
if (write)
return -UNW_EREADONLYREG;