aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2020-03-10 11:34:03 +0100
committerLaurent Vivier <laurent@vivier.eu>2020-03-20 16:02:00 +0100
commit5733333020649bf08ae523e8bac7c8e0db125d0c (patch)
tree8a000522b438469c394e87815be7686cae4f2802 /scripts
parentac5d3c670a7ce1ba8c695f99c0027a8e55355e50 (diff)
linux-user,mips: update syscall-args-o32.c.inc
Add a script to update the file from strace github and run it Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-22-laurent@vivier.eu> [lv: added file in MAINTAINERS] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-mips-syscall-args.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/update-mips-syscall-args.sh b/scripts/update-mips-syscall-args.sh
new file mode 100755
index 0000000000..4f0dda4b83
--- /dev/null
+++ b/scripts/update-mips-syscall-args.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+URL=https://raw.githubusercontent.com/strace/strace/master
+FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \
+ linux/mips/syscallent-o32.h linux/syscallent-common-32.h \
+ linux/syscallent-common.h"
+
+output="$1"
+if [ "$output" = "" ] ; then
+ output="$PWD"
+fi
+
+INC=linux-user/mips/syscall-args-o32.c.inc
+
+TMP=$(mktemp -d)
+cd $TMP
+
+for file in $FILES; do
+ curl -O $URL/$file
+done
+
+> subcall32.h
+
+cat > gen_mips_o32.c <<EOF
+#include <stdio.h>
+
+#define LINUX_MIPSO32
+#define MAX_ARGS 7
+
+#include "sysent.h"
+#include "sysent_shorthand_defs.h"
+
+#define SEN(syscall_name) 0,0
+const struct_sysent sysent0[] = {
+#include "syscallent-o32.h"
+};
+
+int main(void)
+{
+ int i;
+
+ for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) {
+ if (sysent0[i].sys_name == NULL) {
+ printf(" [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000);
+ } else {
+ printf(" [% 4d] = %d, /* %s */\n", i - 4000,
+ sysent0[i].nargs, sysent0[i].sys_name);
+ }
+ }
+
+ return 0;
+}
+EOF
+
+cc -o gen_mips_o32 gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC"
+
+rm -fr "$TMP"