Blame SOURCES/ltrace-0.7.91-s390-fetch-syscall.patch

263585
@@ -, +, @@ 
263585
   exe->mount("source", "target", "filesystemtype", 0, nil <unfinished ...>
263585
   mount@SYS("", "target", "filesystemtype", 0, nil)                 = -2
263585
   <... mount resumed>                                               = -1
263585
---
263585
 sysdeps/linux-gnu/s390/fetch.c |   17 ++++++++++++-----
263585
 1 files changed, 12 insertions(+), 5 deletions(-)
263585
--- a/sysdeps/linux-gnu/s390/fetch.c	
263585
+++ a/sysdeps/linux-gnu/s390/fetch.c	
263585
@@ -23,6 +23,7 @@ 
263585
 #include <sys/ucontext.h>
263585
 #include <assert.h>
263585
 #include <errno.h>
263585
+#include <stdbool.h>
263585
 #include <stdio.h>
263585
 #include <stdlib.h>
263585
 #include <string.h>
263585
@@ -61,7 +62,8 @@ s390x(struct fetch_context *ctx)
263585
 }
263585
 
263585
 static int
263585
-fetch_register_banks(struct process *proc, struct fetch_context *ctx)
263585
+fetch_register_banks(struct process *proc, struct fetch_context *ctx,
263585
+		     bool syscall_enter)
263585
 {
263585
 	ptrace_area parea;
263585
 	parea.len = sizeof(ctx->regs);
263585
@@ -72,15 +74,20 @@ fetch_register_banks(struct process *proc, struct fetch_context *ctx)
263585
 			strerror(errno));
263585
 		return -1;
263585
 	}
263585
+
263585
+	if (syscall_enter)
263585
+		ctx->regs.gprs[2] = ctx->regs.orig_gpr2;
263585
+
263585
 	return 0;
263585
 }
263585
 
263585
 static int
263585
-fetch_context_init(struct process *proc, struct fetch_context *context)
263585
+fetch_context_init(struct process *proc, struct fetch_context *context,
263585
+		   bool syscall_enter)
263585
 {
263585
 	context->greg = 2;
263585
 	context->freg = 0;
263585
-	return fetch_register_banks(proc, context);
263585
+	return fetch_register_banks(proc, context, syscall_enter);
263585
 }
263585
 
263585
 struct fetch_context *
263585
@@ -89,7 +96,7 @@ arch_fetch_arg_init(enum tof type, struct process *proc,
263585
 {
263585
 	struct fetch_context *context = malloc(sizeof(*context));
263585
 	if (context == NULL
263585
-	    || fetch_context_init(proc, context) < 0) {
263585
+	    || fetch_context_init(proc, context, type == LT_TOF_SYSCALL) < 0) {
263585
 		fprintf(stderr, "arch_fetch_arg_init: %s\n",
263585
 			strerror(errno));
263585
 		free(context);
263585
@@ -277,7 +284,7 @@ arch_fetch_retval(struct fetch_context *ctx, enum tof type,
263585
 		return 0;
263585
 	}
263585
 
263585
-	if (fetch_context_init(proc, ctx) < 0)
263585
+	if (fetch_context_init(proc, ctx, false) < 0)
263585
 		return -1;
263585
 	return arch_fetch_arg_next(ctx, type, proc, info, valuep);
263585
 }
263585
--