Tue Apr 13 22:45:32 2021 UTC ()
Elide [NUM] in arguments for systrace, use the first address of the array
and cast to intptr_t instead.


(christos)
diff -r1.183 -r1.184 src/sys/kern/makesyscalls.sh

cvs diff -r1.183 -r1.184 src/sys/kern/makesyscalls.sh (expand / switch to unified diff)

--- src/sys/kern/makesyscalls.sh 2021/02/17 06:25:10 1.183
+++ src/sys/kern/makesyscalls.sh 2021/04/13 22:45:32 1.184
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: makesyscalls.sh,v 1.183 2021/02/17 06:25:10 rillig Exp $ 1# $NetBSD: makesyscalls.sh,v 1.184 2021/04/13 22:45:32 christos 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
@@ -795,47 +795,56 @@ function uncompattype(type) { @@ -795,47 +795,56 @@ function uncompattype(type) {
795 sub(var, uncompattypes[var], type) 795 sub(var, uncompattypes[var], type)
796 return type 796 return type
797 } 797 }
798 } 798 }
799 799
800 return type 800 return type
801} 801}
802 802
803function printrumpsysmap(syscall, wfn, funcalias, rumpentry) { 803function printrumpsysmap(syscall, wfn, funcalias, rumpentry) {
804 printf("%-4d %-22s %-18s %s\n", 804 printf("%-4d %-22s %-18s %s\n",
805 syscall, wfn, funcalias, rumpentry) > rumpsysmap 805 syscall, wfn, funcalias, rumpentry) > rumpsysmap
806} 806}
807 807
 808function fixarray(arg) {
 809 iii = index(arg, "[")
 810 if (iii == 0) {
 811 return arg
 812 } else {
 813 return substr(arg, 1, iii - 1)
 814 }
 815}
 816
808function putsystrace(type, compatwrap_) { 817function putsystrace(type, compatwrap_) {
809 printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace 818 printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace
810 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp 819 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp
811 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systraceret 820 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systraceret
812 if (argc > 0) { 821 if (argc > 0) {
813 printf("\t\tswitch(ndx) {\n") > systracetmp 822 printf("\t\tswitch(ndx) {\n") > systracetmp
814 printf("\t\tconst struct %s%s_args *p = params;\n", compatwrap_, funcname) > systrace 823 printf("\t\tconst struct %s%s_args *p = params;\n", compatwrap_, funcname) > systrace
815 for (i = 1; i <= argc; i++) { 824 for (i = 1; i <= argc; i++) {
816 arg = argtype[i] 825 arg = argtype[i]
817 sub("__restrict$", "", arg) 826 sub("__restrict$", "", arg)
818 printf("\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", i - 1, arg) > systracetmp 827 printf("\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", i - 1, arg) > systracetmp
819 if (arg ~ /.*p_t$/ || arg ~ /.*p$/ || arg ~ /.*_t_p$/ || 828 if (arg ~ /.*p_t$/ || arg ~ /.*p$/ || arg ~ /.*_t_p$/ ||
820 arg ~ /.*_pointer_t$/) 829 arg ~ /.*_pointer_t$/)
821 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s).i32; /* %s */\n", \ 830 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s).i32; /* %s */\n", \
822 i - 1, \ 831 i - 1, \
823 argname[i], arg) > systrace 832 argname[i], arg) > systrace
824 else if (index(arg, "*") > 0 || arg == "caddr_t" || 833 else if (index(arg, "*") > 0 || arg == "caddr_t" ||
825 arg ~ /.*_handler_t$/) 834 arg ~ /.*_handler_t$/ || index(argname[i], "[") > 0)
826 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s); /* %s */\n", \ 835 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s); /* %s */\n", \
827 i - 1, \ 836 i - 1, \
828 argname[i], arg) > systrace 837 fixarray(argname[i]), arg) > systrace
829 else if (substr(arg, 1, 1) == "u" || arg == "size_t") 838 else if (substr(arg, 1, 1) == "u" || arg == "size_t")
830 printf("\t\tuarg[%d] = SCARG(p, %s); /* %s */\n", \ 839 printf("\t\tuarg[%d] = SCARG(p, %s); /* %s */\n", \
831 i - 1, \ 840 i - 1, \
832 argname[i], arg) > systrace 841 argname[i], arg) > systrace
833 else 842 else
834 printf("\t\tiarg[%d] = SCARG(p, %s); /* %s */\n", \ 843 printf("\t\tiarg[%d] = SCARG(p, %s); /* %s */\n", \
835 i - 1, \ 844 i - 1, \
836 argname[i], arg) > systrace 845 argname[i], arg) > systrace
837 } 846 }
838 printf("\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") > systracetmp 847 printf("\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") > systracetmp
839 848
840 printf("\t\tif (ndx == 0 || ndx == 1)\n") > systraceret 849 printf("\t\tif (ndx == 0 || ndx == 1)\n") > systraceret
841 printf("\t\t\tp = \"%s\";\n", returntype) > systraceret 850 printf("\t\t\tp = \"%s\";\n", returntype) > systraceret