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

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