update-mips-syscall-args.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. URL=https://raw.githubusercontent.com/strace/strace/master
  3. FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \
  4. linux/mips/syscallent-o32.h linux/syscallent-common-32.h \
  5. linux/syscallent-common.h"
  6. output="$1"
  7. if [ "$output" = "" ] ; then
  8. output="$PWD"
  9. fi
  10. INC=linux-user/mips/syscall-args-o32.c.inc
  11. TMP=$(mktemp -d)
  12. cd $TMP
  13. for file in $FILES; do
  14. curl -O $URL/$file
  15. done
  16. > subcall32.h
  17. cat > gen_mips_o32.c <<EOF
  18. #include <stdio.h>
  19. #define LINUX_MIPSO32
  20. #define MAX_ARGS 7
  21. #include "sysent.h"
  22. #include "sysent_shorthand_defs.h"
  23. #define SEN(syscall_name) 0,0
  24. const struct_sysent sysent0[] = {
  25. #include "syscallent-o32.h"
  26. };
  27. int main(void)
  28. {
  29. int i;
  30. for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) {
  31. if (sysent0[i].sys_name == NULL) {
  32. printf(" [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000);
  33. } else {
  34. printf(" [% 4d] = %d, /* %s */\n", i - 4000,
  35. sysent0[i].nargs, sysent0[i].sys_name);
  36. }
  37. }
  38. return 0;
  39. }
  40. EOF
  41. cc -o gen_mips_o32 gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC"
  42. rm -fr "$TMP"