| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: makesyscalls.sh,v 1.170 2018/08/10 21:44:59 pgoyette Exp $ | | 1 | # $NetBSD: makesyscalls.sh,v 1.171 2018/08/26 11:48:00 kre Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou | | 3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # 3. All advertising materials mentioning features or use of this software | | 14 | # 3. All advertising materials mentioning features or use of this software |
| @@ -68,26 +68,35 @@ sysautoload="/dev/null" | | | @@ -68,26 +68,35 @@ sysautoload="/dev/null" |
68 | rumpcalls="/dev/null" | | 68 | rumpcalls="/dev/null" |
69 | rumpcallshdr="/dev/null" | | 69 | rumpcallshdr="/dev/null" |
70 | rumpsysmap="/dev/null" | | 70 | rumpsysmap="/dev/null" |
71 | rumpsysent="rumpsysent.tmp" | | 71 | rumpsysent="rumpsysent.tmp" |
72 | rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS," | | 72 | rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS," |
73 | rumpnosys="(sy_call_t *)rumpns_enosys" | | 73 | rumpnosys="(sy_call_t *)rumpns_enosys" |
74 | rumpnomodule="(sy_call_t *)rumpns_sys_nomodule" | | 74 | rumpnomodule="(sy_call_t *)rumpns_sys_nomodule" |
75 | | | 75 | |
76 | case $1 in | | 76 | case $1 in |
77 | /*) . $1;; | | 77 | /*) . $1;; |
78 | *) . ./$1;; | | 78 | *) . ./$1;; |
79 | esac | | 79 | esac |
80 | | | 80 | |
| | | 81 | fail=false |
| | | 82 | case "${nsysent:-0}" in |
| | | 83 | *[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for nsysent";; |
| | | 84 | esac |
| | | 85 | case "${maxsysargs:-0}" in |
| | | 86 | *[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for maxsysargs";; |
| | | 87 | esac |
| | | 88 | $fail && exit 1 |
| | | 89 | |
81 | # tmp files: | | 90 | # tmp files: |
82 | sysdcl="sysent.dcl" | | 91 | sysdcl="sysent.dcl" |
83 | sysprotos="sys.protos" | | 92 | sysprotos="sys.protos" |
84 | syscompat_pref="sysent." | | 93 | syscompat_pref="sysent." |
85 | sysent="sysent.switch" | | 94 | sysent="sysent.switch" |
86 | sysnamesbottom="$sysnames.bottom" | | 95 | sysnamesbottom="$sysnames.bottom" |
87 | sysnamesfriendly="$sysnames.friendly" | | 96 | sysnamesfriendly="$sysnames.friendly" |
88 | rumptypes="rumphdr.types" | | 97 | rumptypes="rumphdr.types" |
89 | rumpprotos="rumphdr.protos" | | 98 | rumpprotos="rumphdr.protos" |
90 | systracetmp="systrace.$$" | | 99 | systracetmp="systrace.$$" |
91 | systraceret="systraceret.$$" | | 100 | systraceret="systraceret.$$" |
92 | | | 101 | |
93 | cleanup() { | | 102 | cleanup() { |
| @@ -162,37 +171,37 @@ BEGIN { | | | @@ -162,37 +171,37 @@ BEGIN { |
162 | rumpcalls = \"$rumpcalls\" | | 171 | rumpcalls = \"$rumpcalls\" |
163 | rumpcallshdr = \"$rumpcallshdr\" | | 172 | rumpcallshdr = \"$rumpcallshdr\" |
164 | rumpsysent = \"$rumpsysent\" | | 173 | rumpsysent = \"$rumpsysent\" |
165 | rumpsysmap = \"$rumpsysmap\" | | 174 | rumpsysmap = \"$rumpsysmap\" |
166 | switchname = \"$switchname\" | | 175 | switchname = \"$switchname\" |
167 | namesname = \"$namesname\" | | 176 | namesname = \"$namesname\" |
168 | constprefix = \"$constprefix\" | | 177 | constprefix = \"$constprefix\" |
169 | emulname = \"$emulname\" | | 178 | emulname = \"$emulname\" |
170 | registertype = \"$registertype\" | | 179 | registertype = \"$registertype\" |
171 | sysalign=\"$sysalign\" | | 180 | sysalign=\"$sysalign\" |
172 | if (!registertype) { | | 181 | if (!registertype) { |
173 | registertype = \"register_t\" | | 182 | registertype = \"register_t\" |
174 | } | | 183 | } |
175 | nsysent = \"$nsysent\" | | 184 | nsysent = ${nsysent:-0} |
176 | | | 185 | |
177 | sysdcl = \"$sysdcl\" | | 186 | sysdcl = \"$sysdcl\" |
178 | syscompat_pref = \"$syscompat_pref\" | | 187 | syscompat_pref = \"$syscompat_pref\" |
179 | sysent = \"$sysent\" | | 188 | sysent = \"$sysent\" |
180 | sysnamesbottom = \"${sysnames}.bottom\" | | 189 | sysnamesbottom = \"${sysnames}.bottom\" |
181 | sysnamesfriendly = \"${sysnames}.friendly\" | | 190 | sysnamesfriendly = \"${sysnames}.friendly\" |
182 | rumpprotos = \"$rumpprotos\" | | 191 | rumpprotos = \"$rumpprotos\" |
183 | rumptypes = \"$rumptypes\" | | 192 | rumptypes = \"$rumptypes\" |
184 | sys_nosys = \"$sys_nosys\" | | 193 | sys_nosys = \"$sys_nosys\" |
185 | maxsysargs = \"$maxsysargs\" | | 194 | maxsysargs = ${maxsysargs:-8} |
186 | rumpnoflags=\"$rumpnoflags\" | | 195 | rumpnoflags=\"$rumpnoflags\" |
187 | rumpnosys=\"$rumpnosys\" | | 196 | rumpnosys=\"$rumpnosys\" |
188 | rumpnomodule=\"$rumpnomodule\" | | 197 | rumpnomodule=\"$rumpnomodule\" |
189 | infile = \"$2\" | | 198 | infile = \"$2\" |
190 | | | 199 | |
191 | compatopts = \"$compatopts\" | | 200 | compatopts = \"$compatopts\" |
192 | "' | | 201 | "' |
193 | | | 202 | |
194 | if (rumpcalls != "/dev/null") | | 203 | if (rumpcalls != "/dev/null") |
195 | haverumpcalls = 1 | | 204 | haverumpcalls = 1 |
196 | | | 205 | |
197 | printf "/* %s */\n\n", tag > sysdcl | | 206 | printf "/* %s */\n\n", tag > sysdcl |
198 | printf "/*\n * System call switch table.\n *\n" > sysdcl | | 207 | printf "/*\n * System call switch table.\n *\n" > sysdcl |
| @@ -1120,32 +1129,26 @@ END { | | | @@ -1120,32 +1129,26 @@ END { |
1120 | } | | 1129 | } |
1121 | | | 1130 | |
1122 | # print default rump syscall interfaces | | 1131 | # print default rump syscall interfaces |
1123 | for (var in funcseen) { | | 1132 | for (var in funcseen) { |
1124 | printf("#ifndef RUMP_SYS_RENAME_%s\n", \ | | 1133 | printf("#ifndef RUMP_SYS_RENAME_%s\n", \ |
1125 | toupper(var)) > rumpcallshdr | | 1134 | toupper(var)) > rumpcallshdr |
1126 | printf("#define RUMP_SYS_RENAME_%s rump___sysimpl_%s\n", \ | | 1135 | printf("#define RUMP_SYS_RENAME_%s rump___sysimpl_%s\n", \ |
1127 | toupper(var), funcseen[var]) > rumpcallshdr | | 1136 | toupper(var), funcseen[var]) > rumpcallshdr |
1128 | printf("#endif\n\n") > rumpcallshdr | | 1137 | printf("#endif\n\n") > rumpcallshdr |
1129 | } | | 1138 | } |
1130 | | | 1139 | |
1131 | maxsyscall = syscall | | 1140 | maxsyscall = syscall |
1132 | | | 1141 | |
1133 | # XXX | | | |
1134 | # XXX The following comparisons with nsysent will produce | | | |
1135 | # XXX unexpected results if (for example) syscall has a | | | |
1136 | # XXX value of 900 and nsysent has a value of "1024". We | | | |
1137 | # XXX probably ought to make nsysent a numeric variable. | | | |
1138 | # XXX | | | |
1139 | if (nsysent) { | | 1142 | if (nsysent) { |
1140 | if (syscall > nsysent) { | | 1143 | if (syscall > nsysent) { |
1141 | printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent) | | 1144 | printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent) |
1142 | exit 1 | | 1145 | exit 1 |
1143 | } | | 1146 | } |
1144 | while (syscall < nsysent) { | | 1147 | while (syscall < nsysent) { |
1145 | print fillerpsysent(syscall, "", sys_nosys, "filler") > sysent | | 1148 | print fillerpsysent(syscall, "", sys_nosys, "filler") > sysent |
1146 | print fillerpsysent(syscall, rumpnoflags, rumpnosys, "filler") > rumpsysent | | 1149 | print fillerpsysent(syscall, rumpnoflags, rumpnosys, "filler") > rumpsysent |
1147 | printf("\t/* %3d */\t\"# filler\",\n", syscall) \ | | 1150 | printf("\t/* %3d */\t\"# filler\",\n", syscall) \ |
1148 | > sysnamesbottom | | 1151 | > sysnamesbottom |
1149 | printf("\t/* %3d */\tNULL, /* filler */\n", syscall) \ | | 1152 | printf("\t/* %3d */\tNULL, /* filler */\n", syscall) \ |
1150 | > sysnamesfriendly | | 1153 | > sysnamesfriendly |
1151 | syscall++ | | 1154 | syscall++ |