void-packages/srcpkgs/tor/patches/ppc.patch
Đoàn Trần Công Danh 4f75cf25fd srcpkgs/t*: 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

35 lines
760 B
Diff

--- a/src/lib/sandbox/sandbox.c
+++ b/src/lib/sandbox/sandbox.c
@@ -115,6 +115,16 @@
#define REG_SYSCALL 8
#define M_SYSCALL regs[REG_SYSCALL]
+#elif defined(__powerpc64__)
+
+#define REG_SYSCALL 0
+#define M_SYSCALL gp_regs[REG_SYSCALL]
+
+#elif defined(__powerpc__)
+
+#define REG_SYSCALL 0
+#define M_SYSCALL gregs[REG_SYSCALL]
+
#endif /* defined(__i386__) || ... */
#ifdef M_SYSCALL
@@ -1654,7 +1664,15 @@
static int
get_syscall_from_ucontext(const ucontext_t *ctx)
{
+#if defined(__powerpc__) && !defined(__powerpc64__)
+#if defined(__GLIBC__)
+ return (int) ctx->uc_mcontext.uc_regs->M_SYSCALL;
+#else
+ return (int) ctx->uc_regs->M_SYSCALL;
+#endif
+#else
return (int) ctx->uc_mcontext.M_SYSCALL;
+#endif
}
#else
static const char *