From 8150854b5dd030a47f601931daf827ca33bc9bd9 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Tue, 8 Jan 2019 19:52:21 +0200
Subject: [PATCH] Fix build for mips targets

Commit 917c2ccf3a67 ("Refactor stack pointers") removed
linux/mips/arch_regs.h that defines mips_REG_* macros and struct
mips_regs. These symbols are referenced in mips code. Restore
arch_regs.h to fix the build failure:

syscall.c: In function 'decode_syscall_subcall':
syscall.c:370:7: error: 'mips_REG_SP' undeclared (first use in this function)
       mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]),
	   ^~~~~~~~~~~

[ baruch: drop the Makefile.in hunk to avoid autoreconf ]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Upstream status:
https://lists.strace.io/pipermail/strace-devel/2019-January/008598.html

 linux/mips/arch_regs.c |  4 +---
 linux/mips/arch_regs.h | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 linux/mips/arch_regs.h

diff --git a/linux/mips/arch_regs.c b/linux/mips/arch_regs.c
index 0874e31efea4..3ed841ee7c1a 100644
--- a/linux/mips/arch_regs.c
+++ b/linux/mips/arch_regs.c
@@ -5,9 +5,7 @@
  * SPDX-License-Identifier: LGPL-2.1-or-later
  */
 
-static struct {
-	uint64_t uregs[38];
-} mips_regs;
+struct mips_regs mips_regs; /* not static */
 
 #define REG_V0 2
 #define REG_A0 4
diff --git a/linux/mips/arch_regs.h b/linux/mips/arch_regs.h
new file mode 100644
index 000000000000..6372badce646
--- /dev/null
+++ b/linux/mips/arch_regs.h
@@ -0,0 +1,18 @@
+struct mips_regs {
+	uint64_t uregs[38];
+};
+
+extern struct mips_regs mips_regs;
+
+#define REG_V0 2
+#define REG_A0 4
+
+#define mips_REG_V0 mips_regs.uregs[REG_V0]
+#define mips_REG_A0 mips_regs.uregs[REG_A0 + 0]
+#define mips_REG_A1 mips_regs.uregs[REG_A0 + 1]
+#define mips_REG_A2 mips_regs.uregs[REG_A0 + 2]
+#define mips_REG_A3 mips_regs.uregs[REG_A0 + 3]
+#define mips_REG_A4 mips_regs.uregs[REG_A0 + 4]
+#define mips_REG_A5 mips_regs.uregs[REG_A0 + 5]
+#define mips_REG_SP mips_regs.uregs[29]
+#define mips_REG_EPC mips_regs.uregs[34]
-- 
2.20.1

