Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Laurent Vivier | e2dcdce | 2021-07-08 23:57:55 +0200 | [diff] [blame] | 3 | URL=https://raw.githubusercontent.com/strace/strace/master/src |
Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 4 | FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \ |
Laurent Vivier | e2dcdce | 2021-07-08 23:57:55 +0200 | [diff] [blame] | 5 | linux/mips/syscallent-o32.h linux/32/syscallent-common-32.h \ |
| 6 | linux/generic/syscallent-common.h" |
Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 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 |
Laurent Vivier | e2dcdce | 2021-07-08 23:57:55 +0200 | [diff] [blame] | 19 | curl --create-dirs $URL/$file -o $TMP/$file |
Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 20 | done |
| 21 | |
Laurent Vivier | e2dcdce | 2021-07-08 23:57:55 +0200 | [diff] [blame] | 22 | > linux/generic/subcallent.h |
| 23 | > linux/32/subcallent.h |
Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 24 | |
| 25 | cat > gen_mips_o32.c <<EOF |
| 26 | #include <stdio.h> |
| 27 | |
| 28 | #define LINUX_MIPSO32 |
| 29 | #define MAX_ARGS 7 |
| 30 | |
| 31 | #include "sysent.h" |
| 32 | #include "sysent_shorthand_defs.h" |
| 33 | |
| 34 | #define SEN(syscall_name) 0,0 |
| 35 | const struct_sysent sysent0[] = { |
| 36 | #include "syscallent-o32.h" |
| 37 | }; |
| 38 | |
| 39 | int main(void) |
| 40 | { |
| 41 | int i; |
| 42 | |
| 43 | for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) { |
| 44 | if (sysent0[i].sys_name == NULL) { |
| 45 | printf(" [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000); |
| 46 | } else { |
| 47 | printf(" [% 4d] = %d, /* %s */\n", i - 4000, |
| 48 | sysent0[i].nargs, sysent0[i].sys_name); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | EOF |
| 55 | |
Laurent Vivier | e2dcdce | 2021-07-08 23:57:55 +0200 | [diff] [blame] | 56 | cc -o gen_mips_o32 -I linux/mips -I linux/generic gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC" |
Laurent Vivier | 5733333 | 2020-03-10 11:34:03 +0100 | [diff] [blame] | 57 | |
| 58 | rm -fr "$TMP" |