void-packages/srcpkgs/libunwind/patches/mips-read_write_s32.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

52 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. */