void-packages/srcpkgs/libunwind/patches/mips-read_write_s32.patch

53 lines
1.4 KiB
Diff

--- a/include/tdep-mips/libunwind_i.h 2020-11-10 17:14:01.000000000 +0100
+++ b/include/tdep-mips/libunwind_i.h 2021-01-11 22:12:16.993539625 +0100
@@ -148,9 +148,10 @@
static inline int
read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val)
{
- int offset = addr & 4;
int ret;
unw_word_t memval;
+#if _MIPS_SIM == _ABI64
+ int offset = addr & 4;
ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg);
if (ret < 0)
@@ -160,6 +161,13 @@
*val = (int32_t) memval;
else
*val = (int32_t) (memval >> 32);
+#else
+ ret = (*c->as->acc.access_mem) (c->as, addr, &memval, 0, c->as_arg);
+ if (ret < 0)
+ return ret;
+
+ *val = (int32_t) memval;
+#endif
return 0;
}
@@ -167,9 +175,10 @@
static inline int
write_s32 (struct dwarf_cursor *c, unw_word_t addr, const unw_word_t *val)
{
- int offset = addr & 4;
- int ret;
unw_word_t memval;
+#if _MIPS_SIM == _ABI64
+ int offset = addr & 4;
+ int ret;
ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg);
if (ret < 0)
@@ -181,6 +190,10 @@
memval = (memval & 0xffffffffLL) | (uint32_t) (*val << 32);
return (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 1, c->as_arg);
+#else
+ memval = (uint32_t) *val;
+ return (*c->as->acc.access_mem) (c->as, addr, &memval, 1, c->as_arg);
+#endif
}
/* FIXME: Implement these for the MIPS FPU. */