mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
windows: use SyscallN in mkwinsyscall
The mkwinsyscall command has a hard limit of 15 on the number of syscall arguments. Windows has several system calls with more than 15 arguments, for example CreateFontPackage has 18 arguments. If the number of arguments is higher than 15 we use SyscallN. Fixes golang/go#57914 Change-Id: I4205e779a960ae10c0778de7876154e0d7ec00a1 GitHub-Last-Rev: 1f1e96fab7327f803f8213ca4264d359046971cd GitHub-Pull-Request: golang/sys#171 Reviewed-on: https://go-review.googlesource.com/c/sys/+/518995 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
committed by
Gopher Robot
parent
70233675ae
commit
ad02017442
@@ -57,7 +57,6 @@ import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -568,6 +567,8 @@ func (f *Fn) SyscallParamCount() int {
|
||||
return 12
|
||||
case n <= 15:
|
||||
return 15
|
||||
case n <= 42: // current SyscallN limit
|
||||
return n
|
||||
default:
|
||||
panic("too many arguments to system call")
|
||||
}
|
||||
@@ -579,6 +580,9 @@ func (f *Fn) Syscall() string {
|
||||
if c == 3 {
|
||||
return syscalldot() + "Syscall"
|
||||
}
|
||||
if c > 15 {
|
||||
return syscalldot() + "SyscallN"
|
||||
}
|
||||
return syscalldot() + "Syscall" + strconv.Itoa(c)
|
||||
}
|
||||
|
||||
@@ -923,7 +927,7 @@ func main() {
|
||||
if *filename == "" {
|
||||
_, err = os.Stdout.Write(data)
|
||||
} else {
|
||||
err = ioutil.WriteFile(*filename, data, 0644)
|
||||
err = os.WriteFile(*filename, data, 0644)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -1011,7 +1015,7 @@ func {{.HelperName}}({{.HelperParamList}}) {{template "results" .}}{
|
||||
|
||||
{{define "results"}}{{if .Rets.List}}{{.Rets.List}} {{end}}{{end}}
|
||||
|
||||
{{define "syscall"}}{{.Rets.SetReturnValuesCode}}{{.Syscall}}(proc{{.DLLFuncName}}.Addr(), {{.ParamCount}}, {{.SyscallParamList}}){{end}}
|
||||
{{define "syscall"}}{{.Rets.SetReturnValuesCode}}{{.Syscall}}(proc{{.DLLFuncName}}.Addr(),{{if le .ParamCount 15}} {{.ParamCount}},{{end}} {{.SyscallParamList}}){{end}}
|
||||
|
||||
{{define "tmpvarsreadback"}}{{range .Params}}{{if .TmpVarReadbackCode}}
|
||||
{{.TmpVarReadbackCode}}{{end}}{{end}}{{end}}
|
||||
|
||||
Reference in New Issue
Block a user