.. | .. |
---|
9 | 9 | # Changed by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> |
---|
10 | 10 | |
---|
11 | 11 | wordsize=$1 |
---|
12 | | -gcc=$2 |
---|
13 | | -input=$3 |
---|
| 12 | +SYSCALL_TBL=$2 |
---|
14 | 13 | |
---|
15 | | -if ! test -r $input; then |
---|
| 14 | +if ! test -r $SYSCALL_TBL; then |
---|
16 | 15 | echo "Could not read input file" >&2 |
---|
17 | 16 | exit 1 |
---|
18 | 17 | fi |
---|
.. | .. |
---|
20 | 19 | create_table() |
---|
21 | 20 | { |
---|
22 | 21 | local wordsize=$1 |
---|
23 | | - local max_nr |
---|
| 22 | + local max_nr nr abi sc discard |
---|
| 23 | + max_nr=-1 |
---|
| 24 | + nr=0 |
---|
24 | 25 | |
---|
25 | 26 | echo "static const char *syscalltbl_powerpc_${wordsize}[] = {" |
---|
26 | | - while read sc nr; do |
---|
27 | | - printf '\t[%d] = "%s",\n' $nr $sc |
---|
28 | | - max_nr=$nr |
---|
| 27 | + while read nr abi sc discard; do |
---|
| 28 | + if [ "$max_nr" -lt "$nr" ]; then |
---|
| 29 | + printf '\t[%d] = "%s",\n' $nr $sc |
---|
| 30 | + max_nr=$nr |
---|
| 31 | + fi |
---|
29 | 32 | done |
---|
30 | 33 | echo '};' |
---|
31 | 34 | echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr" |
---|
32 | 35 | } |
---|
33 | 36 | |
---|
34 | | -$gcc -m${wordsize} -E -dM -x c $input \ |
---|
35 | | - |sed -ne 's/^#define __NR_//p' \ |
---|
36 | | - |sort -t' ' -k2 -nu \ |
---|
| 37 | +grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \ |
---|
| 38 | + |sort -k1 -n \ |
---|
37 | 39 | |create_table ${wordsize} |
---|