182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
# we wish to import; we use sed to transform this into a form
# that cpp will fill out for us, producing a table that the
# awk scripts can handle and turn into a list of constants.
echo '#include <sys/syscall.h>' > $gen/system_calls.t.1 # this is the magic part
cat arch/posix/syscalls > $gen/system_calls.t.2
sed -e 's;^\(.*\)$;\1 SYS_\1;' -i $gen/system_calls.t.2
cat $gen/system_calls.t.1 $gen/system_calls.t.2 | cpp -P >$gen/system_calls.tbl
else
case $os in
# lin) grep -h "#define __NR_" $p_headers_syscall | sed 's;^#define __NR_;;' > $gen/system_calls.tbl;;
# fbsd) grep -h "#define SYS_" $p_headers_syscall | sed 's;^#define SYS_;;' | sed 's;[\t ]\+; ;' > $gen/system_calls.tbl;;
*) noimpl 'system call table generation';;
esac
fi
# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P |
awk -f arch/syscall.awk -v out=s <$gen/system_calls.tbl>$gen/system_calls.s
# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P |
awk -f arch/syscall.awk -v out=h <$gen/system_calls.tbl>$gen/system_calls.h
# generate errno tables
grep -h "#[ ]*define[ ]\+E" $p_headers_errno |
sed 's;^#[\t ]*define[\t ]\+\(E[A-Z0-9]\+\).*$;k_platform_error_\1 \1;' >\
$gen/error_names.tbl
cat $p_headers_errno $gen/error_names.tbl | cpp -P >$gen/error_numbers.tbl
awk -f arch/errtbl.awk <$gen/error_numbers.tbl >$gen/error_table.h
# generate symbol tables for error handling functions
mkdir -p "$to/k"
awk -f global/gen-conds.awk <global/modules >$to/k/internal.egroup.h
awk -f global/gen-ident.awk <global/modules >$gen/internal.ident.c
comp_co $gen/internal.ident.c $to/internal.ident.o
|
>
>
>
>
>
>
<
<
<
>
>
>
<
<
|
<
<
<
|
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
# we wish to import; we use sed to transform this into a form
# that cpp will fill out for us, producing a table that the
# awk scripts can handle and turn into a list of constants.
echo '#include <sys/syscall.h>' > $gen/system_calls.t.1 # this is the magic part
cat arch/posix/syscalls > $gen/system_calls.t.2
sed -e 's;^\(.*\)$;\1 SYS_\1;' -i $gen/system_calls.t.2
cat $gen/system_calls.t.1 $gen/system_calls.t.2 | cpp -P >$gen/system_calls.tbl
# generate errno tables the same way
echo '#include <errno.h>' > $gen/error_codes.t.1 # this is the magic part
cat arch/posix/errnos > $gen/error_codes.t.2
sed -e 's;^\(.*\)$;k_platform_error_\1 \1;' -i $gen/error_codes.t.2
cat $gen/error_codes.t.1 $gen/error_codes.t.2 | cpp -P | grep "^k_platform_error" >$gen/error_codes.tbl # haaaack
else
case $os in
*) noimpl 'system call table generation';;
esac
fi
# take the OS-specific system call tables that have been prepared
# for us above and feed them into awk scripts to generate C headers
awk -f arch/syscall.awk -v out=s <$gen/system_calls.tbl>$gen/system_calls.s
awk -f arch/syscall.awk -v out=h <$gen/system_calls.tbl>$gen/system_calls.h
# do the same with our error codes table
awk -f arch/errtbl.awk <$gen/error_codes.tbl >$gen/error_table.h
# generate symbol tables for error handling functions
mkdir -p "$to/k"
awk -f global/gen-conds.awk <global/modules >$to/k/internal.egroup.h
awk -f global/gen-ident.awk <global/modules >$gen/internal.ident.c
comp_co $gen/internal.ident.c $to/internal.ident.o
|