mksyscalltbl 782 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Generate system call table for perf. Derived from
  5. # s390 script.
  6. #
  7. # Copyright IBM Corp. 2017
  8. # Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
  9. # Changed by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
  10. wordsize=$1
  11. gcc=$2
  12. input=$3
  13. if ! test -r $input; then
  14. echo "Could not read input file" >&2
  15. exit 1
  16. fi
  17. create_table()
  18. {
  19. local wordsize=$1
  20. local max_nr
  21. echo "static const char *syscalltbl_powerpc_${wordsize}[] = {"
  22. while read sc nr; do
  23. printf '\t[%d] = "%s",\n' $nr $sc
  24. max_nr=$nr
  25. done
  26. echo '};'
  27. echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"
  28. }
  29. $gcc -m${wordsize} -E -dM -x c $input \
  30. |sed -ne 's/^#define __NR_//p' \
  31. |sort -t' ' -k2 -nu \
  32. |create_table ${wordsize}