Initial Spring 2016 commit.
This commit is contained in:
25
userland/lib/libc/syscalls/gensyscalls.sh
Executable file
25
userland/lib/libc/syscalls/gensyscalls.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# gensyscalls.sh
|
||||
# Usage: ./gensyscalls.sh < syscalls.h
|
||||
#
|
||||
# Parses the kernel's syscalls.h into the body of syscalls.S
|
||||
#
|
||||
|
||||
# tabs to spaces, just in case
|
||||
tr '\t' ' ' |\
|
||||
awk '
|
||||
# Do not read the parts of the file that are not between the markers.
|
||||
/^\/\*CALLBEGIN\*\// { look=1; }
|
||||
/^\/\*CALLEND\*\// { look=0; }
|
||||
|
||||
# And, do not read lines that do not match the approximate right pattern.
|
||||
look && /^#define SYS_/ && NF==3 {
|
||||
sub("^SYS_", "", $2);
|
||||
# print the name of the call and the number.
|
||||
print $2, $3;
|
||||
}
|
||||
' | awk '{
|
||||
# output something simple that will work in syscalls.S.
|
||||
printf "SYSCALL(%s, %s)\n", $1, $2;
|
||||
}'
|
Reference in New Issue
Block a user