brintos

brintos / linux-shallow public Read only

0
0
Text · 882 B · c10ad35 Raw
46 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03#4# Generate system call table for perf. Derived from5# powerpc script.6#7# Author(s):  Ming Wang <wangming01@loongson.cn>8# Author(s):  Huacai Chen <chenhuacai@loongson.cn>9# Copyright (C) 2020-2023 Loongson Technology Corporation Limited10 11gcc=$112hostcc=$213incpath=$314input=$415 16if ! test -r $input; then17	echo "Could not read input file" >&218	exit 119fi20 21create_sc_table()22{23	local sc nr max_nr24 25	while read sc nr; do26		printf "%s\n" "	[$nr] = \"$sc\","27		max_nr=$nr28	done29 30	echo "#define SYSCALLTBL_LOONGARCH_MAX_ID $max_nr"31}32 33create_table()34{35	echo "#include \"$input\""36	echo "static const char *const syscalltbl_loongarch[] = {"37	create_sc_table38	echo "};"39}40 41$gcc -E -dM -x c -I $incpath/include/uapi $input \42	|awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {43		sub("^#define __NR(3264)?_", "");44		print | "sort -k2 -n"}' \45	|create_table46