18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciin="$1" 58c2ecf20Sopenharmony_ciout="$2" 68c2ecf20Sopenharmony_cimy_abis=`echo "($3)" | tr ',' '|'` 78c2ecf20Sopenharmony_cimy_abi="$4" 88c2ecf20Sopenharmony_cioffset="$5" 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciemit() { 118c2ecf20Sopenharmony_ci t_nxt="$1" 128c2ecf20Sopenharmony_ci t_nr="$2" 138c2ecf20Sopenharmony_ci t_entry="$3" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci while [ $t_nxt -lt $t_nr ]; do 168c2ecf20Sopenharmony_ci printf "__SYSCALL(%s,sys_ni_syscall)\n" "${t_nxt}" 178c2ecf20Sopenharmony_ci t_nxt=$((t_nxt+1)) 188c2ecf20Sopenharmony_ci done 198c2ecf20Sopenharmony_ci printf "__SYSCALL(%s,%s)\n" "${t_nxt}" "${t_entry}" 208c2ecf20Sopenharmony_ci} 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cigrep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 238c2ecf20Sopenharmony_ci nxt=0 248c2ecf20Sopenharmony_ci if [ -z "$offset" ]; then 258c2ecf20Sopenharmony_ci offset=0 268c2ecf20Sopenharmony_ci fi 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci while read nr abi name entry compat ; do 298c2ecf20Sopenharmony_ci if [ "$my_abi" = "c32" ] && [ ! -z "$compat" ]; then 308c2ecf20Sopenharmony_ci emit $((nxt+offset)) $((nr+offset)) $compat 318c2ecf20Sopenharmony_ci else 328c2ecf20Sopenharmony_ci emit $((nxt+offset)) $((nr+offset)) $entry 338c2ecf20Sopenharmony_ci fi 348c2ecf20Sopenharmony_ci nxt=$((nr+1)) 358c2ecf20Sopenharmony_ci done 368c2ecf20Sopenharmony_ci) > "$out" 37