1d9fd5a71STiezhu Yang#!/bin/sh 2d9fd5a71STiezhu Yang# SPDX-License-Identifier: GPL-2.0 3d9fd5a71STiezhu Yang# 4d9fd5a71STiezhu Yang# Generate system call table for perf. Derived from 5d9fd5a71STiezhu Yang# s390 script. 6d9fd5a71STiezhu Yang# 7d9fd5a71STiezhu Yang# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> 8d9fd5a71STiezhu Yang# Changed by: Tiezhu Yang <yangtiezhu@loongson.cn> 9d9fd5a71STiezhu Yang 10d9fd5a71STiezhu YangSYSCALL_TBL=$1 11d9fd5a71STiezhu Yang 12d9fd5a71STiezhu Yangif ! test -r $SYSCALL_TBL; then 13d9fd5a71STiezhu Yang echo "Could not read input file" >&2 14d9fd5a71STiezhu Yang exit 1 15d9fd5a71STiezhu Yangfi 16d9fd5a71STiezhu Yang 17d9fd5a71STiezhu Yangcreate_table() 18d9fd5a71STiezhu Yang{ 19d9fd5a71STiezhu Yang local max_nr nr abi sc discard 20d9fd5a71STiezhu Yang 21*49f3806dSTiezhu Yang echo 'static const char *const syscalltbl_mips_n64[] = {' 22d9fd5a71STiezhu Yang while read nr abi sc discard; do 23d9fd5a71STiezhu Yang printf '\t[%d] = "%s",\n' $nr $sc 24d9fd5a71STiezhu Yang max_nr=$nr 25d9fd5a71STiezhu Yang done 26d9fd5a71STiezhu Yang echo '};' 27d9fd5a71STiezhu Yang echo "#define SYSCALLTBL_MIPS_N64_MAX_ID $max_nr" 28d9fd5a71STiezhu Yang} 29d9fd5a71STiezhu Yang 30d9fd5a71STiezhu Yanggrep -E "^[[:digit:]]+[[:space:]]+(n64)" $SYSCALL_TBL \ 31d9fd5a71STiezhu Yang |sort -k1 -n \ 32d9fd5a71STiezhu Yang |create_table 33