]> Git Repo - qemu.git/blob - scripts/update-mips-syscall-args.sh
qmp: Move dispatcher to a coroutine
[qemu.git] / scripts / update-mips-syscall-args.sh
1 #!/bin/sh
2
3 URL=https://raw.githubusercontent.com/strace/strace/master
4 FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \
5        linux/mips/syscallent-o32.h linux/syscallent-common-32.h \
6        linux/syscallent-common.h"
7
8 output="$1"
9 if [ "$output" = "" ] ; then
10     output="$PWD"
11 fi
12
13 INC=linux-user/mips/syscall-args-o32.c.inc
14
15 TMP=$(mktemp -d)
16 cd $TMP
17
18 for file in $FILES; do
19     curl -O $URL/$file
20 done
21
22 > subcall32.h
23
24 cat > gen_mips_o32.c <<EOF
25 #include <stdio.h>
26
27 #define LINUX_MIPSO32
28 #define MAX_ARGS 7
29
30 #include "sysent.h"
31 #include "sysent_shorthand_defs.h"
32
33 #define SEN(syscall_name) 0,0
34 const struct_sysent sysent0[] = {
35 #include  "syscallent-o32.h"
36 };
37
38 int main(void)
39 {
40     int i;
41
42     for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) {
43         if (sysent0[i].sys_name == NULL) {
44             printf("    [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000);
45         } else {
46             printf("    [% 4d] = %d, /* %s */\n", i - 4000,
47                    sysent0[i].nargs, sysent0[i].sys_name);
48         }
49     }
50
51     return 0;
52 }
53 EOF
54
55 cc -o gen_mips_o32 gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC"
56
57 rm -fr "$TMP"
This page took 0.029112 seconds and 4 git commands to generate.