target/ppc: cpu_init: Decouple G2 SPR registration from 755
[qemu/rayw.git] / linux-user / ppc / syscallhdr.sh
blob6c44e0eaad207e4d99e0a59168032a69613859f3
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
4 in="$1"
5 out="$2"
6 my_abis=`echo "($3)" | tr ',' '|'`
7 prefix="$4"
8 offset="$5"
10 fileguard=LINUX_USER_PPC_`basename "$out" | sed \
11 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
12 -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
13 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
14 printf "#ifndef %s\n" "${fileguard}"
15 printf "#define %s\n" "${fileguard}"
16 printf "\n"
18 while read nr abi name entry compat ; do
19 if [ "$entry" = "sys_ni_syscall" ] ; then
20 continue
22 if [ -z "$offset" ]; then
23 printf "#define TARGET_NR_%s%s\t%s\n" \
24 "${prefix}" "${name}" "${nr}"
25 else
26 printf "#define TARGET_NR_%s%s\t(%s + %s)\n" \
27 "${prefix}" "${name}" "${offset}" "${nr}"
29 done
31 printf "\n"
32 printf "#endif /* %s */" "${fileguard}"
33 printf "\n"
34 ) > "$out"