1*c52e4059SLaurent Vivier#!/bin/sh 2*c52e4059SLaurent Vivier# SPDX-License-Identifier: GPL-2.0 3*c52e4059SLaurent Vivier 4*c52e4059SLaurent Vivierin="$1" 5*c52e4059SLaurent Vivierout="$2" 6*c52e4059SLaurent Viviermy_abis=`echo "($3)" | tr ',' '|'` 7*c52e4059SLaurent Vivierprefix="$4" 8*c52e4059SLaurent Vivieroffset="$5" 9*c52e4059SLaurent Vivier 10*c52e4059SLaurent Vivierfileguard=LINUX_USER_LOONGARCH64_`basename "$out" | sed \ 11*c52e4059SLaurent Vivier -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ 12*c52e4059SLaurent Vivier -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` 13*c52e4059SLaurent Viviergrep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 14*c52e4059SLaurent Vivier echo "#ifndef ${fileguard}" 15*c52e4059SLaurent Vivier echo "#define ${fileguard} 1" 16*c52e4059SLaurent Vivier echo "" 17*c52e4059SLaurent Vivier 18*c52e4059SLaurent Vivier while read nr abi name entry compat ; do 19*c52e4059SLaurent Vivier if [ -z "$offset" ]; then 20*c52e4059SLaurent Vivier echo "#define TARGET_NR_${prefix}${name} $nr" 21*c52e4059SLaurent Vivier else 22*c52e4059SLaurent Vivier echo "#define TARGET_NR_${prefix}${name} ($offset + $nr)" 23*c52e4059SLaurent Vivier fi 24*c52e4059SLaurent Vivier done 25*c52e4059SLaurent Vivier 26*c52e4059SLaurent Vivier echo "" 27*c52e4059SLaurent Vivier echo "#endif /* ${fileguard} */" 28*c52e4059SLaurent Vivier) > "$out" 29