From 84e9ab398438bc728683ca68485c6e89526b0441 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Thu, 11 Sep 2025 13:40:24 -0400 Subject: cmd/go/internal/work: remove deps[1]="fmt" vet hack The Builder.vet operation has not needed an artificial dependency on the fmt package since CL 176439 in 2019. Remove it now. Change-Id: I398a6d2d57175c12843520d9f19ffd023e676123 Reviewed-on: https://go-review.googlesource.com/c/go/+/702856 Auto-Submit: Alan Donovan Reviewed-by: Michael Matloob Reviewed-by: Michael Matloob LUCI-TryBot-Result: Go LUCI --- src/cmd/go/internal/work/action.go | 18 ++++-------------- src/cmd/go/internal/work/exec.go | 1 - 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go index 2030f8cb04..bbd2245844 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go @@ -716,25 +716,15 @@ func (b *Builder) vetAction(mode, depMode BuildMode, p *load.Package) *Action { a := b.cacheAction("vet", p, func() *Action { a1 := b.CompileAction(mode|ModeVetOnly, depMode, p) - // vet expects to be able to import "fmt". - var stk load.ImportStack - stk.Push(load.NewImportInfo("vet", nil)) - p1, err := load.LoadImportWithFlags("fmt", p.Dir, p, &stk, nil, 0) - if err != nil { - base.Fatalf("unexpected error loading fmt package from package %s: %v", p.ImportPath, err) - } - stk.Pop() - aFmt := b.CompileAction(ModeBuild, depMode, p1) - var deps []*Action if a1.buggyInstall { - // (*Builder).vet expects deps[0] to be the package - // and deps[1] to be "fmt". If we see buggyInstall + // (*Builder).vet expects deps[0] to be the package. + // If we see buggyInstall // here then a1 is an install of a shared library, // and the real package is a1.Deps[0]. - deps = []*Action{a1.Deps[0], aFmt, a1} + deps = []*Action{a1.Deps[0], a1} } else { - deps = []*Action{a1, aFmt} + deps = []*Action{a1} } for _, p1 := range p.Internal.Imports { deps = append(deps, b.vetAction(mode, depMode, p1)) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index a49268cba2..6e3ad00e05 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1306,7 +1306,6 @@ var VetExplicit bool func (b *Builder) vet(ctx context.Context, a *Action) error { // a.Deps[0] is the build of the package being vetted. - // a.Deps[1] is the build of the "fmt" package. a.Failed = nil // vet of dependency may have failed but we can still succeed -- cgit v1.3-5-g45d5 From 73676e322396f6d49b4328456023233a2fe5693e Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Fri, 8 Aug 2025 17:35:43 -0400 Subject: cmd/go: run cgo and cgo compiles in their own actions This change splits package builds further into even more actions. Between the cache action (and cover action, if present) and the actual build action we insert three layers of actions: Check Cache Action | | | V | Run Cover Action (if cover requested) | | | V New Layer 1 | Run Cgo Action (if package is built with cgo) | | | | (multiple arrows representing fan-out to | V V V multiple actions) New Layer 2 | gcc Compile Action for each C/C++/S/F/M file (if cgo) | |/ (arrow represeting fan-in to single action) | V New Layer 3 | Cgo collect action (if cgo) | | \ V Build action The first run cgo action takes the input source files and runs cgo on them to produce the cgo-processed go files, which are given to the compiler, and to produce additional C files to compile and headers to use in the following compilations. The action also takes care of running SWIG before running cgo if there are swig files. This will produce additional cgo sources that are inputs to cgo. The run cgo action action fans out to multiple actions to do each of the C/C++/Obj-C/assembly/Fortran compilations for the non-Go files in the package, as well as those produced as outputs by the cgo command invocation. These actions then join into a single noop "collect" action which primarily exists so that we don't pollute the build action's dependencies with a bunch of non-go compile actions. (The build action expects its dependencies to mostly be other build actions). All of this work in the new actions was previously being done in the build action itself. There's still a remnant of the original cgo logic left in the build action to run the cgo command with -dynimport to produce a go file to be built with the rest of the package, and do some checks. Most of this CL consists of moving code around. Just like the previous CL breaking out the coverage logic into a separate action, we don't cache the outputs of the cgo actions, and just treat all the actions used to build a single package as one cacheable unit. This makes things a bit simpler. If we decide in a future CL to cache the outputs separately, we could remove the dependency on the cover action on the check cache action (which in turn depends on all the package's dependencies) and could start non-go compilation pretty much as early as we want in the build. The 'cgoAction' function in action.go takes care of creating the layers of cgo action dependencies, which are inserted as dependencies of the build action. It's mostly straightforward, except for the fact that we need to tell each non-go compile action which non-go file to compile, so we need to compute the names of the generated files. (Alternatively we could give each action a number and have it build the nth file produced by the run cgo action, but that seems even more complicated). The actors produced to run the action logic are pretty light wrappers around the execution logic in exec.go. In the 'build' function in exec.go, most of the new code mainly checks for the information from the cgo actions to use instead of running it, and then passes it to the processCgoOutputs function. The only other weird thing in the build functian is that we we call the logic to compute the nonGoOverlay separately just for the C files that are being built with gccgo. We compute the overlay for the non-go files used in a cgo build in the run cgo action. The 'cgo' function that previously ran the cgo logic for the build has now been split into three: the first half, which runs cgo is now in the runCgo function, the center part, which compiles the non-go files is now partly in creating the invididual non-go compile actions, as well as the cgoCompileActor's Act function. And the final part, which runs cgo -dynimport is now in processCgoOutputs. These parts communicate with each other through the providers that are set on the cgo actions. One further improvement we can make to this change in the future is to compile the dynimport file separately from the build action: its output is only needed by the linker. This would remove any dependencies from dependent packages' build actions on the cgo compile actions, allowing more flexibility for scheduling actions. Fixes #9887 Change-Id: Ie3c70bbf985148ba73094cddfc78c39dc6faad6e Reviewed-on: https://go-review.googlesource.com/c/go/+/694475 Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- src/cmd/go/internal/work/action.go | 161 ++++++++++++++ src/cmd/go/internal/work/exec.go | 442 +++++++++++++++++++++---------------- 2 files changed, 409 insertions(+), 194 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go index bbd2245844..3636f642e2 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go @@ -19,6 +19,7 @@ import ( "internal/platform" "os" "path/filepath" + "slices" "strings" "sync" "time" @@ -578,6 +579,47 @@ func (ca *coverActor) Act(b *Builder, ctx context.Context, a *Action) error { return nil } +// runCgoActor implements the Actor interface for running the cgo command for the package. +type runCgoActor struct { +} + +func (c runCgoActor) Act(b *Builder, ctx context.Context, a *Action) error { + var cacheProvider *checkCacheProvider + for _, a1 := range a.Deps { + if pr, ok := a1.Provider.(*checkCacheProvider); ok { + cacheProvider = pr + break + } + } + need := cacheProvider.need + need &^= needCovMetaFile // handled by cover action + if need == 0 { + return nil + } + return b.runCgo(ctx, a) +} + +type cgoCompileActor struct { + file string + + compileFunc func(*Action, string, string, []string, string) error + getFlagsFunc func(*runCgoProvider) []string + + flags *[]string +} + +func (c cgoCompileActor) Act(b *Builder, ctx context.Context, a *Action) error { + pr, ok := a.Deps[0].Provider.(*runCgoProvider) + if !ok { + return nil // cgo was not needed. do nothing. + } + a.nonGoOverlay = pr.nonGoOverlay + buildAction := a.triggers[0].triggers[0] // cgo compile -> cgo collect -> build + + a.actionID = cache.Subkey(buildAction.actionID, "cgo compile "+c.file) // buildAction's action id was computed by the check cache action. + return c.compileFunc(a, a.Objdir, a.Target, c.getFlagsFunc(pr), c.file) +} + // CompileAction returns the action for compiling and possibly installing // (according to mode) the given package. The resulting action is only // for building packages (archives), never for linking executables. @@ -677,6 +719,17 @@ func (b *Builder) CompileAction(mode, depMode BuildMode, p *load.Package) *Actio a.Deps = append(a.Deps, coverAction) } + // Create actions to run swig and cgo if needed. These actions always run in the + // same go build invocation as the build action and their actions are not cached + // separately, so they can use the same objdir. + if p.UsesCgo() || p.UsesSwig() { + deps := []*Action{cacheAction} + if coverAction != nil { + deps = append(deps, coverAction) + } + a.Deps = append(a.Deps, b.cgoAction(p, a.Objdir, deps, coverAction != nil)) + } + return a }) @@ -701,6 +754,114 @@ func (b *Builder) CompileAction(mode, depMode BuildMode, p *load.Package) *Actio return a } +func (b *Builder) cgoAction(p *load.Package, objdir string, deps []*Action, hasCover bool) *Action { + cgoCollectAction := b.cacheAction("cgo collect", p, func() *Action { + // Run cgo + runCgo := b.cacheAction("cgo run", p, func() *Action { + return &Action{ + Package: p, + Mode: "cgo run", + Actor: &runCgoActor{}, + Objdir: objdir, + Deps: deps, + } + }) + + // Determine which files swig will produce in the cgo run action. We'll need to create + // actions to compile the C and C++ files produced by swig, as well as the C file + // produced by cgo processing swig's Go file outputs. + swigGo, swigC, swigCXX := b.swigOutputs(p, objdir) + + oseq := 0 + nextOfile := func() string { + oseq++ + return objdir + fmt.Sprintf("_x%03d.o", oseq) + } + compileAction := func(file string, getFlagsFunc func(*runCgoProvider) []string, compileFunc func(*Action, string, string, []string, string) error) *Action { + mode := "cgo compile " + file + return b.cacheAction(mode, p, func() *Action { + return &Action{ + Package: p, + Mode: mode, + Actor: &cgoCompileActor{file: file, getFlagsFunc: getFlagsFunc, compileFunc: compileFunc}, + Deps: []*Action{runCgo}, + Objdir: objdir, + Target: nextOfile(), + } + }) + } + + var collectDeps []*Action + + // Add compile actions for C files generated by cgo. + cgoFiles := p.CgoFiles + if hasCover { + cgoFiles = slices.Clone(cgoFiles) + for i := range cgoFiles { + cgoFiles[i] = strings.TrimSuffix(cgoFiles[i], ".go") + ".cover.go" + } + } + cfiles := []string{"_cgo_export.c"} + for _, fn := range slices.Concat(cgoFiles, swigGo) { + cfiles = append(cfiles, strings.TrimSuffix(filepath.Base(fn), ".go")+".cgo2.c") + } + for _, f := range cfiles { + collectDeps = append(collectDeps, compileAction(objdir+f, (*runCgoProvider).cflags, b.gcc)) + } + + // Add compile actions for S files. + var sfiles []string + // In a package using cgo, cgo compiles the C, C++ and assembly files with gcc. + // There is one exception: runtime/cgo's job is to bridge the + // cgo and non-cgo worlds, so it necessarily has files in both. + // In that case gcc only gets the gcc_* files. + if p.Standard && p.ImportPath == "runtime/cgo" { + for _, f := range p.SFiles { + if strings.HasPrefix(f, "gcc_") { + sfiles = append(sfiles, f) + } + } + } else { + sfiles = p.SFiles + } + for _, f := range sfiles { + collectDeps = append(collectDeps, compileAction(f, (*runCgoProvider).cflags, b.gas)) + } + + // Add compile actions for C files in the package, M files, and those generated by swig. + for _, f := range slices.Concat(p.CFiles, p.MFiles, swigC) { + collectDeps = append(collectDeps, compileAction(f, (*runCgoProvider).cflags, b.gcc)) + } + + // Add compile actions for C++ files in the package, and those generated by swig. + for _, f := range slices.Concat(p.CXXFiles, swigCXX) { + collectDeps = append(collectDeps, compileAction(f, (*runCgoProvider).cxxflags, b.gxx)) + } + + // Add compile actions for Fortran files in the package. + for _, f := range p.FFiles { + collectDeps = append(collectDeps, compileAction(f, (*runCgoProvider).fflags, b.gfortran)) + } + + // Add a single convenience action that does nothing to join the previous action, + // and better separate the cgo action dependencies of the build action from the + // build actions for its package dependencies. + return &Action{ + Mode: "collect cgo", + Actor: ActorFunc(func(b *Builder, ctx context.Context, a *Action) error { + // Use the cgo run action's provider as our provider output, + // so it can be easily accessed by the build action. + a.Provider = a.Deps[0].Deps[0].Provider + return nil + }), + Deps: collectDeps, + Objdir: objdir, + } + }) + + return cgoCollectAction +} + // VetAction returns the action for running go vet on package p. // It depends on the action for compiling p. // If the caller may be causing p to be installed, it is up to the caller diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 6e3ad00e05..b68795b917 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -464,6 +464,38 @@ func allowedVersion(v string) bool { return gover.Compare(gover.Local(), v) >= 0 } +func (b *Builder) computeNonGoOverlay(a *Action, p *load.Package, sh *Shell, objdir string, nonGoFileLists [][]string) error { +OverlayLoop: + for _, fs := range nonGoFileLists { + for _, f := range fs { + if fsys.Replaced(mkAbs(p.Dir, f)) { + a.nonGoOverlay = make(map[string]string) + break OverlayLoop + } + } + } + if a.nonGoOverlay != nil { + for _, fs := range nonGoFileLists { + for i := range fs { + from := mkAbs(p.Dir, fs[i]) + dst := objdir + filepath.Base(fs[i]) + if err := sh.CopyFile(dst, fsys.Actual(from), 0666, false); err != nil { + return err + } + a.nonGoOverlay[from] = dst + } + } + } + + return nil +} + +// needsBuild reports whether the Action (which must be mode "build") needs +// to produce the built output. +func (b *Builder) needsBuild(a *Action) bool { + return !b.IsCmdList && a.needBuild || b.NeedExport +} + const ( needBuild uint32 = 1 << iota needCgoHdr @@ -688,12 +720,15 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { var cacheProvider *checkCacheProvider var coverPr *coverProvider + var runCgoPr *runCgoProvider for _, dep := range a.Deps { switch pr := dep.Provider.(type) { case *coverProvider: coverPr = pr case *checkCacheProvider: cacheProvider = pr + case *runCgoProvider: + runCgoPr = pr } } if cacheProvider == nil { @@ -702,6 +737,7 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { need := cacheProvider.need need &^= needCovMetaFile // handled by cover action + need &^= needCgoHdr // handled by run cgo action // TODO: accumulate "negative" need bits from actions if need == 0 { return @@ -736,107 +772,40 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { } gofiles := str.StringList(p.GoFiles) - cgofiles := str.StringList(p.CgoFiles) cfiles := str.StringList(p.CFiles) sfiles := str.StringList(p.SFiles) - cxxfiles := str.StringList(p.CXXFiles) - var objects, cgoObjects, pcCFLAGS, pcLDFLAGS []string - - if p.UsesCgo() || p.UsesSwig() { - if pcCFLAGS, pcLDFLAGS, err = b.getPkgConfigFlags(a); err != nil { - return - } - } - - // Compute overlays for .c/.cc/.h/etc. and if there are any overlays - // put correct contents of all those files in the objdir, to ensure - // the correct headers are included. nonGoOverlay is the overlay that - // points from nongo files to the copied files in objdir. - nonGoFileLists := [][]string{p.CFiles, p.SFiles, p.CXXFiles, p.HFiles, p.FFiles} -OverlayLoop: - for _, fs := range nonGoFileLists { - for _, f := range fs { - if fsys.Replaced(mkAbs(p.Dir, f)) { - a.nonGoOverlay = make(map[string]string) - break OverlayLoop - } - } - } - if a.nonGoOverlay != nil { - for _, fs := range nonGoFileLists { - for i := range fs { - from := mkAbs(p.Dir, fs[i]) - dst := objdir + filepath.Base(fs[i]) - if err := sh.CopyFile(dst, fsys.Actual(from), 0666, false); err != nil { - return err - } - a.nonGoOverlay[from] = dst - } - } - } + var objects, cgoObjects []string // If we're doing coverage, preprocess the .go files and put them in the work directory if p.Internal.Cover.Mode != "" { gofiles = coverPr.goSources - cgofiles = coverPr.cgoSources } - // Run SWIG on each .swig and .swigcxx file. - // Each run will generate two files, a .go file and a .c or .cxx file. - // The .go file will use import "C" and is to be processed by cgo. - // For -cover test or build runs, this needs to happen after the cover - // tool is run; we don't want to instrument swig-generated Go files, - // see issue #64661. - if p.UsesSwig() { - outGo, outC, outCXX, err := b.swig(a, objdir, pcCFLAGS) - if err != nil { - return err + if p.UsesCgo() || p.UsesSwig() { + if runCgoPr == nil { + base.Fatalf("internal error: could not find runCgoProvider") } - cgofiles = append(cgofiles, outGo...) - cfiles = append(cfiles, outC...) - cxxfiles = append(cxxfiles, outCXX...) - } - // Run cgo. - if p.UsesCgo() || p.UsesSwig() { // In a package using cgo, cgo compiles the C, C++ and assembly files with gcc. // There is one exception: runtime/cgo's job is to bridge the // cgo and non-cgo worlds, so it necessarily has files in both. // In that case gcc only gets the gcc_* files. - var gccfiles []string - gccfiles = append(gccfiles, cfiles...) cfiles = nil if p.Standard && p.ImportPath == "runtime/cgo" { - filter := func(files, nongcc, gcc []string) ([]string, []string) { - for _, f := range files { - if strings.HasPrefix(f, "gcc_") { - gcc = append(gcc, f) - } else { - nongcc = append(nongcc, f) - } + // filter to the non-gcc files. + i := 0 + for _, f := range sfiles { + if !strings.HasPrefix(f, "gcc_") { + sfiles[i] = f + i++ } - return nongcc, gcc } - sfiles, gccfiles = filter(sfiles, sfiles[:0], gccfiles) + sfiles = sfiles[:i] } else { - for _, sfile := range sfiles { - data, err := os.ReadFile(filepath.Join(p.Dir, sfile)) - if err == nil { - if bytes.HasPrefix(data, []byte("TEXT")) || bytes.Contains(data, []byte("\nTEXT")) || - bytes.HasPrefix(data, []byte("DATA")) || bytes.Contains(data, []byte("\nDATA")) || - bytes.HasPrefix(data, []byte("GLOBL")) || bytes.Contains(data, []byte("\nGLOBL")) { - return fmt.Errorf("package using cgo has Go assembly file %s", sfile) - } - } - } - gccfiles = append(gccfiles, sfiles...) sfiles = nil } - outGo, outObj, err := b.cgo(a, base.Tool("cgo"), objdir, pcCFLAGS, pcLDFLAGS, mkAbsFiles(p.Dir, cgofiles), gccfiles, cxxfiles, p.MFiles, p.FFiles) - - // The files in cxxfiles have now been handled by b.cgo. - cxxfiles = nil + outGo, outObj, err := b.processCgoOutputs(a, runCgoPr, base.Tool("cgo"), objdir) if err != nil { return err @@ -857,12 +826,8 @@ OverlayLoop: srcfiles = append(srcfiles, gofiles...) srcfiles = append(srcfiles, sfiles...) srcfiles = append(srcfiles, cfiles...) - srcfiles = append(srcfiles, cxxfiles...) b.cacheSrcFiles(a, srcfiles) - // Running cgo generated the cgo header. - need &^= needCgoHdr - // Sanity check only, since Package.load already checked as well. if len(gofiles) == 0 { return &load.NoGoError{Package: p} @@ -991,6 +956,12 @@ OverlayLoop: } } + if err := b.computeNonGoOverlay(a, p, sh, objdir, [][]string{cfiles}); err != nil { + return err + } + + // Compile C files in a package being built with gccgo. We disallow + // C files when compiling with gc unless swig or cgo is used. for _, file := range cfiles { out := file[:len(file)-len(".c")] + ".o" if err := BuildToolchain.cc(b, a, objdir+out, file); err != nil { @@ -1694,8 +1665,7 @@ func splitPkgConfigOutput(out []byte) ([]string, error) { } // Calls pkg-config if needed and returns the cflags/ldflags needed to build a's package. -func (b *Builder) getPkgConfigFlags(a *Action) (cflags, ldflags []string, err error) { - p := a.Package +func (b *Builder) getPkgConfigFlags(a *Action, p *load.Package) (cflags, ldflags []string, err error) { sh := b.Shell(a) if pcargs := p.CgoPkgConfig; len(pcargs) > 0 { // pkg-config permits arguments to appear anywhere in @@ -2172,6 +2142,20 @@ func (b *Builder) gcc(a *Action, workdir, out string, flags []string, cfile stri return b.ccompile(a, out, flags, cfile, b.GccCmd(p.Dir, workdir)) } +// gas runs the gcc c compiler to create an object file from a single C assembly file. +func (b *Builder) gas(a *Action, workdir, out string, flags []string, sfile string) error { + p := a.Package + data, err := os.ReadFile(filepath.Join(p.Dir, sfile)) + if err == nil { + if bytes.HasPrefix(data, []byte("TEXT")) || bytes.Contains(data, []byte("\nTEXT")) || + bytes.HasPrefix(data, []byte("DATA")) || bytes.Contains(data, []byte("\nDATA")) || + bytes.HasPrefix(data, []byte("GLOBL")) || bytes.Contains(data, []byte("\nGLOBL")) { + return fmt.Errorf("package using cgo has Go assembly file %s", sfile) + } + } + return b.ccompile(a, out, flags, sfile, b.GccCmd(p.Dir, workdir)) +} + // gxx runs the g++ C++ compiler to create an object from a single C++ file. func (b *Builder) gxx(a *Action, workdir, out string, flags []string, cxxfile string) error { p := a.Package @@ -2191,6 +2175,8 @@ func (b *Builder) ccompile(a *Action, outfile string, flags []string, file strin file = mkAbs(p.Dir, file) outfile = mkAbs(p.Dir, outfile) + flags = slices.Clip(flags) // If we append to flags, write to a new slice that we own. + // Elide source directory paths if -trimpath is set. // This is needed for source files (e.g., a .c file in a package directory). // TODO(golang.org/issue/36072): cgo also generates files with #line @@ -2741,26 +2727,97 @@ func buildFlags(name, defaults string, fromPackage []string, check func(string, var cgoRe = lazyregexp.New(`[/\\:]`) -func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) { +type runCgoProvider struct { + CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS []string + notCompatibleForInternalLinking bool + nonGoOverlay map[string]string + goFiles []string // processed cgo files for the compiler +} + +func (pr *runCgoProvider) cflags() []string { + return pr.CFLAGS +} + +func (pr *runCgoProvider) cxxflags() []string { + return pr.CXXFLAGS +} + +func (pr *runCgoProvider) fflags() []string { + return pr.CXXFLAGS +} + +func (pr *runCgoProvider) ldflags() []string { + return pr.LDFLAGS +} + +func mustGetCoverInfo(a *Action) *coverProvider { + for _, dep := range a.Deps { + if dep.Mode == "cover" { + return dep.Provider.(*coverProvider) + } + } + base.Fatalf("internal error: cover provider not found") + panic("unreachable") +} + +func (b *Builder) runCgo(ctx context.Context, a *Action) error { p := a.Package sh := b.Shell(a) + objdir := a.Objdir + + if err := sh.Mkdir(objdir); err != nil { + return err + } + + nonGoFileLists := [][]string{p.CFiles, p.SFiles, p.CXXFiles, p.HFiles, p.FFiles} + if err := b.computeNonGoOverlay(a, p, sh, objdir, nonGoFileLists); err != nil { + return err + } + + cgofiles := slices.Clip(p.CgoFiles) + if a.Package.Internal.Cover.Mode != "" { + cp := mustGetCoverInfo(a) + cgofiles = cp.cgoSources + } + + pcCFLAGS, pcLDFLAGS, err := b.getPkgConfigFlags(a, p) + if err != nil { + return err + } + + // Run SWIG on each .swig and .swigcxx file. + // Each run will generate two files, a .go file and a .c or .cxx file. + // The .go file will use import "C" and is to be processed by cgo. + // For -cover test or build runs, this needs to happen after the cover + // tool is run; we don't want to instrument swig-generated Go files, + // see issue #64661. + if p.UsesSwig() { + if err := b.swig(a, objdir, pcCFLAGS); err != nil { + return err + } + outGo, _, _ := b.swigOutputs(p, objdir) + cgofiles = append(cgofiles, outGo...) + } + + cgoExe := base.Tool("cgo") + cgofiles = mkAbsFiles(p.Dir, cgofiles) cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p) if err != nil { - return nil, nil, err + return err } cgoCPPFLAGS = append(cgoCPPFLAGS, pcCFLAGS...) cgoLDFLAGS = append(cgoLDFLAGS, pcLDFLAGS...) // If we are compiling Objective-C code, then we need to link against libobjc - if len(mfiles) > 0 { + if len(p.MFiles) > 0 { cgoLDFLAGS = append(cgoLDFLAGS, "-lobjc") } // Likewise for Fortran, except there are many Fortran compilers. // Support gfortran out of the box and let others pass the correct link options // via CGO_LDFLAGS - if len(ffiles) > 0 { + if len(p.FFiles) > 0 { fc := cfg.Getenv("FC") if fc == "" { fc = "gfortran" @@ -2787,13 +2844,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo // #58620, and #58848. flagSources := []string{"CGO_CFLAGS", "CGO_CXXFLAGS", "CGO_FFLAGS"} flagLists := [][]string{cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS} - if flagsNotCompatibleWithInternalLinking(flagSources, flagLists) { - tokenFile := objdir + "preferlinkext" - if err := sh.writeFile(tokenFile, nil); err != nil { - return nil, nil, err - } - outObj = append(outObj, tokenFile) - } + notCompatibleWithInternalLinking := flagsNotCompatibleWithInternalLinking(flagSources, flagLists) if cfg.BuildMSan { cgoCFLAGS = append([]string{"-fsanitize=memory"}, cgoCFLAGS...) @@ -2811,11 +2862,11 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo // cgo // TODO: CGO_FLAGS? gofiles := []string{objdir + "_cgo_gotypes.go"} - cfiles := []string{"_cgo_export.c"} + cfiles := []string{objdir + "_cgo_export.c"} for _, fn := range cgofiles { f := strings.TrimSuffix(filepath.Base(fn), ".go") gofiles = append(gofiles, objdir+f+".cgo1.go") - cfiles = append(cfiles, f+".cgo2.c") + cfiles = append(cfiles, objdir+f+".cgo2.c") } // TODO: make cgo not depend on $GOARCH? @@ -2889,70 +2940,61 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo } if err := sh.run(p.Dir, p.ImportPath, cgoenv, cfg.BuildToolexec, cgoExe, "-objdir", objdir, "-importpath", p.ImportPath, cgoflags, ldflagsOption, "--", cgoCPPFLAGS, cgoCFLAGS, cgofiles); err != nil { - return nil, nil, err - } - outGo = append(outGo, gofiles...) - - // Use sequential object file names to keep them distinct - // and short enough to fit in the .a header file name slots. - // We no longer collect them all into _all.o, and we'd like - // tools to see both the .o suffix and unique names, so - // we need to make them short enough not to be truncated - // in the final archive. - oseq := 0 - nextOfile := func() string { - oseq++ - return objdir + fmt.Sprintf("_x%03d.o", oseq) - } - - // gcc - cflags := str.StringList(cgoCPPFLAGS, cgoCFLAGS) - for _, cfile := range cfiles { - ofile := nextOfile() - if err := b.gcc(a, a.Objdir, ofile, cflags, objdir+cfile); err != nil { - return nil, nil, err - } - outObj = append(outObj, ofile) + return err } - for _, file := range gccfiles { - ofile := nextOfile() - if err := b.gcc(a, a.Objdir, ofile, cflags, file); err != nil { - return nil, nil, err - } - outObj = append(outObj, ofile) + a.Provider = &runCgoProvider{ + CFLAGS: str.StringList(cgoCPPFLAGS, cgoCFLAGS), + CXXFLAGS: str.StringList(cgoCPPFLAGS, cgoCXXFLAGS), + FFLAGS: str.StringList(cgoCPPFLAGS, cgoFFLAGS), + LDFLAGS: cgoLDFLAGS, + notCompatibleForInternalLinking: notCompatibleWithInternalLinking, + nonGoOverlay: a.nonGoOverlay, + goFiles: gofiles, } - cxxflags := str.StringList(cgoCPPFLAGS, cgoCXXFLAGS) - for _, file := range gxxfiles { - ofile := nextOfile() - if err := b.gxx(a, a.Objdir, ofile, cxxflags, file); err != nil { - return nil, nil, err - } - outObj = append(outObj, ofile) - } + return nil +} + +func (b *Builder) processCgoOutputs(a *Action, runCgoProvider *runCgoProvider, cgoExe, objdir string) (outGo, outObj []string, err error) { + outGo = slices.Clip(runCgoProvider.goFiles) + + // TODO(matloob): Pretty much the only thing this function is doing is + // producing the dynimport go files. But we should be able to compile + // those separately from the package itself: we just need to get the + // compiled output to the linker. That means that we can remove the + // dependency of this build action on the outputs of the cgo compile actions + // (though we'd still need to depend on the runCgo action of course). + + sh := b.Shell(a) - for _, file := range mfiles { - ofile := nextOfile() - if err := b.gcc(a, a.Objdir, ofile, cflags, file); err != nil { + // Output the preferlinkext file if the run cgo action determined this package + // was not compatible for internal linking based on CFLAGS, CXXFLAGS, or FFLAGS. + if runCgoProvider.notCompatibleForInternalLinking { + tokenFile := objdir + "preferlinkext" + if err := sh.writeFile(tokenFile, nil); err != nil { return nil, nil, err } - outObj = append(outObj, ofile) + outObj = append(outObj, tokenFile) } - fflags := str.StringList(cgoCPPFLAGS, cgoFFLAGS) - for _, file := range ffiles { - ofile := nextOfile() - if err := b.gfortran(a, a.Objdir, ofile, fflags, file); err != nil { - return nil, nil, err + var collectAction *Action + for _, dep := range a.Deps { + if dep.Mode == "collect cgo" { + collectAction = dep } - outObj = append(outObj, ofile) + } + if collectAction == nil { + base.Fatalf("internal error: no cgo collect action") + } + for _, dep := range collectAction.Deps { + outObj = append(outObj, dep.Target) } switch cfg.BuildToolchainName { case "gc": importGo := objdir + "_cgo_import.go" - dynOutGo, dynOutObj, err := b.dynimport(a, objdir, importGo, cgoExe, cflags, cgoLDFLAGS, outObj) + dynOutGo, dynOutObj, err := b.dynimport(a, objdir, importGo, cgoExe, runCgoProvider.CFLAGS, runCgoProvider.LDFLAGS, outObj) if err != nil { return nil, nil, err } @@ -3031,16 +3073,16 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo } } - // We expect to find the contents of cgoLDFLAGS in flags. - if len(cgoLDFLAGS) > 0 { + // We expect to find the contents of cgoLDFLAGS used when running the CGO action in flags. + if len(runCgoProvider.LDFLAGS) > 0 { outer: for i := range flags { - for j, f := range cgoLDFLAGS { + for j, f := range runCgoProvider.LDFLAGS { if f != flags[i+j] { continue outer } } - flags = append(flags[:i], flags[i+len(cgoLDFLAGS):]...) + flags = append(flags[:i], flags[i+len(runCgoProvider.LDFLAGS):]...) break } } @@ -3156,43 +3198,43 @@ func (b *Builder) dynimport(a *Action, objdir, importGo, cgoExe string, cflags, // Run SWIG on all SWIG input files. // TODO: Don't build a shared library, once SWIG emits the necessary // pragmas for external linking. -func (b *Builder) swig(a *Action, objdir string, pcCFLAGS []string) (outGo, outC, outCXX []string, err error) { +func (b *Builder) swig(a *Action, objdir string, pcCFLAGS []string) error { p := a.Package if err := b.swigVersionCheck(); err != nil { - return nil, nil, nil, err + return err } intgosize, err := b.swigIntSize(objdir) if err != nil { - return nil, nil, nil, err + return err } for _, f := range p.SwigFiles { - goFile, cFile, err := b.swigOne(a, f, objdir, pcCFLAGS, false, intgosize) - if err != nil { - return nil, nil, nil, err - } - if goFile != "" { - outGo = append(outGo, goFile) - } - if cFile != "" { - outC = append(outC, cFile) + if err := b.swigOne(a, f, objdir, pcCFLAGS, false, intgosize); err != nil { + return err } } for _, f := range p.SwigCXXFiles { - goFile, cxxFile, err := b.swigOne(a, f, objdir, pcCFLAGS, true, intgosize) - if err != nil { - return nil, nil, nil, err - } - if goFile != "" { - outGo = append(outGo, goFile) - } - if cxxFile != "" { - outCXX = append(outCXX, cxxFile) + if b.swigOne(a, f, objdir, pcCFLAGS, true, intgosize); err != nil { + return err } } - return outGo, outC, outCXX, nil + return nil +} + +func (b *Builder) swigOutputs(p *load.Package, objdir string) (outGo, outC, outCXX []string) { + for _, f := range p.SwigFiles { + goFile, cFile := swigOneOutputs(f, objdir, false) + outGo = append(outGo, goFile) + outC = append(outC, cFile) + } + for _, f := range p.SwigCXXFiles { + goFile, cxxFile := swigOneOutputs(f, objdir, true) + outGo = append(outGo, goFile) + outCXX = append(outCXX, cxxFile) + } + return outGo, outC, outCXX } // Make sure SWIG is new enough. @@ -3305,13 +3347,13 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) { } // Run SWIG on one SWIG input file. -func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) { +func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) error { p := a.Package sh := b.Shell(a) cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p) if err != nil { - return "", "", err + return err } var cflags []string @@ -3321,17 +3363,8 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx cflags = str.StringList(cgoCPPFLAGS, pcCFLAGS, cgoCFLAGS) } - n := 5 // length of ".swig" - if cxx { - n = 8 // length of ".swigcxx" - } - base := file[:len(file)-n] - goFile := base + ".go" - gccBase := base + "_wrap." - gccExt := "c" - if cxx { - gccExt = "cxx" - } + base := swigBase(file, cxx) + newGoFile, outC := swigOneOutputs(file, objdir, cxx) gccgo := cfg.BuildToolchainName == "gccgo" @@ -3341,7 +3374,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx "-cgo", "-intgosize", intgosize, "-module", base, - "-o", objdir + gccBase + gccExt, + "-o", outC, "-outdir", objdir, } @@ -3363,31 +3396,52 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx out, err := sh.runOut(p.Dir, nil, "swig", args, file) if err != nil && (bytes.Contains(out, []byte("-intgosize")) || bytes.Contains(out, []byte("-cgo"))) { - return "", "", errors.New("must have SWIG version >= 3.0.6") + return errors.New("must have SWIG version >= 3.0.6") } if err := sh.reportCmd("", "", out, err); err != nil { - return "", "", err + return err } // If the input was x.swig, the output is x.go in the objdir. // But there might be an x.go in the original dir too, and if it // uses cgo as well, cgo will be processing both and will // translate both into x.cgo1.go in the objdir, overwriting one. - // Rename x.go to _x_swig.go to avoid this problem. + // Rename x.go to _x_swig.go (newGoFile) to avoid this problem. // We ignore files in the original dir that begin with underscore // so _x_swig.go cannot conflict with an original file we were // going to compile. - goFile = objdir + goFile - newGoFile := objdir + "_" + base + "_swig.go" + goFile := objdir + base + ".go" if cfg.BuildX || cfg.BuildN { sh.ShowCmd("", "mv %s %s", goFile, newGoFile) } if !cfg.BuildN { if err := os.Rename(goFile, newGoFile); err != nil { - return "", "", err + return err } } - return newGoFile, objdir + gccBase + gccExt, nil + + return nil +} + +func swigBase(file string, cxx bool) string { + n := 5 // length of ".swig" + if cxx { + n = 8 // length of ".swigcxx" + } + return file[:len(file)-n] +} + +func swigOneOutputs(file, objdir string, cxx bool) (outGo, outC string) { + base := swigBase(file, cxx) + gccBase := base + "_wrap." + gccExt := "c" + if cxx { + gccExt = "cxx" + } + + newGoFile := objdir + "_" + base + "_swig.go" + cFile := objdir + gccBase + gccExt + return newGoFile, cFile } // disableBuildID adjusts a linker command line to avoid creating a -- cgit v1.3-5-g45d5 From dd8276657f2244193d399f01941ee1d76a79529d Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Wed, 18 Sep 2024 10:14:04 +0200 Subject: cmd/asm, cmd/internal/obj: add riscv64 generic CSR ops Support is added for the generic RISC-V CSR operations; CSRRC, CSRRCI, CSRRS, CSRRSI, CSRRW, CSRRWI. These instructions require special handling as their second operand is a symbolic CSR register name and not an immediate value or a register. CSR names are implemented as special operands. RISC-V CSRs are not currently saved and restored when a go routine is asynchronously pre-empted so it is only safe to use these instructions in hand written assembler. Note that CSRRS was already partially supported by the assembler so this restriction predates this commit. We mention it here as this commit makes CSRRS much easier to use. Change-Id: I9ff8d804328b418a879d463e7d9cc31f489c7a00 Reviewed-on: https://go-review.googlesource.com/c/go/+/630519 Reviewed-by: Junyang Shao Reviewed-by: Joel Sing LUCI-TryBot-Result: Go LUCI Reviewed-by: Meng Zhuo Reviewed-by: Michael Pratt --- src/cmd/asm/internal/arch/riscv64.go | 29 +++++++++++++++- src/cmd/asm/internal/asm/asm.go | 15 ++++++++ src/cmd/asm/internal/asm/testdata/riscv64.s | 18 ++++++++++ src/cmd/asm/internal/asm/testdata/riscv64error.s | 21 +++++++++++ src/cmd/internal/obj/link.go | 2 +- src/cmd/internal/obj/riscv/cpu.go | 40 ++++++++++++++++----- src/cmd/internal/obj/riscv/list.go | 9 +++-- src/cmd/internal/obj/riscv/obj.go | 44 +++++++++++++++++++++++- 8 files changed, 165 insertions(+), 13 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/asm/internal/arch/riscv64.go b/src/cmd/asm/internal/arch/riscv64.go index 69e060a865..891d2be0e5 100644 --- a/src/cmd/asm/internal/arch/riscv64.go +++ b/src/cmd/asm/internal/arch/riscv64.go @@ -11,6 +11,7 @@ package arch import ( "cmd/internal/obj" "cmd/internal/obj/riscv" + "fmt" ) // IsRISCV64AMO reports whether op is an AMO instruction that requires @@ -32,6 +33,20 @@ func IsRISCV64VTypeI(op obj.As) bool { return op == riscv.AVSETVLI || op == riscv.AVSETIVLI } +// IsRISCV64CSRO reports whether the op is an instruction that uses +// CSR symbolic names and whether that instruction expects a register +// or an immediate source operand. +func IsRISCV64CSRO(op obj.As) (imm bool, ok bool) { + switch op { + case riscv.ACSRRCI, riscv.ACSRRSI, riscv.ACSRRWI: + imm = true + fallthrough + case riscv.ACSRRC, riscv.ACSRRS, riscv.ACSRRW: + ok = true + } + return +} + var riscv64SpecialOperand map[string]riscv.SpecialOperand // RISCV64SpecialOperand returns the internal representation of a special operand. @@ -39,9 +54,21 @@ func RISCV64SpecialOperand(name string) riscv.SpecialOperand { if riscv64SpecialOperand == nil { // Generate mapping when function is first called. riscv64SpecialOperand = map[string]riscv.SpecialOperand{} - for opd := riscv.SPOP_BEGIN; opd < riscv.SPOP_END; opd++ { + for opd := riscv.SPOP_RVV_BEGIN; opd < riscv.SPOP_RVV_END; opd++ { riscv64SpecialOperand[opd.String()] = opd } + // Add the CSRs + for csrCode, csrName := range riscv.CSRs { + // The set of RVV special operand names and the set of CSR special operands + // names are disjoint and so can safely share a single namespace. However, + // it's possible that a future update to the CSRs in inst.go could introduce + // a conflict. This check ensures that such a conflict does not go + // unnoticed. + if _, ok := riscv64SpecialOperand[csrName]; ok { + panic(fmt.Sprintf("riscv64 special operand %q redefined", csrName)) + } + riscv64SpecialOperand[csrName] = riscv.SpecialOperand(int(csrCode) + int(riscv.SPOP_CSR_BEGIN)) + } } if opd, ok := riscv64SpecialOperand[name]; ok { return opd diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go index 6bdbcb9c1b..389307af29 100644 --- a/src/cmd/asm/internal/asm/asm.go +++ b/src/cmd/asm/internal/asm/asm.go @@ -782,6 +782,21 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) { prog.RegTo2 = a[2].Reg break } + // RISCV64 instructions that reference CSRs with symbolic names. + if isImm, ok := arch.IsRISCV64CSRO(op); ok { + if a[0].Type != obj.TYPE_CONST && isImm { + p.errorf("invalid value for first operand to %s instruction, must be a 5 bit unsigned immediate", op) + return + } + if a[1].Type != obj.TYPE_SPECIAL { + p.errorf("invalid value for second operand to %s instruction, must be a CSR name", op) + return + } + prog.AddRestSourceArgs([]obj.Addr{a[1]}) + prog.From = a[0] + prog.To = a[2] + break + } prog.From = a[0] prog.Reg = p.getRegister(prog, op, &a[1]) prog.To = a[2] diff --git a/src/cmd/asm/internal/asm/testdata/riscv64.s b/src/cmd/asm/internal/asm/testdata/riscv64.s index 75abcefa10..30f9989982 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64.s @@ -172,6 +172,24 @@ start: SD X5, (X6) // 23305300 SD X5, 4(X6) // 23325300 + // 7.1: CSR Instructions + CSRRC X0, CYCLE, X5 // f33200c0 + CSRRC X0, CYCLE, X0 // 733000c0 + CSRRC X10, CYCLE, X5 // f33205c0 + CSRRC $2, TIME, X5 // f37211c0 + CSRRCI $2, TIME, X5 // f37211c0 + CSRRS X0, CYCLE, X5 // f32200c0 + CSRRS X0, CYCLE, X0 // 732000c0 + CSRRS X10, CYCLE, X5 // f32205c0 + CSRRS $2, TIME, X5 // f36211c0 + CSRRS X0, VLENB, X5 // f32220c2 + CSRRSI $2, TIME, X5 // f36211c0 + CSRRW X0, CYCLE, X5 // f31200c0 + CSRRW X0, CYCLE, X0 // 731000c0 + CSRRW X10, CYCLE, X5 // f31205c0 + CSRRW $2, TIME, X5 // f35211c0 + CSRRWI $2, TIME, X5 // f35211c0 + // 8.1: Base Counters and Timers (Zicntr) RDCYCLE X5 // f32200c0 RDTIME X5 // f32210c0 diff --git a/src/cmd/asm/internal/asm/testdata/riscv64error.s b/src/cmd/asm/internal/asm/testdata/riscv64error.s index 4e6afa0ac2..434f221fd9 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64error.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64error.s @@ -3,6 +3,27 @@ // license that can be found in the LICENSE file. TEXT errors(SB),$0 + CSRRC (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand" + CSRRC X0, TU, X5 // ERROR "unknown CSR" + CSRRC X0, CYCLE // ERROR "missing CSR name" + CSRRC X0, CYCLE, (X10) // ERROR "needs an integer register output" + CSRRC $-1, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRCI $32, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRCI $1, TIME, (X15) // ERROR "needs an integer register output" + CSRRS (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand" + CSRRS X0, CYCLE, (X10) // ERROR "needs an integer register output" + CSRRS X0, TU, X5 // ERROR "unknown CSR" + CSRRS X0, CYCLE // ERROR "missing CSR name" + CSRRS $-1, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRSI $32, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRSI $1, TIME, (X15) // ERROR "needs an integer register output" + CSRRW (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand" + CSRRW X0, TU, X5 // ERROR "unknown CSR" + CSRRW X0, CYCLE // ERROR "missing CSR name" + CSRRW X0, CYCLE, (X5) // ERROR "needs an integer register output" + CSRRW $-1, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRWI $32, TIME, X15 // ERROR "immediate out of range 0 to 31" + CSRRWI $1, TIME, (X15) // ERROR "needs an integer register output" MOV $errors(SB), (X5) // ERROR "address load must target register" MOV $8(SP), (X5) // ERROR "address load must target register" MOVB $8(SP), X5 // ERROR "unsupported address load" diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index ea7f518f42..6513e11687 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -99,7 +99,7 @@ import ( // // // Special symbolic constants for ARM64 (such as conditional flags, tlbi_op and so on) -// and RISCV64 (such as names for vector configuration instruction arguments). +// and RISCV64 (such as names for vector configuration instruction arguments and CSRs). // Encoding: // type = TYPE_SPECIAL // offset = The constant value corresponding to this symbol diff --git a/src/cmd/internal/obj/riscv/cpu.go b/src/cmd/internal/obj/riscv/cpu.go index 116ccb4ea4..b0fcda218c 100644 --- a/src/cmd/internal/obj/riscv/cpu.go +++ b/src/cmd/internal/obj/riscv/cpu.go @@ -35,6 +35,8 @@ import ( "cmd/internal/obj" ) +var CSRs map[uint16]string = csrs + //go:generate go run ../stringer.go -i $GOFILE -o anames.go -p riscv const ( @@ -1315,9 +1317,10 @@ type SpecialOperand int const ( SPOP_BEGIN SpecialOperand = obj.SpecialOperandRISCVBase + SPOP_RVV_BEGIN // Vector mask policy. - SPOP_MA SpecialOperand = obj.SpecialOperandRISCVBase + iota - 1 + SPOP_MA SpecialOperand = obj.SpecialOperandRISCVBase + iota - 2 SPOP_MU // Vector tail policy. @@ -1338,8 +1341,13 @@ const ( SPOP_E16 SPOP_E32 SPOP_E64 + SPOP_RVV_END + + // CSR names. 4096 special operands are reserved for RISC-V CSR names. + SPOP_CSR_BEGIN = SPOP_RVV_END + SPOP_CSR_END = SPOP_CSR_BEGIN + 4096 - SPOP_END + SPOP_END = SPOP_CSR_END + 1 ) var specialOperands = map[SpecialOperand]struct { @@ -1367,17 +1375,33 @@ var specialOperands = map[SpecialOperand]struct { } func (so SpecialOperand) encode() uint32 { - op, ok := specialOperands[so] - if ok { - return op.encoding + switch { + case so >= SPOP_RVV_BEGIN && so < SPOP_RVV_END: + op, ok := specialOperands[so] + if ok { + return op.encoding + } + case so >= SPOP_CSR_BEGIN && so < SPOP_CSR_END: + csrNum := uint16(so - SPOP_CSR_BEGIN) + if _, ok := csrs[csrNum]; ok { + return uint32(csrNum) + } } return 0 } +// String returns the textual representation of a SpecialOperand. func (so SpecialOperand) String() string { - op, ok := specialOperands[so] - if ok { - return op.name + switch { + case so >= SPOP_RVV_BEGIN && so < SPOP_RVV_END: + op, ok := specialOperands[so] + if ok { + return op.name + } + case so >= SPOP_CSR_BEGIN && so < SPOP_CSR_END: + if csrName, ok := csrs[uint16(so-SPOP_CSR_BEGIN)]; ok { + return csrName + } } return "" } diff --git a/src/cmd/internal/obj/riscv/list.go b/src/cmd/internal/obj/riscv/list.go index 8eb97a476d..da703c02ad 100644 --- a/src/cmd/internal/obj/riscv/list.go +++ b/src/cmd/internal/obj/riscv/list.go @@ -52,9 +52,14 @@ func opSuffixString(s uint8) string { } func specialOperandConv(a int64) string { + var s string + spc := SpecialOperand(a) if spc >= SPOP_BEGIN && spc < SPOP_END { - return spc.String() + s = spc.String() + } + if s == "" { + return "SPC_??" } - return "SPC_??" + return s } diff --git a/src/cmd/internal/obj/riscv/obj.go b/src/cmd/internal/obj/riscv/obj.go index 40f143be5c..db8d663c5a 100644 --- a/src/cmd/internal/obj/riscv/obj.go +++ b/src/cmd/internal/obj/riscv/obj.go @@ -1920,7 +1920,12 @@ var instructions = [ALAST & obj.AMask]instructionData{ ASD & obj.AMask: {enc: sIEncoding}, // 7.1: CSR Instructions - ACSRRS & obj.AMask: {enc: iIIEncoding}, + ACSRRC & obj.AMask: {enc: iIIEncoding, immForm: ACSRRCI}, + ACSRRCI & obj.AMask: {enc: iIIEncoding}, + ACSRRS & obj.AMask: {enc: iIIEncoding, immForm: ACSRRSI}, + ACSRRSI & obj.AMask: {enc: iIIEncoding}, + ACSRRW & obj.AMask: {enc: iIIEncoding, immForm: ACSRRWI}, + ACSRRWI & obj.AMask: {enc: iIIEncoding}, // 13.1: Multiplication Operations AMUL & obj.AMask: {enc: rIIIEncoding, ternary: true}, @@ -3327,6 +3332,43 @@ func instructionsForProg(p *obj.Prog) []*instruction { ins.imm = -1022 } + case ACSRRC, ACSRRCI, ACSRRS, ACSRRSI, ACSRRW, ACSRRWI: + if len(p.RestArgs) == 0 || p.RestArgs[0].Type != obj.TYPE_SPECIAL { + p.Ctxt.Diag("%v: missing CSR name", p) + return nil + } + if p.From.Type == obj.TYPE_CONST { + imm := p.From.Offset + if imm < 0 || imm >= 32 { + p.Ctxt.Diag("%v: immediate out of range 0 to 31", p) + return nil + } + ins.rs1 = uint32(imm) + REG_ZERO + } else if p.From.Type == obj.TYPE_REG { + ins.rs1 = uint32(p.From.Reg) + } else { + p.Ctxt.Diag("%v: integer register or immediate expected for 1st operand", p) + return nil + } + if p.To.Type != obj.TYPE_REG { + p.Ctxt.Diag("%v: needs an integer register output", p) + return nil + } + csrNum := SpecialOperand(p.RestArgs[0].Offset).encode() + if csrNum >= 1<<12 { + p.Ctxt.Diag("%v: unknown CSR", p) + return nil + } + if _, ok := CSRs[uint16(csrNum)]; !ok { + p.Ctxt.Diag("%v: unknown CSR", p) + return nil + } + ins.imm = int64(csrNum) + if ins.imm > 2047 { + ins.imm -= 4096 + } + ins.rs2 = obj.REG_NONE + case AFENCE: ins.rd, ins.rs1, ins.rs2 = REG_ZERO, REG_ZERO, obj.REG_NONE ins.imm = 0x0ff -- cgit v1.3-5-g45d5 From c70713da823ab83451ef52176fb250419a9688c7 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Thu, 11 Sep 2025 17:42:30 -0400 Subject: cmd/link: support MSVC clang Currently on Windows, for cgo, we support MinGW-based C toolchain, that is, with a -windows-gnu target. This CL makes it work with clang with a -windows-msvc target. The LLVM toolchain bundled in MSVC (https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild) is such an example. Currently it is expecting lld-link as the C linker, which is also bundled in MSVC, can be requested with -fuse-ld=lld, but is not the default. This is the first step, which makes it generate a working cgo binary. There are still more work to do, e.g. there are some linker warnings, and the binary doesn't have symbol table. all.bat doesn't pass with this setting. Change-Id: I54d33f7dd5f5eeeafa0735cd52f4127fe4865636 Reviewed-on: https://go-review.googlesource.com/c/go/+/703055 Reviewed-by: Than McIntosh Reviewed-by: Florian Zenker LUCI-TryBot-Result: Go LUCI --- src/cmd/link/internal/ld/lib.go | 72 ++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 16 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 7f22b6ba1c..516150a0a7 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -1457,6 +1457,9 @@ func (ctxt *Link) hostlink() { // Only macOS supports unmapped segments such as our __DWARF segment. combineDwarf := ctxt.IsDarwin() && !*FlagW && machoPlatform == PLATFORM_MACOS + var isMSVC bool // used on Windows + wlPrefix := "-Wl,--" + switch ctxt.HeadType { case objabi.Hdarwin: if combineDwarf { @@ -1501,6 +1504,15 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,--no-execute-only") } case objabi.Hwindows: + isMSVC = ctxt.isMSVC() + if isMSVC { + // For various options, MSVC lld-link only accepts one dash. + // TODO: It seems mingw clang supports one or two dashes, + // maybe we can always use one dash, but I'm not sure about + // legacy compilers that currently work. + wlPrefix = "-Wl,-" + } + if windowsgui { argv = append(argv, "-mwindows") } else { @@ -1508,15 +1520,18 @@ func (ctxt *Link) hostlink() { } // Mark as having awareness of terminal services, to avoid // ancient compatibility hacks. - argv = append(argv, "-Wl,--tsaware") + + argv = append(argv, wlPrefix+"tsaware") // Enable DEP - argv = append(argv, "-Wl,--nxcompat") + argv = append(argv, wlPrefix+"nxcompat") - argv = append(argv, fmt.Sprintf("-Wl,--major-os-version=%d", PeMinimumTargetMajorVersion)) - argv = append(argv, fmt.Sprintf("-Wl,--minor-os-version=%d", PeMinimumTargetMinorVersion)) - argv = append(argv, fmt.Sprintf("-Wl,--major-subsystem-version=%d", PeMinimumTargetMajorVersion)) - argv = append(argv, fmt.Sprintf("-Wl,--minor-subsystem-version=%d", PeMinimumTargetMinorVersion)) + if !isMSVC { + argv = append(argv, fmt.Sprintf("-Wl,--major-os-version=%d", PeMinimumTargetMajorVersion)) + argv = append(argv, fmt.Sprintf("-Wl,--minor-os-version=%d", PeMinimumTargetMinorVersion)) + argv = append(argv, fmt.Sprintf("-Wl,--major-subsystem-version=%d", PeMinimumTargetMajorVersion)) + argv = append(argv, fmt.Sprintf("-Wl,--minor-subsystem-version=%d", PeMinimumTargetMinorVersion)) + } case objabi.Haix: argv = append(argv, "-pthread") // prevent ld to reorder .text functions to keep the same @@ -1557,16 +1572,21 @@ func (ctxt *Link) hostlink() { // an ancient compiler with ancient defaults. var dbopt string var heopt string - dbon := "--dynamicbase" - heon := "--high-entropy-va" - dboff := "--disable-dynamicbase" - heoff := "--disable-high-entropy-va" + dbon := wlPrefix + "dynamicbase" + heon := wlPrefix + "high-entropy-va" + dboff := wlPrefix + "disable-dynamicbase" + heoff := wlPrefix + "disable-high-entropy-va" + if isMSVC { + heon = wlPrefix + "highentropyva" + heoff = wlPrefix + "highentropyva:no" + dboff = wlPrefix + "dynamicbase:no" + } if val { dbopt = dbon heopt = heon } else { // Test to see whether "--disable-dynamicbase" works. - newer := linkerFlagSupported(ctxt.Arch, argv[0], "", "-Wl,"+dboff) + newer := linkerFlagSupported(ctxt.Arch, argv[0], "", dboff) if newer { // Newer compiler, which supports both on/off options. dbopt = dboff @@ -1579,11 +1599,11 @@ func (ctxt *Link) hostlink() { } } if dbopt != "" { - argv = append(argv, "-Wl,"+dbopt) + argv = append(argv, dbopt) } // enable high-entropy ASLR on 64-bit. if ctxt.Arch.PtrSize >= 8 && heopt != "" { - argv = append(argv, "-Wl,"+heopt) + argv = append(argv, heopt) } return argv } @@ -1927,9 +1947,11 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-lsynchronization") } } - // libmingw32 and libmingwex have some inter-dependencies, - // so must use linker groups. - argv = append(argv, "-Wl,--start-group", "-lmingwex", "-lmingw32", "-Wl,--end-group") + if !isMSVC { + // libmingw32 and libmingwex have some inter-dependencies, + // so must use linker groups. + argv = append(argv, "-Wl,--start-group", "-lmingwex", "-lmingw32", "-Wl,--end-group") + } argv = append(argv, peimporteddlls()...) } @@ -2182,6 +2204,7 @@ func trimLinkerArgv(argv []string) []string { "-isysroot", "--sysroot", "-target", + "--target", } prefixesToKeep := []string{ "-f", @@ -2192,6 +2215,7 @@ func trimLinkerArgv(argv []string) []string { "-isysroot", "--sysroot", "-target", + "--target", } var flags []string @@ -3024,3 +3048,19 @@ func (ctxt *Link) findExtLinkTool(toolname string) string { cmdpath := strings.TrimRight(string(out), "\r\n") return cmdpath } + +// isMSVC reports whether the C toolchain is clang with a -msvc target, +// e.g. the clang bundled in MSVC. +func (ctxt *Link) isMSVC() bool { + extld := ctxt.extld() + name, args := extld[0], extld[1:] + args = append(args, trimLinkerArgv(flagExtldflags)...) + args = append(args, "--version") + cmd := exec.Command(name, args...) + if out, err := cmd.CombinedOutput(); err == nil { + if bytes.Contains(out, []byte("-msvc\n")) || bytes.Contains(out, []byte("-msvc\r")) { + return true + } + } + return false +} -- cgit v1.3-5-g45d5 From dc960d0bfeb6ce6abd0cfa2c096476d98e9ec7cd Mon Sep 17 00:00:00 2001 From: Jake Bailey Date: Fri, 5 Sep 2025 20:04:58 -0700 Subject: cmd/compile, reflect: further allow inlining of TypeFor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous CLs optimized direct use of abi.Type, but reflect.Type is indirected, so was not benefiting. For TypeFor, we can use toRType directly without a nil check because the types are statically known. Normally, I'd think SSA would remove the nil check, but due to some oddity (specifically, late fuse being required to remove the nil check, but opt doesn't run that late) means that the nil check persists and gets in the way. Manually writing the code in this instance seems to fix the problem. It also exposed another problem; depending on the ordering, writeType could get to a type symbol before SSA, thereby preventing Extra from being created on the symbol for later lookups that don't go through TypeLinksym directly. In writeType, for non-shape types, call TypeLinksym to ensure that the type is set up for later callers. That change itself passed toolstash -cmp. All up, this stack put through compilecmp shows a lot of improvement in various reflect-using packages, and reflect itself. It is too big to fit in the commit message but here's some info: compilecmp master -> HEAD master (d767064170): cmd/compile: mark abi.PtrType.Elem sym as used HEAD (846a94c568): cmd/compile, reflect: further allow inlining of TypeFor file before after Δ % addr2line 3735911 3735391 -520 -0.014% asm 6382235 6382091 -144 -0.002% buildid 3608568 3608360 -208 -0.006% cgo 5951816 5951480 -336 -0.006% compile 28362080 28339772 -22308 -0.079% cover 6668686 6661414 -7272 -0.109% dist 4311961 4311425 -536 -0.012% fix 3771706 3771474 -232 -0.006% link 8686073 8684993 -1080 -0.012% nm 3715923 3715459 -464 -0.012% objdump 6074366 6073774 -592 -0.010% pack 3025653 3025277 -376 -0.012% pprof 18269485 18261653 -7832 -0.043% test2json 3442726 3438390 -4336 -0.126% trace 16984831 16981767 -3064 -0.018% vet 10701931 10696355 -5576 -0.052% total 133693951 133639075 -54876 -0.041% runtime runtime.stkobjinit 240 -> 165 (-31.25%) runtime [cmd/compile] runtime.stkobjinit 240 -> 165 (-31.25%) reflect reflect.Value.Seq2.func3 309 -> 245 (-20.71%) reflect.Value.Seq2.func1.1 281 -> 198 (-29.54%) reflect.Value.Seq.func1.1 242 -> 165 (-31.82%) reflect.Value.Seq2.func2 360 -> 285 (-20.83%) reflect.Value.Seq.func4 281 -> 239 (-14.95%) reflect.Value.Seq2.func4 399 -> 284 (-28.82%) reflect.Value.Seq.func2 271 -> 230 (-15.13%) reflect.TypeFor[go.shape.uint64] 33 -> 18 (-45.45%) reflect.Value.Seq.func3 219 -> 178 (-18.72%) reflect [cmd/compile] reflect.Value.Seq2.func2 360 -> 285 (-20.83%) reflect.Value.Seq.func4 281 -> 239 (-14.95%) reflect.Value.Seq.func2 271 -> 230 (-15.13%) reflect.Value.Seq.func1.1 242 -> 165 (-31.82%) reflect.Value.Seq2.func1.1 281 -> 198 (-29.54%) reflect.Value.Seq2.func3 309 -> 245 (-20.71%) reflect.Value.Seq.func3 219 -> 178 (-18.72%) reflect.TypeFor[go.shape.uint64] 33 -> 18 (-45.45%) reflect.Value.Seq2.func4 399 -> 284 (-28.82%) fmt fmt.(*pp).fmtBytes 1723 -> 1691 (-1.86%) database/sql/driver reflect.TypeFor[go.shape.interface 33 -> 18 (-45.45%) database/sql/driver.init 72 -> 57 (-20.83%) Change-Id: I9eb750cf0b7ebf532589f939431feb0a899e42ff Reviewed-on: https://go-review.googlesource.com/c/go/+/701301 Reviewed-by: Mark Freeman Reviewed-by: Keith Randall Auto-Submit: Michael Pratt Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/reflectdata/reflect.go | 4 ++++ src/reflect/type.go | 3 ++- test/codegen/reflect_type.go | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/codegen/reflect_type.go (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 2849d4ee40..15173c54dc 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -717,6 +717,10 @@ func writeType(t *types.Type) *obj.LSym { } s.SetSiggen(true) + if !tbase.HasShape() { + TypeLinksym(t) // ensure lsym.Extra is set + } + if !NeedEmit(tbase) { if i := typecheck.BaseTypeIndex(t); i >= 0 { lsym.Pkg = tbase.Sym().Pkg.Prefix diff --git a/src/reflect/type.go b/src/reflect/type.go index cec8662c01..fc6edb1e10 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -1314,7 +1314,8 @@ func TypeOf(i any) Type { // TypeFor returns the [Type] that represents the type argument T. func TypeFor[T any]() Type { - return toType(abi.TypeFor[T]()) + // toRType is safe to use here; type is never nil as T is statically known. + return toRType(abi.TypeFor[T]()) } // rtypeOf directly extracts the *rtype of the provided value. diff --git a/test/codegen/reflect_type.go b/test/codegen/reflect_type.go new file mode 100644 index 0000000000..b92a9567f1 --- /dev/null +++ b/test/codegen/reflect_type.go @@ -0,0 +1,21 @@ +// asmcheck + +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package codegen + +import "reflect" + +func intPtrTypeSize() uintptr { + // amd64:"MOVL\t[$]8,",-"CALL" + // arm64:"MOVD\t[$]8,",-"CALL" + return reflect.TypeFor[*int]().Size() +} + +func intPtrTypeKind() reflect.Kind { + // amd64:"MOVL\t[$]22,",-"CALL" + // arm64:"MOVD\t[$]22,",-"CALL" + return reflect.TypeFor[*int]().Kind() +} -- cgit v1.3-5-g45d5 From f1fd13016ab51b93f5d39b0c46aa8c2b42e8f761 Mon Sep 17 00:00:00 2001 From: Jake Bailey Date: Fri, 5 Sep 2025 14:47:31 -0700 Subject: cmd/compile: optimize abi.Type.GCData loads This fires in just one place; stkframe.go's stkobjinit. But, it does make the struct literal entirely constants. Change-Id: Ice76cb3cddd97adee011fdaab40597839da2e89f Reviewed-on: https://go-review.googlesource.com/c/go/+/701300 Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Mark Freeman Auto-Submit: Michael Pratt --- src/cmd/compile/internal/liveness/plive.go | 2 +- src/cmd/compile/internal/reflectdata/reflect.go | 4 ++-- src/cmd/compile/internal/ssa/rewrite.go | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/liveness/plive.go b/src/cmd/compile/internal/liveness/plive.go index 7e724397dc..9b8f15e9c2 100644 --- a/src/cmd/compile/internal/liveness/plive.go +++ b/src/cmd/compile/internal/liveness/plive.go @@ -1493,7 +1493,7 @@ func (lv *Liveness) emitStackObjects() *obj.LSym { if sz != int64(int32(sz)) { base.Fatalf("stack object too big: %v of type %v, size %d", v, t, sz) } - lsym, ptrBytes := reflectdata.GCSym(t) + lsym, ptrBytes := reflectdata.GCSym(t, false) off = objw.Uint32(x, off, uint32(sz)) off = objw.Uint32(x, off, uint32(ptrBytes)) off = objw.SymPtrOff(x, off, lsym) diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 15173c54dc..38b9391c5f 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -1229,7 +1229,7 @@ func typesStrCmp(a, b typeAndStr) int { // GC information is always a bitmask, never a gc program. // GCSym may be called in concurrent backend, so it does not emit the symbol // content. -func GCSym(t *types.Type) (lsym *obj.LSym, ptrdata int64) { +func GCSym(t *types.Type, onDemandAllowed bool) (lsym *obj.LSym, ptrdata int64) { // Record that we need to emit the GC symbol. gcsymmu.Lock() if _, ok := gcsymset[t]; !ok { @@ -1237,7 +1237,7 @@ func GCSym(t *types.Type) (lsym *obj.LSym, ptrdata int64) { } gcsymmu.Unlock() - lsym, _, ptrdata = dgcsym(t, false, false) + lsym, _, ptrdata = dgcsym(t, false, onDemandAllowed) return } diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 6fb2689d18..6d83ba5653 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -2067,7 +2067,7 @@ func isFixedLoad(v *Value, sym Sym, off int64) bool { for _, f := range rttype.Type.Fields() { if f.Offset == off && copyCompatibleType(v.Type, f.Type) { switch f.Sym.Name { - case "Size_", "PtrBytes", "Hash", "Kind_": + case "Size_", "PtrBytes", "Hash", "Kind_", "GCData": return true default: // fmt.Println("unknown field", f.Sym.Name) @@ -2147,6 +2147,12 @@ func rewriteFixedLoad(v *Value, sym Sym, sb *Value, off int64) *Value { v.reset(OpConst8) v.AuxInt = int64(reflectdata.ABIKindOfType(t)) return v + case "GCData": + gcdata, _ := reflectdata.GCSym(t, true) + v.reset(OpAddr) + v.Aux = symToAux(gcdata) + v.AddArg(sb) + return v default: base.Fatalf("unknown field %s for fixedLoad of %s at offset %d", f.Sym.Name, lsym.Name, off) } -- cgit v1.3-5-g45d5 From 911455fe1893bcd90d30246117415dfbce658d88 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 12 Sep 2025 12:36:38 -0400 Subject: cmd/link: don't count tbss section in TestFlagD TestFlagD looks for a data-like section at the lowest address. On OpenBSD, the .tbss section matches the current condition, which has address 0, causing the test fail. Don't count TLS sections. Also, print the section name on error. Fixes #75444. Change-Id: Ic0aa1a2bb7c6bd5c0023d4482405a482095ff68b Reviewed-on: https://go-review.googlesource.com/c/go/+/703375 Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI --- src/cmd/link/elf_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/link/elf_test.go b/src/cmd/link/elf_test.go index c82eae8866..dc52c091f6 100644 --- a/src/cmd/link/elf_test.go +++ b/src/cmd/link/elf_test.go @@ -627,30 +627,30 @@ func testFlagD(t *testing.T, dataAddr string, roundQuantum string, expectedAddr defer ef.Close() // Find the first data-related section to verify segment placement - var firstDataSectionAddr uint64 - var found bool = false + var firstDataSection *elf.Section for _, sec := range ef.Sections { if sec.Type == elf.SHT_PROGBITS || sec.Type == elf.SHT_NOBITS { // These sections are writable, allocated at runtime, but not executable + // nor TLS. isWrite := sec.Flags&elf.SHF_WRITE != 0 isExec := sec.Flags&elf.SHF_EXECINSTR != 0 isAlloc := sec.Flags&elf.SHF_ALLOC != 0 + isTLS := sec.Flags&elf.SHF_TLS != 0 - if isWrite && !isExec && isAlloc { - addrLower := sec.Addr < firstDataSectionAddr - if !found || addrLower { - firstDataSectionAddr = sec.Addr - found = true + if isWrite && !isExec && isAlloc && !isTLS { + if firstDataSection == nil || sec.Addr < firstDataSection.Addr { + firstDataSection = sec } } } } - if !found { + if firstDataSection == nil { t.Fatalf("can't find any writable data sections") } - if firstDataSectionAddr != expectedAddr { - t.Errorf("data section starts at 0x%x, expected 0x%x", firstDataSectionAddr, expectedAddr) + if firstDataSection.Addr != expectedAddr { + t.Errorf("data section starts at 0x%x for section %s, expected 0x%x", + firstDataSection.Addr, firstDataSection.Name, expectedAddr) } } -- cgit v1.3-5-g45d5 From cc8a6780acf192b0df2ecfab65bd8c2b5ab1f809 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Thu, 11 Sep 2025 14:43:58 -0400 Subject: vendor: update x/tools to 3adf0e9, and other repos Notably, the x/tools update includes CL 702835. Also, pacify copyright_test report of missing copyright header in generated h2_bundle. Updates golang/go#75432 Change-Id: I428278e50dbcef5dcaa661004da0da9ab8f2c924 Reviewed-on: https://go-review.googlesource.com/c/go/+/702955 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov --- src/cmd/go.mod | 12 +- src/cmd/go.sum | 24 +- .../golang.org/x/sys/plan9/pwd_go15_plan9.go | 21 - src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go | 14 +- .../vendor/golang.org/x/sys/unix/affinity_linux.go | 4 +- .../golang.org/x/sys/unix/syscall_solaris.go | 2 +- .../x/sys/unix/zsyscall_solaris_amd64.go | 8 +- .../vendor/golang.org/x/sys/unix/ztypes_linux.go | 41 + .../golang.org/x/sys/windows/types_windows.go | 6 + .../golang.org/x/sys/windows/zsyscall_windows.go | 966 ++++++++++----------- .../x/tools/go/analysis/passes/printf/printf.go | 12 +- .../go/analysis/passes/stdversion/stdversion.go | 6 - .../go/analysis/passes/structtag/structtag.go | 20 +- .../x/tools/go/analysis/unitchecker/unitchecker.go | 10 + .../golang.org/x/tools/go/ast/inspector/cursor.go | 2 +- src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go | 5 +- .../x/tools/go/types/objectpath/objectpath.go | 5 +- .../golang.org/x/tools/go/types/typeutil/map.go | 19 +- .../x/tools/internal/analysisinternal/analysis.go | 64 +- .../golang.org/x/tools/internal/astutil/equal.go | 99 +++ .../golang.org/x/tools/internal/astutil/fields.go | 35 + .../golang.org/x/tools/internal/astutil/purge.go | 72 ++ .../x/tools/internal/astutil/stringlit.go | 59 ++ .../golang.org/x/tools/internal/astutil/unpack.go | 61 ++ .../golang.org/x/tools/internal/astutil/util.go | 74 +- .../golang.org/x/tools/internal/moreiters/iters.go | 47 + src/cmd/vendor/modules.txt | 23 +- src/go.mod | 8 +- src/go.sum | 16 +- src/internal/copyright/copyright_test.go | 2 + .../syscall/windows/registry/zsyscall_windows.go | 14 +- src/internal/syscall/windows/zsyscall_windows.go | 124 +-- src/net/http/h2_bundle.go | 299 ++----- src/syscall/zsyscall_windows.go | 298 +++---- src/vendor/modules.txt | 16 +- 35 files changed, 1376 insertions(+), 1112 deletions(-) delete mode 100644 src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go create mode 100644 src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go (limited to 'src/cmd') diff --git a/src/cmd/go.mod b/src/cmd/go.mod index 98244769b4..e6431c0f20 100644 --- a/src/cmd/go.mod +++ b/src/cmd/go.mod @@ -6,16 +6,16 @@ require ( github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58 golang.org/x/build v0.0.0-20250806225920-b7c66c047964 - golang.org/x/mod v0.27.0 - golang.org/x/sync v0.16.0 - golang.org/x/sys v0.35.0 - golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488 + golang.org/x/mod v0.28.0 + golang.org/x/sync v0.17.0 + golang.org/x/sys v0.36.0 + golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 golang.org/x/term v0.34.0 - golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08 + golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d ) require ( github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.29.0 // indirect rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef // indirect ) diff --git a/src/cmd/go.sum b/src/cmd/go.sum index 606a2d0231..5a70558fe9 100644 --- a/src/cmd/go.sum +++ b/src/cmd/go.sum @@ -10,19 +10,19 @@ golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58 h1:uxPa6+/WsUfzikIAPMqpT golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= golang.org/x/build v0.0.0-20250806225920-b7c66c047964 h1:yRs1K51GKq7hsIO+YHJ8LsslrvwFceNPIv0tYjpcBd0= golang.org/x/build v0.0.0-20250806225920-b7c66c047964/go.mod h1:i9Vx7+aOQUpYJRxSO+OpRStVBCVL/9ccI51xblWm5WY= -golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= -golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= -golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488 h1:3doPGa+Gg4snce233aCWnbZVFsyFMo/dR40KK/6skyE= -golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488/go.mod h1:fGb/2+tgXXjhjHsTNdVEEMZNWA0quBnfrO+AfoDSAKw= +golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= +golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 h1:dHQOQddU4YHS5gY33/6klKjq7Gp3WwMyOXGNp5nzRj8= +golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053/go.mod h1:+nZKN+XVh4LCiA9DV3ywrzN4gumyCnKjau3NGb9SGoE= golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= -golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08 h1:KS/PXsrK6W9NdlNu8iuCiNb7KM8UFwsh8g1BUjJ9rww= -golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08/go.mod h1:n+8pplxVZfXnmHBxWsfPnQRJ5vWroQDk+U2MFpjwtFY= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d h1:ykSs3aFXygx903AtF0IG27E/xLaCW5t85BAdCALyp8s= +golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ= diff --git a/src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go b/src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go deleted file mode 100644 index 73687de748..0000000000 --- a/src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.5 - -package plan9 - -import "syscall" - -func fixwd() { - syscall.Fixwd() -} - -func Getwd() (wd string, err error) { - return syscall.Getwd() -} - -func Chdir(path string) error { - return syscall.Chdir(path) -} diff --git a/src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go b/src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go index fb94582184..7a76489db1 100644 --- a/src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go +++ b/src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go @@ -2,22 +2,18 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.5 - package plan9 +import "syscall" + func fixwd() { + syscall.Fixwd() } func Getwd() (wd string, err error) { - fd, err := open(".", O_RDONLY) - if err != nil { - return "", err - } - defer Close(fd) - return Fd2path(fd) + return syscall.Getwd() } func Chdir(path string) error { - return chdir(path) + return syscall.Chdir(path) } diff --git a/src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go index 6e5c81acd0..3c7a6d6e2f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -38,9 +38,7 @@ func SchedSetaffinity(pid int, set *CPUSet) error { // Zero clears the set s, so that it contains no CPUs. func (s *CPUSet) Zero() { - for i := range s { - s[i] = 0 - } + clear(s[:]) } func cpuBitsIndex(cpu int) int { diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go index abc3955477..18a3d9bdab 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -629,7 +629,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Kill(pid int, signum syscall.Signal) (err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_llisten +//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_listen //sys Lstat(path string, stat *Stat_t) (err error) //sys Madvise(b []byte, advice int) (err error) //sys Mkdir(path string, mode uint32) (err error) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index c6545413c4..b4609c20c2 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -72,7 +72,7 @@ import ( //go:cgo_import_dynamic libc_kill kill "libc.so" //go:cgo_import_dynamic libc_lchown lchown "libc.so" //go:cgo_import_dynamic libc_link link "libc.so" -//go:cgo_import_dynamic libc___xnet_llisten __xnet_llisten "libsocket.so" +//go:cgo_import_dynamic libc___xnet_listen __xnet_listen "libsocket.so" //go:cgo_import_dynamic libc_lstat lstat "libc.so" //go:cgo_import_dynamic libc_madvise madvise "libc.so" //go:cgo_import_dynamic libc_mkdir mkdir "libc.so" @@ -221,7 +221,7 @@ import ( //go:linkname procKill libc_kill //go:linkname procLchown libc_lchown //go:linkname procLink libc_link -//go:linkname proc__xnet_llisten libc___xnet_llisten +//go:linkname proc__xnet_listen libc___xnet_listen //go:linkname procLstat libc_lstat //go:linkname procMadvise libc_madvise //go:linkname procMkdir libc_mkdir @@ -371,7 +371,7 @@ var ( procKill, procLchown, procLink, - proc__xnet_llisten, + proc__xnet_listen, procLstat, procMadvise, procMkdir, @@ -1178,7 +1178,7 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_listen)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go index cd236443f6..944e75a11c 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -632,6 +632,8 @@ const ( IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa + IFAL_LABEL = 0x2 + IFAL_ADDRESS = 0x1 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd @@ -689,6 +691,7 @@ const ( SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 + SizeofIfAddrlblmsg = 0xc SizeofIfaCacheinfo = 0x10 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 @@ -740,6 +743,15 @@ type IfAddrmsg struct { Index uint32 } +type IfAddrlblmsg struct { + Family uint8 + _ uint8 + Prefixlen uint8 + Flags uint8 + Index uint32 + Seq uint32 +} + type IfaCacheinfo struct { Prefered uint32 Valid uint32 @@ -3052,6 +3064,23 @@ const ( ) const ( + TCA_UNSPEC = 0x0 + TCA_KIND = 0x1 + TCA_OPTIONS = 0x2 + TCA_STATS = 0x3 + TCA_XSTATS = 0x4 + TCA_RATE = 0x5 + TCA_FCNT = 0x6 + TCA_STATS2 = 0x7 + TCA_STAB = 0x8 + TCA_PAD = 0x9 + TCA_DUMP_INVISIBLE = 0xa + TCA_CHAIN = 0xb + TCA_HW_OFFLOAD = 0xc + TCA_INGRESS_BLOCK = 0xd + TCA_EGRESS_BLOCK = 0xe + TCA_DUMP_FLAGS = 0xf + TCA_EXT_WARN_MSG = 0x10 RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 @@ -3086,6 +3115,18 @@ const ( RTNLGRP_IPV6_MROUTE_R = 0x1f RTNLGRP_NEXTHOP = 0x20 RTNLGRP_BRVLAN = 0x21 + RTNLGRP_MCTP_IFADDR = 0x22 + RTNLGRP_TUNNEL = 0x23 + RTNLGRP_STATS = 0x24 + RTNLGRP_IPV4_MCADDR = 0x25 + RTNLGRP_IPV6_MCADDR = 0x26 + RTNLGRP_IPV6_ACADDR = 0x27 + TCA_ROOT_UNSPEC = 0x0 + TCA_ROOT_TAB = 0x1 + TCA_ROOT_FLAGS = 0x2 + TCA_ROOT_COUNT = 0x3 + TCA_ROOT_TIME_DELTA = 0x4 + TCA_ROOT_EXT_WARN_MSG = 0x5 ) type CapUserHeader struct { diff --git a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go index 958bcf47a3..993a2297db 100644 --- a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go +++ b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go @@ -1976,6 +1976,12 @@ const ( SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 ) +// FILE_ZERO_DATA_INFORMATION from winioctl.h +type FileZeroDataInformation struct { + FileOffset int64 + BeyondFinalZero int64 +} + const ( ComputerNameNetBIOS = 0 ComputerNameDnsHostname = 1 diff --git a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go index a58bc48b8e..641a5f4b77 100644 --- a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -546,25 +546,25 @@ var ( ) func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0) + r0, _, _ := syscall.SyscallN(procCM_Get_DevNode_Status.Addr(), uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0) + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_ListW.Addr(), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0) + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_List_SizeW.Addr(), uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) { - r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0) + r0, _, _ := syscall.SyscallN(procCM_MapCrToWin32Err.Addr(), uintptr(configRet), uintptr(defaultWin32Error)) ret = Errno(r0) return } @@ -574,7 +574,7 @@ func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, if resetToDefault { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.SyscallN(procAdjustTokenGroups.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -586,7 +586,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok if disableAllPrivileges { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -594,7 +594,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok } func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) + r1, _, e1 := syscall.SyscallN(procAllocateAndInitializeSid.Addr(), uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid))) if r1 == 0 { err = errnoErr(e1) } @@ -602,7 +602,7 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s } func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) + r0, _, _ := syscall.SyscallN(procBuildSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -610,7 +610,7 @@ func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries } func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procChangeServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -618,7 +618,7 @@ func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err err } func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0) + r1, _, e1 := syscall.SyscallN(procChangeServiceConfigW.Addr(), uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName))) if r1 == 0 { err = errnoErr(e1) } @@ -626,7 +626,7 @@ func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, e } func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { - r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) + r1, _, e1 := syscall.SyscallN(procCheckTokenMembership.Addr(), uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { err = errnoErr(e1) } @@ -634,7 +634,7 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( } func CloseServiceHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procCloseServiceHandle.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -642,7 +642,7 @@ func CloseServiceHandle(handle Handle) (err error) { } func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) + r1, _, e1 := syscall.SyscallN(procControlService.Addr(), uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -650,7 +650,7 @@ func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err } func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0) + r1, _, e1 := syscall.SyscallN(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen))) if r1 == 0 { err = errnoErr(e1) } @@ -658,7 +658,7 @@ func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR } func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) + r1, _, e1 := syscall.SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid))) if r1 == 0 { err = errnoErr(e1) } @@ -675,7 +675,7 @@ func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision ui } func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -683,7 +683,7 @@ func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision } func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) + r1, _, e1 := syscall.SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid))) if r1 == 0 { err = errnoErr(e1) } @@ -691,7 +691,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { } func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) + r1, _, e1 := syscall.SyscallN(procCopySid.Addr(), uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) if r1 == 0 { err = errnoErr(e1) } @@ -703,7 +703,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0) + r1, _, e1 := syscall.SyscallN(procCreateProcessAsUserW.Addr(), uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -711,7 +711,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc } func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -720,7 +720,7 @@ func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access } func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreateWellKnownSid.Addr(), uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid))) if r1 == 0 { err = errnoErr(e1) } @@ -728,7 +728,7 @@ func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, s } func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCryptAcquireContextW.Addr(), uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -736,7 +736,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 } func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r1, _, e1 := syscall.SyscallN(procCryptGenRandom.Addr(), uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if r1 == 0 { err = errnoErr(e1) } @@ -744,7 +744,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { } func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCryptReleaseContext.Addr(), uintptr(provhandle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -752,7 +752,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { } func DeleteService(service Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteService.Addr(), uintptr(service)) if r1 == 0 { err = errnoErr(e1) } @@ -760,7 +760,7 @@ func DeleteService(service Handle) (err error) { } func DeregisterEventSource(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeregisterEventSource.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -768,7 +768,7 @@ func DeregisterEventSource(handle Handle) (err error) { } func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { - r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) + r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) if r1 == 0 { err = errnoErr(e1) } @@ -776,7 +776,7 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes } func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumDependentServicesW.Addr(), 6, uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) + r1, _, e1 := syscall.SyscallN(procEnumDependentServicesW.Addr(), uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -784,7 +784,7 @@ func EnumDependentServices(service Handle, activityState uint32, services *ENUM_ } func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) + r1, _, e1 := syscall.SyscallN(procEnumServicesStatusExW.Addr(), uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName))) if r1 == 0 { err = errnoErr(e1) } @@ -792,13 +792,13 @@ func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serv } func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { - r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) + r0, _, _ := syscall.SyscallN(procEqualSid.Addr(), uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2))) isEqual = r0 != 0 return } func FreeSid(sid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeSid.Addr(), uintptr(unsafe.Pointer(sid))) if r1 != 0 { err = errnoErr(e1) } @@ -806,7 +806,7 @@ func FreeSid(sid *SID) (err error) { } func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { - r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + r1, _, e1 := syscall.SyscallN(procGetAce.Addr(), uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) if r1 == 0 { err = errnoErr(e1) } @@ -814,7 +814,7 @@ func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { } func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetLengthSid.Addr(), uintptr(unsafe.Pointer(sid))) len = uint32(r0) return } @@ -829,7 +829,7 @@ func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) + r0, _, _ := syscall.SyscallN(procGetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -837,7 +837,7 @@ func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) if r1 == 0 { err = errnoErr(e1) } @@ -853,7 +853,7 @@ func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl if *daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1))) *daclPresent = _p0 != 0 *daclDefaulted = _p1 != 0 if r1 == 0 { @@ -867,7 +867,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau if *groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) *groupDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -876,7 +876,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau } func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorLength.Addr(), uintptr(unsafe.Pointer(sd))) len = uint32(r0) return } @@ -886,7 +886,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau if *ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) *ownerDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -895,7 +895,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau } func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -911,7 +911,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl if *saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1))) *saclPresent = _p0 != 0 *saclDefaulted = _p1 != 0 if r1 == 0 { @@ -921,7 +921,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl } func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) + r0, _, _ := syscall.SyscallN(procGetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -929,25 +929,25 @@ func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { - r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid))) authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) return } func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(index)) subAuthority = (*uint32)(unsafe.Pointer(r0)) return } func getSidSubAuthorityCount(sid *SID) (count *uint8) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid))) count = (*uint8)(unsafe.Pointer(r0)) return } func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) + r1, _, e1 := syscall.SyscallN(procGetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen))) if r1 == 0 { err = errnoErr(e1) } @@ -955,7 +955,7 @@ func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) + r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel)) if r1 == 0 { err = errnoErr(e1) } @@ -963,7 +963,7 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) { } func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { - r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) + r1, _, e1 := syscall.SyscallN(procInitializeSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision)) if r1 == 0 { err = errnoErr(e1) } @@ -979,7 +979,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint if rebootAfterShutdown { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) + r1, _, e1 := syscall.SyscallN(procInitiateSystemShutdownExW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) if r1 == 0 { err = errnoErr(e1) } @@ -987,7 +987,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint } func isTokenRestricted(tokenHandle Token) (ret bool, err error) { - r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procIsTokenRestricted.Addr(), uintptr(tokenHandle)) ret = r0 != 0 if !ret { err = errnoErr(e1) @@ -996,25 +996,25 @@ func isTokenRestricted(tokenHandle Token) (ret bool, err error) { } func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) + r0, _, _ := syscall.SyscallN(procIsValidSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(sd))) isValid = r0 != 0 return } func isValidSid(sid *SID) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid))) isValid = r0 != 0 return } func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { - r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) + r0, _, _ := syscall.SyscallN(procIsWellKnownSid.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(sidType)) isWellKnown = r0 != 0 return } func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := syscall.SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -1022,7 +1022,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen } func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := syscall.SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -1030,7 +1030,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 } func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) if r1 == 0 { err = errnoErr(e1) } @@ -1038,7 +1038,7 @@ func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err err } func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0) + r1, _, e1 := syscall.SyscallN(procMakeAbsoluteSD.Addr(), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize))) if r1 == 0 { err = errnoErr(e1) } @@ -1046,7 +1046,7 @@ func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DE } func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) + r1, _, e1 := syscall.SyscallN(procMakeSelfRelativeSD.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) if r1 == 0 { err = errnoErr(e1) } @@ -1054,7 +1054,7 @@ func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURIT } func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { - r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) + r0, _, _ := syscall.SyscallN(procNotifyServiceStatusChangeW.Addr(), uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1062,7 +1062,7 @@ func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERV } func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.SyscallN(procOpenProcessToken.Addr(), uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -1070,7 +1070,7 @@ func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { } func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1079,7 +1079,7 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha } func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1092,7 +1092,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token if openAsSelf { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) + r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -1100,7 +1100,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token } func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1108,7 +1108,7 @@ func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize } func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceConfigW.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1120,7 +1120,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf if err != nil { return } - r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) + r1, _, e1 := syscall.SyscallN(procQueryServiceDynamicInformation.Addr(), uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) if r1 == 0 { err = errnoErr(e1) } @@ -1128,7 +1128,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf } func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceLockStatusW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1136,7 +1136,7 @@ func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, b } func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -1144,7 +1144,7 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { } func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceStatusEx.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1152,7 +1152,7 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize } func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) + r0, _, _ := syscall.SyscallN(procRegCloseKey.Addr(), uintptr(key)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1160,7 +1160,7 @@ func RegCloseKey(key Handle) (regerrno error) { } func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) + r0, _, _ := syscall.SyscallN(procRegEnumKeyExW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1176,7 +1176,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, if asynchronous { _p1 = 1 } - r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0) + r0, _, _ := syscall.SyscallN(procRegNotifyChangeKeyValue.Addr(), uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1184,7 +1184,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, } func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) + r0, _, _ := syscall.SyscallN(procRegOpenKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1192,7 +1192,7 @@ func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint } func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) + r0, _, _ := syscall.SyscallN(procRegQueryInfoKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1200,7 +1200,7 @@ func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint } func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + r0, _, _ := syscall.SyscallN(procRegQueryValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1208,7 +1208,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 } func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) + r0, _, e1 := syscall.SyscallN(procRegisterEventSourceW.Addr(), uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1217,7 +1217,7 @@ func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Hand } func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procRegisterServiceCtrlHandlerExW.Addr(), 3, uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) + r0, _, e1 := syscall.SyscallN(procRegisterServiceCtrlHandlerExW.Addr(), uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1226,7 +1226,7 @@ func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, cont } func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) + r1, _, e1 := syscall.SyscallN(procReportEventW.Addr(), uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) if r1 == 0 { err = errnoErr(e1) } @@ -1234,7 +1234,7 @@ func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrS } func RevertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) if r1 == 0 { err = errnoErr(e1) } @@ -1242,7 +1242,7 @@ func RevertToSelf() (err error) { } func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { - r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetEntriesInAclW.Addr(), uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1250,7 +1250,7 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE } func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { - r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) + r1, _, e1 := syscall.SyscallN(procSetKernelObjectSecurity.Addr(), uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { err = errnoErr(e1) } @@ -1267,7 +1267,7 @@ func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1275,7 +1275,7 @@ func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) if r1 == 0 { err = errnoErr(e1) } @@ -1291,7 +1291,7 @@ func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl * if daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1)) if r1 == 0 { err = errnoErr(e1) } @@ -1303,7 +1303,7 @@ func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaul if groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1315,7 +1315,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul if ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1323,7 +1323,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul } func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { - syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) + syscall.SyscallN(procSetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) return } @@ -1336,7 +1336,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * if saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1)) if r1 == 0 { err = errnoErr(e1) } @@ -1344,7 +1344,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * } func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1352,7 +1352,7 @@ func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) + r1, _, e1 := syscall.SyscallN(procSetServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceStatus))) if r1 == 0 { err = errnoErr(e1) } @@ -1360,7 +1360,7 @@ func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) } func SetThreadToken(thread *Handle, token Token) (err error) { - r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) + r1, _, e1 := syscall.SyscallN(procSetThreadToken.Addr(), uintptr(unsafe.Pointer(thread)), uintptr(token)) if r1 == 0 { err = errnoErr(e1) } @@ -1368,7 +1368,7 @@ func SetThreadToken(thread *Handle, token Token) (err error) { } func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen)) if r1 == 0 { err = errnoErr(e1) } @@ -1376,7 +1376,7 @@ func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) + r1, _, e1 := syscall.SyscallN(procStartServiceCtrlDispatcherW.Addr(), uintptr(unsafe.Pointer(serviceTable))) if r1 == 0 { err = errnoErr(e1) } @@ -1384,7 +1384,7 @@ func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { } func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) + r1, _, e1 := syscall.SyscallN(procStartServiceW.Addr(), uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) if r1 == 0 { err = errnoErr(e1) } @@ -1392,7 +1392,7 @@ func StartService(service Handle, numArgs uint32, argVectors **uint16) (err erro } func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertAddCertificateContextToStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext))) if r1 == 0 { err = errnoErr(e1) } @@ -1400,7 +1400,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad } func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCertCloseStore.Addr(), uintptr(store), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -1408,7 +1408,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { } func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) + r0, _, e1 := syscall.SyscallN(procCertCreateCertificateContext.Addr(), uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1417,7 +1417,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en } func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertDeleteCertificateFromStore.Addr(), uintptr(unsafe.Pointer(certContext))) if r1 == 0 { err = errnoErr(e1) } @@ -1425,13 +1425,13 @@ func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { } func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) { - r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) + r0, _, _ := syscall.SyscallN(procCertDuplicateCertificateContext.Addr(), uintptr(unsafe.Pointer(certContext))) dupContext = (*CertContext)(unsafe.Pointer(r0)) return } func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) + r0, _, e1 := syscall.SyscallN(procCertEnumCertificatesInStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(prevContext))) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1440,7 +1440,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex } func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { - r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) + r0, _, e1 := syscall.SyscallN(procCertFindCertificateInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) cert = (*CertContext)(unsafe.Pointer(r0)) if cert == nil { err = errnoErr(e1) @@ -1449,7 +1449,7 @@ func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags } func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { - r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) + r0, _, e1 := syscall.SyscallN(procCertFindChainInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) certchain = (*CertChainContext)(unsafe.Pointer(r0)) if certchain == nil { err = errnoErr(e1) @@ -1458,18 +1458,18 @@ func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint3 } func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { - r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) + r0, _, _ := syscall.SyscallN(procCertFindExtension.Addr(), uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) ret = (*CertExtension)(unsafe.Pointer(r0)) return } func CertFreeCertificateChain(ctx *CertChainContext) { - syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + syscall.SyscallN(procCertFreeCertificateChain.Addr(), uintptr(unsafe.Pointer(ctx))) return } func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertFreeCertificateContext.Addr(), uintptr(unsafe.Pointer(ctx))) if r1 == 0 { err = errnoErr(e1) } @@ -1477,7 +1477,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { } func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) + r1, _, e1 := syscall.SyscallN(procCertGetCertificateChain.Addr(), uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx))) if r1 == 0 { err = errnoErr(e1) } @@ -1485,13 +1485,13 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a } func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) { - r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) + r0, _, _ := syscall.SyscallN(procCertGetNameStringW.Addr(), uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) chars = uint32(r0) return } func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) + r0, _, e1 := syscall.SyscallN(procCertOpenStore.Addr(), uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1500,7 +1500,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr } func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := syscall.SyscallN(procCertOpenSystemStoreW.Addr(), uintptr(hprov), uintptr(unsafe.Pointer(name))) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1509,7 +1509,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { } func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertVerifyCertificateChainPolicy.Addr(), uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -1521,7 +1521,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete if *callerFreeProvOrNCryptKey { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procCryptAcquireCertificatePrivateKey.Addr(), uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) *callerFreeProvOrNCryptKey = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -1530,7 +1530,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete } func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptDecodeObject.Addr(), uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen))) if r1 == 0 { err = errnoErr(e1) } @@ -1538,7 +1538,7 @@ func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte } func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptProtectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) if r1 == 0 { err = errnoErr(e1) } @@ -1546,7 +1546,7 @@ func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, } func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0) + r1, _, e1 := syscall.SyscallN(procCryptQueryObject.Addr(), uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context))) if r1 == 0 { err = errnoErr(e1) } @@ -1554,7 +1554,7 @@ func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentT } func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptUnprotectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) if r1 == 0 { err = errnoErr(e1) } @@ -1562,7 +1562,7 @@ func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBl } func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procPFXImportCertStore.Addr(), uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1571,7 +1571,7 @@ func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (sto } func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) + r0, _, _ := syscall.SyscallN(procDnsNameCompare_W.Addr(), uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2))) same = r0 != 0 return } @@ -1586,7 +1586,7 @@ func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSR } func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + r0, _, _ := syscall.SyscallN(procDnsQuery_W.Addr(), uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) if r0 != 0 { status = syscall.Errno(r0) } @@ -1594,12 +1594,12 @@ func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DN } func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) + syscall.SyscallN(procDnsRecordListFree.Addr(), uintptr(unsafe.Pointer(rl)), uintptr(freetype)) return } func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.Syscall6(procDwmGetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) + r0, _, _ := syscall.SyscallN(procDwmGetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1607,7 +1607,7 @@ func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.Syscall6(procDwmSetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) + r0, _, _ := syscall.SyscallN(procDwmSetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1615,7 +1615,7 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { - r0, _, _ := syscall.Syscall(procCancelMibChangeNotify2.Addr(), 1, uintptr(notificationHandle), 0, 0) + r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle)) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1623,7 +1623,7 @@ func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { } func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) + r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1631,7 +1631,7 @@ func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapter } func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) + r0, _, _ := syscall.SyscallN(procGetAdaptersInfo.Addr(), uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1639,7 +1639,7 @@ func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { } func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetBestInterfaceEx.Addr(), 2, uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex)), 0) + r0, _, _ := syscall.SyscallN(procGetBestInterfaceEx.Addr(), uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1647,7 +1647,7 @@ func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcod } func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetIfEntry.Addr(), uintptr(unsafe.Pointer(pIfRow))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1655,7 +1655,7 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { } func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry2Ex.Addr(), 2, uintptr(level), uintptr(unsafe.Pointer(row)), 0) + r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1663,7 +1663,7 @@ func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { } func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1675,7 +1675,7 @@ func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsa if initialNotification { _p0 = 1 } - r0, _, _ := syscall.Syscall6(procNotifyIpInterfaceChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) + r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1687,7 +1687,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext if initialNotification { _p0 = 1 } - r0, _, _ := syscall.Syscall6(procNotifyUnicastIpAddressChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) + r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1695,7 +1695,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext } func AddDllDirectory(path *uint16) (cookie uintptr, err error) { - r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r0, _, e1 := syscall.SyscallN(procAddDllDirectory.Addr(), uintptr(unsafe.Pointer(path))) cookie = uintptr(r0) if cookie == 0 { err = errnoErr(e1) @@ -1704,7 +1704,7 @@ func AddDllDirectory(path *uint16) (cookie uintptr, err error) { } func AssignProcessToJobObject(job Handle, process Handle) (err error) { - r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) + r1, _, e1 := syscall.SyscallN(procAssignProcessToJobObject.Addr(), uintptr(job), uintptr(process)) if r1 == 0 { err = errnoErr(e1) } @@ -1712,7 +1712,7 @@ func AssignProcessToJobObject(job Handle, process Handle) (err error) { } func CancelIo(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := syscall.SyscallN(procCancelIo.Addr(), uintptr(s)) if r1 == 0 { err = errnoErr(e1) } @@ -1720,7 +1720,7 @@ func CancelIo(s Handle) (err error) { } func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) + r1, _, e1 := syscall.SyscallN(procCancelIoEx.Addr(), uintptr(s), uintptr(unsafe.Pointer(o))) if r1 == 0 { err = errnoErr(e1) } @@ -1728,7 +1728,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { } func ClearCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procClearCommBreak.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1736,7 +1736,7 @@ func ClearCommBreak(handle Handle) (err error) { } func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) { - r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) + r1, _, e1 := syscall.SyscallN(procClearCommError.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) if r1 == 0 { err = errnoErr(e1) } @@ -1744,7 +1744,7 @@ func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error } func CloseHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procCloseHandle.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1752,12 +1752,12 @@ func CloseHandle(handle Handle) (err error) { } func ClosePseudoConsole(console Handle) { - syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0) + syscall.SyscallN(procClosePseudoConsole.Addr(), uintptr(console)) return } func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procConnectNamedPipe.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1765,7 +1765,7 @@ func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { } func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) + r1, _, e1 := syscall.SyscallN(procCreateDirectoryW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa))) if r1 == 0 { err = errnoErr(e1) } @@ -1773,7 +1773,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { } func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateEventExW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1782,7 +1782,7 @@ func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, d } func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1791,7 +1791,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat } func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procCreateFileMappingW.Addr(), uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1800,7 +1800,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS } func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1809,7 +1809,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes } func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procCreateHardLinkW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1817,7 +1817,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr } func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1826,7 +1826,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, thr } func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := syscall.SyscallN(procCreateJobObjectW.Addr(), uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1835,7 +1835,7 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, } func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateMutexExW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1848,7 +1848,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 if initialOwner { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procCreateMutexW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1857,7 +1857,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 } func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) + r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1866,7 +1866,7 @@ func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances u } func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreatePipe.Addr(), uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -1878,7 +1878,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreateProcessW.Addr(), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -1886,7 +1886,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA } func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { - r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0) + r0, _, _ := syscall.SyscallN(procCreatePseudoConsole.Addr(), uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole))) if r0 != 0 { hr = syscall.Errno(r0) } @@ -1894,7 +1894,7 @@ func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pcons } func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procCreateSymbolicLinkW.Addr(), uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1902,7 +1902,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u } func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) + r0, _, e1 := syscall.SyscallN(procCreateToolhelp32Snapshot.Addr(), uintptr(flags), uintptr(processId)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1911,7 +1911,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er } func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) + r1, _, e1 := syscall.SyscallN(procDefineDosDeviceW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { err = errnoErr(e1) } @@ -1919,7 +1919,7 @@ func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err } func DeleteFile(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteFileW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -1927,12 +1927,12 @@ func DeleteFile(path *uint16) (err error) { } func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { - syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) + syscall.SyscallN(procDeleteProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist))) return } func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint))) if r1 == 0 { err = errnoErr(e1) } @@ -1940,7 +1940,7 @@ func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { } func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procDeviceIoControl.Addr(), uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1948,7 +1948,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff } func DisconnectNamedPipe(pipe Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0) + r1, _, e1 := syscall.SyscallN(procDisconnectNamedPipe.Addr(), uintptr(pipe)) if r1 == 0 { err = errnoErr(e1) } @@ -1960,7 +1960,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP if bInheritHandle { _p0 = 1 } - r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) + r1, _, e1 := syscall.SyscallN(procDuplicateHandle.Addr(), uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions)) if r1 == 0 { err = errnoErr(e1) } @@ -1968,7 +1968,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP } func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { - r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0) + r1, _, e1 := syscall.SyscallN(procEscapeCommFunction.Addr(), uintptr(handle), uintptr(dwFunc)) if r1 == 0 { err = errnoErr(e1) } @@ -1976,12 +1976,12 @@ func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { } func ExitProcess(exitcode uint32) { - syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) + syscall.SyscallN(procExitProcess.Addr(), uintptr(exitcode)) return } func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -1990,7 +1990,7 @@ func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, } func FindClose(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindClose.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1998,7 +1998,7 @@ func FindClose(handle Handle) (err error) { } func FindCloseChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindCloseChangeNotification.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2019,7 +2019,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter if watchSubtree { _p1 = 1 } - r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) + r0, _, e1 := syscall.SyscallN(procFindFirstChangeNotificationW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2028,7 +2028,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter } func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) + r0, _, e1 := syscall.SyscallN(procFindFirstFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data))) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2037,7 +2037,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro } func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2046,7 +2046,7 @@ func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, b } func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2055,7 +2055,7 @@ func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, er } func FindNextChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindNextChangeNotification.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2063,7 +2063,7 @@ func FindNextChangeNotification(handle Handle) (err error) { } func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := syscall.SyscallN(procFindNextFileW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -2071,7 +2071,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { } func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procFindNextVolumeMountPointW.Addr(), uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2079,7 +2079,7 @@ func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uin } func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procFindNextVolumeW.Addr(), uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2087,7 +2087,7 @@ func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) } func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType)) + r0, _, e1 := syscall.SyscallN(procFindResourceW.Addr(), uintptr(module), uintptr(name), uintptr(resType)) resInfo = Handle(r0) if resInfo == 0 { err = errnoErr(e1) @@ -2096,7 +2096,7 @@ func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, } func FindVolumeClose(findVolume Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindVolumeClose.Addr(), uintptr(findVolume)) if r1 == 0 { err = errnoErr(e1) } @@ -2104,7 +2104,7 @@ func FindVolumeClose(findVolume Handle) (err error) { } func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindVolumeMountPointClose.Addr(), uintptr(findVolumeMountPoint)) if r1 == 0 { err = errnoErr(e1) } @@ -2112,7 +2112,7 @@ func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { } func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFlushFileBuffers.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2120,7 +2120,7 @@ func FlushFileBuffers(handle Handle) (err error) { } func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procFlushViewOfFile.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -2132,7 +2132,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) + r0, _, e1 := syscall.SyscallN(procFormatMessageW.Addr(), uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2141,7 +2141,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu } func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(envs))) if r1 == 0 { err = errnoErr(e1) } @@ -2149,7 +2149,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { } func FreeLibrary(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeLibrary.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2157,7 +2157,7 @@ func FreeLibrary(handle Handle) (err error) { } func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) + r1, _, e1 := syscall.SyscallN(procGenerateConsoleCtrlEvent.Addr(), uintptr(ctrlEvent), uintptr(processGroupID)) if r1 == 0 { err = errnoErr(e1) } @@ -2165,19 +2165,19 @@ func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err erro } func GetACP() (acp uint32) { - r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetACP.Addr()) acp = uint32(r0) return } func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) + r0, _, _ := syscall.SyscallN(procGetActiveProcessorCount.Addr(), uintptr(groupNumber)) ret = uint32(r0) return } func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommModemStatus.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpModemStat))) if r1 == 0 { err = errnoErr(e1) } @@ -2185,7 +2185,7 @@ func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { } func GetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) if r1 == 0 { err = errnoErr(e1) } @@ -2193,7 +2193,7 @@ func GetCommState(handle Handle, lpDCB *DCB) (err error) { } func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) if r1 == 0 { err = errnoErr(e1) } @@ -2201,13 +2201,13 @@ func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func GetCommandLine() (cmd *uint16) { - r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCommandLineW.Addr()) cmd = (*uint16)(unsafe.Pointer(r0)) return } func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -2215,7 +2215,7 @@ func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { } func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) + r1, _, e1 := syscall.SyscallN(procGetComputerNameW.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -2223,7 +2223,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { } func GetConsoleCP() (cp uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetConsoleCP.Addr()) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2232,7 +2232,7 @@ func GetConsoleCP() (cp uint32, err error) { } func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) + r1, _, e1 := syscall.SyscallN(procGetConsoleMode.Addr(), uintptr(console), uintptr(unsafe.Pointer(mode))) if r1 == 0 { err = errnoErr(e1) } @@ -2240,7 +2240,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { } func GetConsoleOutputCP() (cp uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetConsoleOutputCP.Addr()) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2249,7 +2249,7 @@ func GetConsoleOutputCP() (cp uint32, err error) { } func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) + r1, _, e1 := syscall.SyscallN(procGetConsoleScreenBufferInfo.Addr(), uintptr(console), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -2257,7 +2257,7 @@ func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) ( } func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := syscall.SyscallN(procGetCurrentDirectoryW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2266,19 +2266,19 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { } func GetCurrentProcessId() (pid uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCurrentProcessId.Addr()) pid = uint32(r0) return } func GetCurrentThreadId() (id uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCurrentThreadId.Addr()) id = uint32(r0) return } func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { - r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetDiskFreeSpaceExW.Addr(), uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes))) if r1 == 0 { err = errnoErr(e1) } @@ -2286,13 +2286,13 @@ func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint6 } func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetDriveTypeW.Addr(), uintptr(unsafe.Pointer(rootPathName))) driveType = uint32(r0) return } func GetEnvironmentStrings() (envs *uint16, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetEnvironmentStringsW.Addr()) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { err = errnoErr(e1) @@ -2301,7 +2301,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { } func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procGetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2310,7 +2310,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 } func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) + r1, _, e1 := syscall.SyscallN(procGetExitCodeProcess.Addr(), uintptr(handle), uintptr(unsafe.Pointer(exitcode))) if r1 == 0 { err = errnoErr(e1) } @@ -2318,7 +2318,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { } func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procGetFileAttributesExW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -2326,7 +2326,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { } func GetFileAttributes(name *uint16) (attrs uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name))) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { err = errnoErr(e1) @@ -2335,7 +2335,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { } func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandle.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -2343,7 +2343,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e } func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen)) if r1 == 0 { err = errnoErr(e1) } @@ -2351,7 +2351,7 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, } func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) if r1 == 0 { err = errnoErr(e1) } @@ -2359,7 +2359,7 @@ func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFileType.Addr(), uintptr(filehandle)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2368,7 +2368,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { } func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2377,7 +2377,7 @@ func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32 } func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFullPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2386,13 +2386,13 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( } func GetLargePageMinimum() (size uintptr) { - r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetLargePageMinimum.Addr()) size = uintptr(r0) return } func GetLastError() (lasterr error) { - r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetLastError.Addr()) if r0 != 0 { lasterr = syscall.Errno(r0) } @@ -2400,7 +2400,7 @@ func GetLastError() (lasterr error) { } func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) + r0, _, e1 := syscall.SyscallN(procGetLogicalDriveStringsW.Addr(), uintptr(bufferLength), uintptr(unsafe.Pointer(buffer))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2409,7 +2409,7 @@ func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err } func GetLogicalDrives() (drivesBitMask uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetLogicalDrives.Addr()) drivesBitMask = uint32(r0) if drivesBitMask == 0 { err = errnoErr(e1) @@ -2418,7 +2418,7 @@ func GetLogicalDrives() (drivesBitMask uint32, err error) { } func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) + r0, _, e1 := syscall.SyscallN(procGetLongPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2427,13 +2427,13 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er } func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) + r0, _, _ := syscall.SyscallN(procGetMaximumProcessorCount.Addr(), uintptr(groupNumber)) ret = uint32(r0) return } func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2442,7 +2442,7 @@ func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, } func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { - r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) + r1, _, e1 := syscall.SyscallN(procGetModuleHandleExW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) if r1 == 0 { err = errnoErr(e1) } @@ -2450,7 +2450,7 @@ func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err er } func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetNamedPipeClientProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeClientProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID))) if r1 == 0 { err = errnoErr(e1) } @@ -2458,7 +2458,7 @@ func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err erro } func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeHandleStateW.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2466,7 +2466,7 @@ func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, m } func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeInfo.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances))) if r1 == 0 { err = errnoErr(e1) } @@ -2474,7 +2474,7 @@ func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint3 } func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetNamedPipeServerProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeServerProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID))) if r1 == 0 { err = errnoErr(e1) } @@ -2486,7 +2486,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -2494,7 +2494,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa } func GetPriorityClass(process Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetPriorityClass.Addr(), uintptr(process)) ret = uint32(r0) if ret == 0 { err = errnoErr(e1) @@ -2512,7 +2512,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { } func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) + r0, _, e1 := syscall.SyscallN(procGetProcAddress.Addr(), uintptr(module), uintptr(unsafe.Pointer(procname))) proc = uintptr(r0) if proc == 0 { err = errnoErr(e1) @@ -2521,7 +2521,7 @@ func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { } func GetProcessId(process Handle) (id uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetProcessId.Addr(), uintptr(process)) id = uint32(r0) if id == 0 { err = errnoErr(e1) @@ -2530,7 +2530,7 @@ func GetProcessId(process Handle) (id uint32, err error) { } func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetProcessPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2538,7 +2538,7 @@ func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uin } func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) + r1, _, e1 := syscall.SyscallN(procGetProcessShutdownParameters.Addr(), uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags))) if r1 == 0 { err = errnoErr(e1) } @@ -2546,7 +2546,7 @@ func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { } func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) + r1, _, e1 := syscall.SyscallN(procGetProcessTimes.Addr(), uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) if r1 == 0 { err = errnoErr(e1) } @@ -2554,12 +2554,12 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, } func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { - syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0) + syscall.SyscallN(procGetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags))) return } func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) + r1, _, e1 := syscall.SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout)) if r1 == 0 { err = errnoErr(e1) } @@ -2567,7 +2567,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overl } func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + r0, _, e1 := syscall.SyscallN(procGetShortPathNameW.Addr(), uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2576,12 +2576,12 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin } func getStartupInfo(startupInfo *StartupInfo) { - syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) + syscall.SyscallN(procGetStartupInfoW.Addr(), uintptr(unsafe.Pointer(startupInfo))) return } func GetStdHandle(stdhandle uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetStdHandle.Addr(), uintptr(stdhandle)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2590,7 +2590,7 @@ func GetStdHandle(stdhandle uint32) (handle Handle, err error) { } func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetSystemDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2599,7 +2599,7 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSystemPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2607,17 +2607,17 @@ func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func GetSystemTimeAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + syscall.SyscallN(procGetSystemTimeAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) return } func GetSystemTimePreciseAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + syscall.SyscallN(procGetSystemTimePreciseAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) return } func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetSystemWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2626,7 +2626,7 @@ func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err erro } func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := syscall.SyscallN(procGetTempPathW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2635,7 +2635,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { } func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetThreadPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2643,13 +2643,13 @@ func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func getTickCount64() (ms uint64) { - r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetTickCount64.Addr()) ms = uint64(r0) return } func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetTimeZoneInformation.Addr(), uintptr(unsafe.Pointer(tzi))) rc = uint32(r0) if rc == 0xffffffff { err = errnoErr(e1) @@ -2658,7 +2658,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { } func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetUserPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2666,7 +2666,7 @@ func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16 } func GetVersion() (ver uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetVersion.Addr()) ver = uint32(r0) if ver == 0 { err = errnoErr(e1) @@ -2675,7 +2675,7 @@ func GetVersion() (ver uint32, err error) { } func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2683,7 +2683,7 @@ func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeN } func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2691,7 +2691,7 @@ func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volume } func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) + r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { err = errnoErr(e1) } @@ -2699,7 +2699,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint } func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procGetVolumePathNameW.Addr(), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2707,7 +2707,7 @@ func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength ui } func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetVolumePathNamesForVolumeNameW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength))) if r1 == 0 { err = errnoErr(e1) } @@ -2715,7 +2715,7 @@ func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16 } func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2724,7 +2724,7 @@ func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procInitializeProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -2736,7 +2736,7 @@ func IsWow64Process(handle Handle, isWow64 *bool) (err error) { if *isWow64 { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) + r1, _, e1 := syscall.SyscallN(procIsWow64Process.Addr(), uintptr(handle), uintptr(unsafe.Pointer(&_p0))) *isWow64 = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -2749,7 +2749,7 @@ func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint1 if err != nil { return } - r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) + r1, _, e1 := syscall.SyscallN(procIsWow64Process2.Addr(), uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) if r1 == 0 { err = errnoErr(e1) } @@ -2766,7 +2766,7 @@ func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, e } func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procLoadLibraryExW.Addr(), uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2784,7 +2784,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { } func _LoadLibrary(libname *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) + r0, _, e1 := syscall.SyscallN(procLoadLibraryW.Addr(), uintptr(unsafe.Pointer(libname))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2793,7 +2793,7 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { } func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + r0, _, e1 := syscall.SyscallN(procLoadResource.Addr(), uintptr(module), uintptr(resInfo)) resData = Handle(r0) if resData == 0 { err = errnoErr(e1) @@ -2802,7 +2802,7 @@ func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { } func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { - r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) + r0, _, e1 := syscall.SyscallN(procLocalAlloc.Addr(), uintptr(flags), uintptr(length)) ptr = uintptr(r0) if ptr == 0 { err = errnoErr(e1) @@ -2811,7 +2811,7 @@ func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { } func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) + r0, _, e1 := syscall.SyscallN(procLocalFree.Addr(), uintptr(hmem)) handle = Handle(r0) if handle != 0 { err = errnoErr(e1) @@ -2820,7 +2820,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { } func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -2828,7 +2828,7 @@ func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, byt } func LockResource(resData Handle) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0) + r0, _, e1 := syscall.SyscallN(procLockResource.Addr(), uintptr(resData)) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2837,7 +2837,7 @@ func LockResource(resData Handle) (addr uintptr, err error) { } func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) + r0, _, e1 := syscall.SyscallN(procMapViewOfFile.Addr(), uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length)) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2846,7 +2846,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui } func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2854,7 +2854,7 @@ func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2862,7 +2862,7 @@ func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -2870,7 +2870,7 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { } func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) + r1, _, e1 := syscall.SyscallN(procMoveFileW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to))) if r1 == 0 { err = errnoErr(e1) } @@ -2878,7 +2878,7 @@ func MoveFile(from *uint16, to *uint16) (err error) { } func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) nwrite = int32(r0) if nwrite == 0 { err = errnoErr(e1) @@ -2891,7 +2891,7 @@ func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procOpenEventW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2904,7 +2904,7 @@ func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procOpenMutexW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2917,7 +2917,7 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) + r0, _, e1 := syscall.SyscallN(procOpenProcess.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2930,7 +2930,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) + r0, _, e1 := syscall.SyscallN(procOpenThread.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2939,7 +2939,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand } func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) + r1, _, e1 := syscall.SyscallN(procPostQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -2947,7 +2947,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overla } func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := syscall.SyscallN(procProcess32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2955,7 +2955,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := syscall.SyscallN(procProcess32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2963,7 +2963,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0) + r1, _, e1 := syscall.SyscallN(procProcessIdToSessionId.Addr(), uintptr(pid), uintptr(unsafe.Pointer(sessionid))) if r1 == 0 { err = errnoErr(e1) } @@ -2971,7 +2971,7 @@ func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { } func PulseEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procPulseEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -2979,7 +2979,7 @@ func PulseEvent(event Handle) (err error) { } func PurgeComm(handle Handle, dwFlags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0) + r1, _, e1 := syscall.SyscallN(procPurgeComm.Addr(), uintptr(handle), uintptr(dwFlags)) if r1 == 0 { err = errnoErr(e1) } @@ -2987,7 +2987,7 @@ func PurgeComm(handle Handle, dwFlags uint32) (err error) { } func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) + r0, _, e1 := syscall.SyscallN(procQueryDosDeviceW.Addr(), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2996,7 +2996,7 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 } func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryFullProcessImageNameW.Addr(), uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -3004,7 +3004,7 @@ func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size } func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) + r1, _, e1 := syscall.SyscallN(procQueryInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen))) if r1 == 0 { err = errnoErr(e1) } @@ -3012,7 +3012,7 @@ func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobO } func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) + r1, _, e1 := syscall.SyscallN(procReadConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl))) if r1 == 0 { err = errnoErr(e1) } @@ -3024,7 +3024,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree if watchSubTree { _p0 = 1 } - r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) + r1, _, e1 := syscall.SyscallN(procReadDirectoryChangesW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == 0 { err = errnoErr(e1) } @@ -3036,7 +3036,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procReadFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3044,7 +3044,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( } func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0) + r1, _, e1 := syscall.SyscallN(procReadProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead))) if r1 == 0 { err = errnoErr(e1) } @@ -3052,7 +3052,7 @@ func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size u } func ReleaseMutex(mutex Handle) (err error) { - r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) + r1, _, e1 := syscall.SyscallN(procReleaseMutex.Addr(), uintptr(mutex)) if r1 == 0 { err = errnoErr(e1) } @@ -3060,7 +3060,7 @@ func ReleaseMutex(mutex Handle) (err error) { } func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procRemoveDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3068,7 +3068,7 @@ func RemoveDirectory(path *uint16) (err error) { } func RemoveDllDirectory(cookie uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0) + r1, _, e1 := syscall.SyscallN(procRemoveDllDirectory.Addr(), uintptr(cookie)) if r1 == 0 { err = errnoErr(e1) } @@ -3076,7 +3076,7 @@ func RemoveDllDirectory(cookie uintptr) (err error) { } func ResetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procResetEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -3084,7 +3084,7 @@ func ResetEvent(event Handle) (err error) { } func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { - r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0) + r0, _, _ := syscall.SyscallN(procResizePseudoConsole.Addr(), uintptr(pconsole), uintptr(size)) if r0 != 0 { hr = syscall.Errno(r0) } @@ -3092,7 +3092,7 @@ func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { } func ResumeThread(thread Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) + r0, _, e1 := syscall.SyscallN(procResumeThread.Addr(), uintptr(thread)) ret = uint32(r0) if ret == 0xffffffff { err = errnoErr(e1) @@ -3101,7 +3101,7 @@ func ResumeThread(thread Handle) (ret uint32, err error) { } func SetCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetCommBreak.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3109,7 +3109,7 @@ func SetCommBreak(handle Handle) (err error) { } func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0) + r1, _, e1 := syscall.SyscallN(procSetCommMask.Addr(), uintptr(handle), uintptr(dwEvtMask)) if r1 == 0 { err = errnoErr(e1) } @@ -3117,7 +3117,7 @@ func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { } func SetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + r1, _, e1 := syscall.SyscallN(procSetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) if r1 == 0 { err = errnoErr(e1) } @@ -3125,7 +3125,7 @@ func SetCommState(handle Handle, lpDCB *DCB) (err error) { } func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) + r1, _, e1 := syscall.SyscallN(procSetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) if r1 == 0 { err = errnoErr(e1) } @@ -3133,7 +3133,7 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func SetConsoleCP(cp uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleCP.Addr(), uintptr(cp)) if r1 == 0 { err = errnoErr(e1) } @@ -3141,7 +3141,7 @@ func SetConsoleCP(cp uint32) (err error) { } func setConsoleCursorPosition(console Handle, position uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleCursorPosition.Addr(), uintptr(console), uintptr(position)) if r1 == 0 { err = errnoErr(e1) } @@ -3149,7 +3149,7 @@ func setConsoleCursorPosition(console Handle, position uint32) (err error) { } func SetConsoleMode(console Handle, mode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(console), uintptr(mode)) if r1 == 0 { err = errnoErr(e1) } @@ -3157,7 +3157,7 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { } func SetConsoleOutputCP(cp uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleOutputCP.Addr(), uintptr(cp)) if r1 == 0 { err = errnoErr(e1) } @@ -3165,7 +3165,7 @@ func SetConsoleOutputCP(cp uint32) (err error) { } func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetCurrentDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3173,7 +3173,7 @@ func SetCurrentDirectory(path *uint16) (err error) { } func SetDefaultDllDirectories(directoryFlags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetDefaultDllDirectories.Addr(), uintptr(directoryFlags)) if r1 == 0 { err = errnoErr(e1) } @@ -3190,7 +3190,7 @@ func SetDllDirectory(path string) (err error) { } func _SetDllDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetDllDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3198,7 +3198,7 @@ func _SetDllDirectory(path *uint16) (err error) { } func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetEndOfFile.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3206,7 +3206,7 @@ func SetEndOfFile(handle Handle) (err error) { } func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) + r1, _, e1 := syscall.SyscallN(procSetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value))) if r1 == 0 { err = errnoErr(e1) } @@ -3214,13 +3214,13 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { } func SetErrorMode(mode uint32) (ret uint32) { - r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) + r0, _, _ := syscall.SyscallN(procSetErrorMode.Addr(), uintptr(mode)) ret = uint32(r0) return } func SetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -3228,7 +3228,7 @@ func SetEvent(event Handle) (err error) { } func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) + r1, _, e1 := syscall.SyscallN(procSetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(attrs)) if r1 == 0 { err = errnoErr(e1) } @@ -3236,7 +3236,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { } func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(handle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3244,7 +3244,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) } func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen)) if r1 == 0 { err = errnoErr(e1) } @@ -3252,7 +3252,7 @@ func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inB } func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetFilePointer.Addr(), uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence)) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { err = errnoErr(e1) @@ -3261,7 +3261,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence } func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) if r1 == 0 { err = errnoErr(e1) } @@ -3269,7 +3269,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func SetFileValidData(handle Handle, validDataLength int64) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) + r1, _, e1 := syscall.SyscallN(procSetFileValidData.Addr(), uintptr(handle), uintptr(validDataLength)) if r1 == 0 { err = errnoErr(e1) } @@ -3277,7 +3277,7 @@ func SetFileValidData(handle Handle, validDataLength int64) (err error) { } func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procSetHandleInformation.Addr(), uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3285,7 +3285,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) } func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { - r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength)) ret = int(r0) if ret == 0 { err = errnoErr(e1) @@ -3294,7 +3294,7 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb } func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetNamedPipeHandleState.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout))) if r1 == 0 { err = errnoErr(e1) } @@ -3302,7 +3302,7 @@ func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uin } func SetPriorityClass(process Handle, priorityClass uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) + r1, _, e1 := syscall.SyscallN(procSetPriorityClass.Addr(), uintptr(process), uintptr(priorityClass)) if r1 == 0 { err = errnoErr(e1) } @@ -3314,7 +3314,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { if disable { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) + r1, _, e1 := syscall.SyscallN(procSetProcessPriorityBoost.Addr(), uintptr(process), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -3322,7 +3322,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { } func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetProcessShutdownParameters.Addr(), uintptr(level), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3330,7 +3330,7 @@ func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { } func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3338,7 +3338,7 @@ func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr } func SetStdHandle(stdhandle uint32, handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) + r1, _, e1 := syscall.SyscallN(procSetStdHandle.Addr(), uintptr(stdhandle), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3346,7 +3346,7 @@ func SetStdHandle(stdhandle uint32, handle Handle) (err error) { } func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) + r1, _, e1 := syscall.SyscallN(procSetVolumeLabelW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName))) if r1 == 0 { err = errnoErr(e1) } @@ -3354,7 +3354,7 @@ func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { } func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) + r1, _, e1 := syscall.SyscallN(procSetVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName))) if r1 == 0 { err = errnoErr(e1) } @@ -3362,7 +3362,7 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro } func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) + r1, _, e1 := syscall.SyscallN(procSetupComm.Addr(), uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) if r1 == 0 { err = errnoErr(e1) } @@ -3370,7 +3370,7 @@ func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { } func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { - r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + r0, _, e1 := syscall.SyscallN(procSizeofResource.Addr(), uintptr(module), uintptr(resInfo)) size = uint32(r0) if size == 0 { err = errnoErr(e1) @@ -3383,13 +3383,13 @@ func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { if alertable { _p0 = 1 } - r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) + r0, _, _ := syscall.SyscallN(procSleepEx.Addr(), uintptr(milliseconds), uintptr(_p0)) ret = uint32(r0) return } func TerminateJobObject(job Handle, exitCode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) + r1, _, e1 := syscall.SyscallN(procTerminateJobObject.Addr(), uintptr(job), uintptr(exitCode)) if r1 == 0 { err = errnoErr(e1) } @@ -3397,7 +3397,7 @@ func TerminateJobObject(job Handle, exitCode uint32) (err error) { } func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) + r1, _, e1 := syscall.SyscallN(procTerminateProcess.Addr(), uintptr(handle), uintptr(exitcode)) if r1 == 0 { err = errnoErr(e1) } @@ -3405,7 +3405,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { } func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + r1, _, e1 := syscall.SyscallN(procThread32First.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -3413,7 +3413,7 @@ func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + r1, _, e1 := syscall.SyscallN(procThread32Next.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -3421,7 +3421,7 @@ func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3429,7 +3429,7 @@ func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint3 } func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) + r1, _, e1 := syscall.SyscallN(procUnmapViewOfFile.Addr(), uintptr(addr)) if r1 == 0 { err = errnoErr(e1) } @@ -3437,7 +3437,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { } func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procUpdateProcThreadAttribute.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize))) if r1 == 0 { err = errnoErr(e1) } @@ -3445,7 +3445,7 @@ func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, } func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) + r0, _, e1 := syscall.SyscallN(procVirtualAlloc.Addr(), uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect)) value = uintptr(r0) if value == 0 { err = errnoErr(e1) @@ -3454,7 +3454,7 @@ func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint3 } func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) + r1, _, e1 := syscall.SyscallN(procVirtualFree.Addr(), uintptr(address), uintptr(size), uintptr(freetype)) if r1 == 0 { err = errnoErr(e1) } @@ -3462,7 +3462,7 @@ func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { } func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procVirtualLock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3470,7 +3470,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { } func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) + r1, _, e1 := syscall.SyscallN(procVirtualProtect.Addr(), uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect))) if r1 == 0 { err = errnoErr(e1) } @@ -3478,7 +3478,7 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect } func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0) + r1, _, e1 := syscall.SyscallN(procVirtualProtectEx.Addr(), uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect))) if r1 == 0 { err = errnoErr(e1) } @@ -3486,7 +3486,7 @@ func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect } func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3494,7 +3494,7 @@ func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintpt } func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) + r1, _, e1 := syscall.SyscallN(procVirtualQueryEx.Addr(), uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3502,7 +3502,7 @@ func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformat } func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procVirtualUnlock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3510,13 +3510,13 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { } func WTSGetActiveConsoleSessionId() (sessionID uint32) { - r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procWTSGetActiveConsoleSessionId.Addr()) sessionID = uint32(r0) return } func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) + r1, _, e1 := syscall.SyscallN(procWaitCommEvent.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3528,7 +3528,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil if waitAll { _p0 = 1 } - r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) + r0, _, e1 := syscall.SyscallN(procWaitForMultipleObjects.Addr(), uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds)) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3537,7 +3537,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil } func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) + r0, _, e1 := syscall.SyscallN(procWaitForSingleObject.Addr(), uintptr(handle), uintptr(waitMilliseconds)) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3546,7 +3546,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, } func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) + r1, _, e1 := syscall.SyscallN(procWriteConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved))) if r1 == 0 { err = errnoErr(e1) } @@ -3558,7 +3558,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procWriteFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3566,7 +3566,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) } func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0) + r1, _, e1 := syscall.SyscallN(procWriteProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten))) if r1 == 0 { err = errnoErr(e1) } @@ -3574,7 +3574,7 @@ func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size } func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procAcceptEx.Addr(), uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3582,12 +3582,12 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 } func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) + syscall.SyscallN(procGetAcceptExSockaddrs.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen))) return } func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + r1, _, e1 := syscall.SyscallN(procTransmitFile.Addr(), uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3595,7 +3595,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint } func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetApiBufferFree.Addr(), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3603,7 +3603,7 @@ func NetApiBufferFree(buf *byte) (neterr error) { } func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + r0, _, _ := syscall.SyscallN(procNetGetJoinInformation.Addr(), uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3611,7 +3611,7 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete } func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) { - r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0) + r0, _, _ := syscall.SyscallN(procNetUserEnum.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3619,7 +3619,7 @@ func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, pr } func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetUserGetInfo.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3627,7 +3627,7 @@ func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **by } func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) + r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3635,7 +3635,7 @@ func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO } func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { - r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, _ := syscall.SyscallN(procNtCreateNamedPipeFile.Addr(), uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3643,7 +3643,7 @@ func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, i } func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) + r0, _, _ := syscall.SyscallN(procNtQueryInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3651,7 +3651,7 @@ func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe } func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0) + r0, _, _ := syscall.SyscallN(procNtQuerySystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3659,7 +3659,7 @@ func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInf } func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0) + r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3667,7 +3667,7 @@ func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, } func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0) + r0, _, _ := syscall.SyscallN(procNtSetInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3675,7 +3675,7 @@ func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.P } func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall(procNtSetSystemInformation.Addr(), 3, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) + r0, _, _ := syscall.SyscallN(procNtSetSystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3683,13 +3683,13 @@ func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoL } func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) { - r0, _, _ := syscall.Syscall(procRtlAddFunctionTable.Addr(), 3, uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) + r0, _, _ := syscall.SyscallN(procRtlAddFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) ret = r0 != 0 return } func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { - r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDefaultNpAcl.Addr(), uintptr(unsafe.Pointer(acl))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3697,13 +3697,13 @@ func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { } func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) { - r0, _, _ := syscall.Syscall(procRtlDeleteFunctionTable.Addr(), 1, uintptr(unsafe.Pointer(functionTable)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDeleteFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable))) ret = r0 != 0 return } func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3711,7 +3711,7 @@ func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFile } func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3719,18 +3719,18 @@ func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString } func RtlGetCurrentPeb() (peb *PEB) { - r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procRtlGetCurrentPeb.Addr()) peb = (*PEB)(unsafe.Pointer(r0)) return } func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { - syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) + syscall.SyscallN(procRtlGetNtVersionNumbers.Addr(), uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) return } func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { - r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3738,23 +3738,23 @@ func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { } func RtlInitString(destinationString *NTString, sourceString *byte) { - syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) + syscall.SyscallN(procRtlInitString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) return } func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { - syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) + syscall.SyscallN(procRtlInitUnicodeString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) return } func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { - r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus)) ret = syscall.Errno(r0) return } func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) + r0, _, _ := syscall.SyscallN(procCLSIDFromString.Addr(), uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3762,7 +3762,7 @@ func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { } func coCreateGuid(pguid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) + r0, _, _ := syscall.SyscallN(procCoCreateGuid.Addr(), uintptr(unsafe.Pointer(pguid))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3770,7 +3770,7 @@ func coCreateGuid(pguid *GUID) (ret error) { } func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { - r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) + r0, _, _ := syscall.SyscallN(procCoGetObject.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3778,7 +3778,7 @@ func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable * } func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { - r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) + r0, _, _ := syscall.SyscallN(procCoInitializeEx.Addr(), uintptr(reserved), uintptr(coInit)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3786,23 +3786,23 @@ func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { } func CoTaskMemFree(address unsafe.Pointer) { - syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) + syscall.SyscallN(procCoTaskMemFree.Addr(), uintptr(address)) return } func CoUninitialize() { - syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) + syscall.SyscallN(procCoUninitialize.Addr()) return } func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { - r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + r0, _, _ := syscall.SyscallN(procStringFromGUID2.Addr(), uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) chars = int32(r0) return } func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procEnumProcessModules.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -3810,7 +3810,7 @@ func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uin } func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0) + r1, _, e1 := syscall.SyscallN(procEnumProcessModulesEx.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag)) if r1 == 0 { err = errnoErr(e1) } @@ -3818,7 +3818,7 @@ func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *u } func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) + r1, _, e1 := syscall.SyscallN(procEnumProcesses.Addr(), uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -3826,7 +3826,7 @@ func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err } func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleBaseNameW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -3834,7 +3834,7 @@ func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uin } func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleFileNameExW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -3842,7 +3842,7 @@ func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size u } func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleInformation.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -3850,7 +3850,7 @@ func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb } func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb)) + r1, _, e1 := syscall.SyscallN(procQueryWorkingSetEx.Addr(), uintptr(process), uintptr(pv), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -3862,7 +3862,7 @@ func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callb if ret != nil { return } - r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0) + r0, _, _ := syscall.SyscallN(procSubscribeServiceChangeNotifications.Addr(), uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3874,12 +3874,12 @@ func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) { if err != nil { return } - syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0) + syscall.SyscallN(procUnsubscribeServiceChangeNotifications.Addr(), uintptr(subscription)) return } func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + r1, _, e1 := syscall.SyscallN(procGetUserNameExW.Addr(), uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3887,7 +3887,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er } func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) + r1, _, e1 := syscall.SyscallN(procTranslateNameW.Addr(), uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3895,7 +3895,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint } func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.SyscallN(procSetupDiBuildDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -3903,7 +3903,7 @@ func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiCallClassInstaller.Addr(), uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3911,7 +3911,7 @@ func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInf } func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiCancelDriverInfoSearch.Addr(), uintptr(deviceInfoSet)) if r1 == 0 { err = errnoErr(e1) } @@ -3919,7 +3919,7 @@ func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { } func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupDiClassGuidsFromNameExW.Addr(), uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3927,7 +3927,7 @@ func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGu } func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupDiClassNameFromGuidExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3935,7 +3935,7 @@ func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSiz } func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoListExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -3944,7 +3944,7 @@ func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineN } func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3952,7 +3952,7 @@ func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUI } func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDeviceInfoList.Addr(), uintptr(deviceInfoSet)) if r1 == 0 { err = errnoErr(e1) } @@ -3960,7 +3960,7 @@ func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { } func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -3968,7 +3968,7 @@ func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDeviceInfo.Addr(), uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3976,7 +3976,7 @@ func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfo } func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDriverInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3984,7 +3984,7 @@ func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, d } func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetupDiGetClassDevsExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -3993,7 +3993,7 @@ func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintp } func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4001,7 +4001,7 @@ func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInfoListDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData))) if r1 == 0 { err = errnoErr(e1) } @@ -4009,7 +4009,7 @@ func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailDa } func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4017,7 +4017,7 @@ func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstanceIdW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4025,7 +4025,7 @@ func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDevicePropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -4033,7 +4033,7 @@ func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4041,7 +4041,7 @@ func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDriverInfoDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4049,7 +4049,7 @@ func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4057,7 +4057,7 @@ func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4065,7 +4065,7 @@ func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) { - r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) + r0, _, e1 := syscall.SyscallN(procSetupDiOpenDevRegKey.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) key = Handle(r0) if key == InvalidHandle { err = errnoErr(e1) @@ -4074,7 +4074,7 @@ func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Sc } func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize)) if r1 == 0 { err = errnoErr(e1) } @@ -4082,7 +4082,7 @@ func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4090,7 +4090,7 @@ func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize)) if r1 == 0 { err = errnoErr(e1) } @@ -4098,7 +4098,7 @@ func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4106,7 +4106,7 @@ func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4114,7 +4114,7 @@ func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupUninstallOEMInfW.Addr(), uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -4122,7 +4122,7 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er } func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { - r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) + r0, _, e1 := syscall.SyscallN(procCommandLineToArgvW.Addr(), uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc))) argv = (**uint16)(unsafe.Pointer(r0)) if argv == nil { err = errnoErr(e1) @@ -4131,7 +4131,7 @@ func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { } func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { - r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) + r0, _, _ := syscall.SyscallN(procSHGetKnownFolderPath.Addr(), uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4139,7 +4139,7 @@ func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **u } func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { - r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + r1, _, e1 := syscall.SyscallN(procShellExecuteW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) if r1 <= 32 { err = errnoErr(e1) } @@ -4147,12 +4147,12 @@ func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *ui } func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) { - syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param)) + syscall.SyscallN(procEnumChildWindows.Addr(), uintptr(hwnd), uintptr(enumFunc), uintptr(param)) return } func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0) + r1, _, e1 := syscall.SyscallN(procEnumWindows.Addr(), uintptr(enumFunc), uintptr(param)) if r1 == 0 { err = errnoErr(e1) } @@ -4160,7 +4160,7 @@ func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { } func ExitWindowsEx(flags uint32, reason uint32) (err error) { - r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) + r1, _, e1 := syscall.SyscallN(procExitWindowsEx.Addr(), uintptr(flags), uintptr(reason)) if r1 == 0 { err = errnoErr(e1) } @@ -4168,7 +4168,7 @@ func ExitWindowsEx(flags uint32, reason uint32) (err error) { } func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) { - r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) + r0, _, e1 := syscall.SyscallN(procGetClassNameW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) copied = int32(r0) if copied == 0 { err = errnoErr(e1) @@ -4177,19 +4177,19 @@ func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, e } func GetDesktopWindow() (hwnd HWND) { - r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetDesktopWindow.Addr()) hwnd = HWND(r0) return } func GetForegroundWindow() (hwnd HWND) { - r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetForegroundWindow.Addr()) hwnd = HWND(r0) return } func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0) + r1, _, e1 := syscall.SyscallN(procGetGUIThreadInfo.Addr(), uintptr(thread), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -4197,19 +4197,19 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { } func GetKeyboardLayout(tid uint32) (hkl Handle) { - r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + r0, _, _ := syscall.SyscallN(procGetKeyboardLayout.Addr(), uintptr(tid)) hkl = Handle(r0) return } func GetShellWindow() (shellWindow HWND) { - r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetShellWindow.Addr()) shellWindow = HWND(r0) return } func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0) + r0, _, e1 := syscall.SyscallN(procGetWindowThreadProcessId.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(pid))) tid = uint32(r0) if tid == 0 { err = errnoErr(e1) @@ -4218,25 +4218,25 @@ func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { } func IsWindow(hwnd HWND) (isWindow bool) { - r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindow.Addr(), uintptr(hwnd)) isWindow = r0 != 0 return } func IsWindowUnicode(hwnd HWND) (isUnicode bool) { - r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindowUnicode.Addr(), uintptr(hwnd)) isUnicode = r0 != 0 return } func IsWindowVisible(hwnd HWND) (isVisible bool) { - r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindowVisible.Addr(), uintptr(hwnd)) isVisible = r0 != 0 return } func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + r0, _, e1 := syscall.SyscallN(procLoadKeyboardLayoutW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags)) hkl = Handle(r0) if hkl == 0 { err = errnoErr(e1) @@ -4245,7 +4245,7 @@ func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { } func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { - r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) + r0, _, e1 := syscall.SyscallN(procMessageBoxW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype)) ret = int32(r0) if ret == 0 { err = errnoErr(e1) @@ -4254,13 +4254,13 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i } func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { - r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + r0, _, _ := syscall.SyscallN(procToUnicodeEx.Addr(), uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl)) ret = int32(r0) return } func UnloadKeyboardLayout(hkl Handle) (err error) { - r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + r1, _, e1 := syscall.SyscallN(procUnloadKeyboardLayout.Addr(), uintptr(hkl)) if r1 == 0 { err = errnoErr(e1) } @@ -4272,7 +4272,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( if inheritExisting { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -4280,7 +4280,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( } func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block))) if r1 == 0 { err = errnoErr(e1) } @@ -4288,7 +4288,7 @@ func DestroyEnvironmentBlock(block *uint16) (err error) { } func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) + r1, _, e1 := syscall.SyscallN(procGetUserProfileDirectoryW.Addr(), uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { err = errnoErr(e1) } @@ -4305,7 +4305,7 @@ func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32 } func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileVersionInfoSizeW.Addr(), 2, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle)), 0) + r0, _, e1 := syscall.SyscallN(procGetFileVersionInfoSizeW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle))) bufSize = uint32(r0) if bufSize == 0 { err = errnoErr(e1) @@ -4323,7 +4323,7 @@ func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer u } func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileVersionInfoW.Addr(), 4, uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileVersionInfoW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer)) if r1 == 0 { err = errnoErr(e1) } @@ -4340,7 +4340,7 @@ func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer } func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVerQueryValueW.Addr(), 4, uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procVerQueryValueW.Addr(), uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4348,7 +4348,7 @@ func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPoint } func TimeBeginPeriod(period uint32) (err error) { - r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0) + r1, _, e1 := syscall.SyscallN(proctimeBeginPeriod.Addr(), uintptr(period)) if r1 != 0 { err = errnoErr(e1) } @@ -4356,7 +4356,7 @@ func TimeBeginPeriod(period uint32) (err error) { } func TimeEndPeriod(period uint32) (err error) { - r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0) + r1, _, e1 := syscall.SyscallN(proctimeEndPeriod.Addr(), uintptr(period)) if r1 != 0 { err = errnoErr(e1) } @@ -4364,7 +4364,7 @@ func TimeEndPeriod(period uint32) (err error) { } func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { - r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + r0, _, _ := syscall.SyscallN(procWinVerifyTrustEx.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4372,12 +4372,12 @@ func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) } func FreeAddrInfoW(addrinfo *AddrinfoW) { - syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) + syscall.SyscallN(procFreeAddrInfoW.Addr(), uintptr(unsafe.Pointer(addrinfo))) return } func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetAddrInfoW.Addr(), uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result))) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4385,7 +4385,7 @@ func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, resul } func WSACleanup() (err error) { - r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procWSACleanup.Addr()) if r1 == socket_error { err = errnoErr(e1) } @@ -4393,7 +4393,7 @@ func WSACleanup() (err error) { } func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) { - r1, _, e1 := syscall.Syscall(procWSADuplicateSocketW.Addr(), 3, uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) if r1 != 0 { err = errnoErr(e1) } @@ -4401,7 +4401,7 @@ func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err } func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + r0, _, e1 := syscall.SyscallN(procWSAEnumProtocolsW.Addr(), uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4414,7 +4414,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) + r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) if r1 == 0 { err = errnoErr(e1) } @@ -4422,7 +4422,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f } func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + r1, _, e1 := syscall.SyscallN(procWSAIoctl.Addr(), uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { err = errnoErr(e1) } @@ -4430,7 +4430,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo } func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) { - r1, _, e1 := syscall.Syscall(procWSALookupServiceBeginW.Addr(), 3, uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceBeginW.Addr(), uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) if r1 == socket_error { err = errnoErr(e1) } @@ -4438,7 +4438,7 @@ func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) } func WSALookupServiceEnd(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procWSALookupServiceEnd.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceEnd.Addr(), uintptr(handle)) if r1 == socket_error { err = errnoErr(e1) } @@ -4446,7 +4446,7 @@ func WSALookupServiceEnd(handle Handle) (err error) { } func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) { - r1, _, e1 := syscall.Syscall6(procWSALookupServiceNextW.Addr(), 4, uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceNextW.Addr(), uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet))) if r1 == socket_error { err = errnoErr(e1) } @@ -4454,7 +4454,7 @@ func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WS } func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSARecv.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4462,7 +4462,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 } func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.SyscallN(procWSARecvFrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4470,7 +4470,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui } func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSASend.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4478,7 +4478,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, } func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.SyscallN(procWSASendTo.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4486,7 +4486,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 } func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4495,7 +4495,7 @@ func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, } func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) + r0, _, _ := syscall.SyscallN(procWSAStartup.Addr(), uintptr(verreq), uintptr(unsafe.Pointer(data))) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4503,7 +4503,7 @@ func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { } func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4511,7 +4511,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { } func Closesocket(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := syscall.SyscallN(procclosesocket.Addr(), uintptr(s)) if r1 == socket_error { err = errnoErr(e1) } @@ -4519,7 +4519,7 @@ func Closesocket(s Handle) (err error) { } func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.SyscallN(procconnect.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4536,7 +4536,7 @@ func GetHostByName(name string) (h *Hostent, err error) { } func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procgethostbyname.Addr(), uintptr(unsafe.Pointer(name))) h = (*Hostent)(unsafe.Pointer(r0)) if h == nil { err = errnoErr(e1) @@ -4545,7 +4545,7 @@ func _GetHostByName(name *byte) (h *Hostent, err error) { } func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4562,7 +4562,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { } func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procgetprotobyname.Addr(), uintptr(unsafe.Pointer(name))) p = (*Protoent)(unsafe.Pointer(r0)) if p == nil { err = errnoErr(e1) @@ -4585,7 +4585,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { } func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) + r0, _, e1 := syscall.SyscallN(procgetservbyname.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto))) s = (*Servent)(unsafe.Pointer(r0)) if s == nil { err = errnoErr(e1) @@ -4594,7 +4594,7 @@ func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { } func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4602,7 +4602,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { } func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) + r1, _, e1 := syscall.SyscallN(procgetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4610,7 +4610,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 } func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) + r1, _, e1 := syscall.SyscallN(proclisten.Addr(), uintptr(s), uintptr(backlog)) if r1 == socket_error { err = errnoErr(e1) } @@ -4618,7 +4618,7 @@ func listen(s Handle, backlog int32) (err error) { } func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) + r0, _, _ := syscall.SyscallN(procntohs.Addr(), uintptr(netshort)) u = uint16(r0) return } @@ -4628,7 +4628,7 @@ func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen * if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall.SyscallN(procrecvfrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4641,7 +4641,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) + r1, _, e1 := syscall.SyscallN(procsendto.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4649,7 +4649,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( } func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) + r1, _, e1 := syscall.SyscallN(procsetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4657,7 +4657,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 } func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) + r1, _, e1 := syscall.SyscallN(procshutdown.Addr(), uintptr(s), uintptr(how)) if r1 == socket_error { err = errnoErr(e1) } @@ -4665,7 +4665,7 @@ func shutdown(s Handle, how int32) (err error) { } func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) + r0, _, e1 := syscall.SyscallN(procsocket.Addr(), uintptr(af), uintptr(typ), uintptr(protocol)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4674,7 +4674,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { } func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) + r1, _, e1 := syscall.SyscallN(procWTSEnumerateSessionsW.Addr(), uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count))) if r1 == 0 { err = errnoErr(e1) } @@ -4682,12 +4682,12 @@ func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessio } func WTSFreeMemory(ptr uintptr) { - syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) + syscall.SyscallN(procWTSFreeMemory.Addr(), uintptr(ptr)) return } func WTSQueryUserToken(session uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) + r1, _, e1 := syscall.SyscallN(procWTSQueryUserToken.Addr(), uintptr(session), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go index 159a95ae7d..9ad18a041e 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go @@ -515,8 +515,7 @@ func checkPrintf(pass *analysis.Pass, fileVersion string, kind Kind, call *ast.C // finds are sometimes unlikely or inconsequential, and may not be worth // fixing for some users. Gating on language version allows us to avoid // breaking existing tests and CI scripts. - if !suppressNonconstants && - idx == len(call.Args)-1 && + if idx == len(call.Args)-1 && fileVersion != "" && // fail open versions.AtLeast(fileVersion, "go1.24") { @@ -1005,15 +1004,6 @@ func (ss stringSet) Set(flag string) error { return nil } -// suppressNonconstants suppresses reporting printf calls with -// non-constant formatting strings (proposal #60529) when true. -// -// This variable is to allow for staging the transition to newer -// versions of x/tools by vendoring. -// -// Remove this after the 1.24 release. -var suppressNonconstants bool - // isHex reports whether b is a hex digit. func isHex(b byte) bool { return '0' <= b && b <= '9' || diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go index 429125a8b7..3147219561 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go @@ -10,7 +10,6 @@ import ( "go/ast" "go/build" "go/types" - "regexp" "slices" "golang.org/x/tools/go/analysis" @@ -114,11 +113,6 @@ func run(pass *analysis.Pass) (any, error) { return nil, nil } -// Matches cgo generated comment as well as the proposed standard: -// -// https://golang.org/s/generatedcode -var generatedRx = regexp.MustCompile(`// .*DO NOT EDIT\.?`) - // origin returns the original uninstantiated symbol for obj. func origin(obj types.Object) types.Object { switch obj := obj.(type) { diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go index cc90f7335e..826add2c44 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go @@ -17,6 +17,8 @@ import ( "strconv" "strings" + "fmt" + "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/analysis/passes/inspect" "golang.org/x/tools/go/ast/inspector" @@ -100,7 +102,11 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s } if err := validateStructTag(tag); err != nil { - pass.Reportf(field.Pos(), "struct field tag %#q not compatible with reflect.StructTag.Get: %s", tag, err) + pass.Report(analysis.Diagnostic{ + Pos: field.Pos(), + End: field.Pos() + token.Pos(len(field.Name())), + Message: fmt.Sprintf("struct field tag %#q not compatible with reflect.StructTag.Get: %s", tag, err), + }) } // Check for use of json or xml tags with unexported fields. @@ -122,7 +128,11 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s // ignored. case "", "-": default: - pass.Reportf(field.Pos(), "struct field %s has %s tag but is not exported", field.Name(), enc) + pass.Report(analysis.Diagnostic{ + Pos: field.Pos(), + End: field.Pos() + token.Pos(len(field.Name())), + Message: fmt.Sprintf("struct field %s has %s tag but is not exported", field.Name(), enc), + }) return } } @@ -190,7 +200,11 @@ func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *ty alsoPos.Filename = rel } - pass.Reportf(nearest.Pos(), "struct field %s repeats %s tag %q also at %s", field.Name(), key, val, alsoPos) + pass.Report(analysis.Diagnostic{ + Pos: nearest.Pos(), + End: nearest.Pos() + token.Pos(len(nearest.Name())), + Message: fmt.Sprintf("struct field %s repeats %s tag %q also at %s", field.Name(), key, val, alsoPos), + }) } else { seen.Set(key, val, level, field.Pos()) } diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go index 5503916243..633af5a1da 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go @@ -73,6 +73,7 @@ type Config struct { PackageVetx map[string]string // maps package path to file of fact information VetxOnly bool // run analysis only for facts, not diagnostics VetxOutput string // where to write file of fact information + Stdout string // write stdout (e.g. JSON, unified diff) to this file SucceedOnTypecheckFailure bool } @@ -142,6 +143,15 @@ func Run(configFile string, analyzers []*analysis.Analyzer) { log.Fatal(err) } + // Redirect stdout to a file as requested. + if cfg.Stdout != "" { + f, err := os.Create(cfg.Stdout) + if err != nil { + log.Fatal(err) + } + os.Stdout = f + } + fset := token.NewFileSet() results, err := run(fset, cfg, analyzers) if err != nil { diff --git a/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go b/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go index 31c8d2f240..7e72d3c284 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go +++ b/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go @@ -40,7 +40,7 @@ type Cursor struct { // Root returns a cursor for the virtual root node, // whose children are the files provided to [New]. // -// Its [Cursor.Node] and [Cursor.Stack] methods return nil. +// Its [Cursor.Node] method return nil. func (in *Inspector) Root() Cursor { return Cursor{in, -1} } diff --git a/src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go b/src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go index fad4530ff3..29a39f698c 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go +++ b/src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go @@ -53,7 +53,6 @@ import ( // // The entry point is Blocks[0]; there may be multiple return blocks. type CFG struct { - fset *token.FileSet Blocks []*Block // block[0] is entry; order otherwise undefined } @@ -63,6 +62,10 @@ type CFG struct { // A block may have 0-2 successors: zero for a return block or a block // that calls a function such as panic that never returns; one for a // normal (jump) block; and two for a conditional (if) block. +// +// In a conditional block, the last entry in Nodes is the condition and always +// an [ast.Expr], Succs[0] is the successor if the condition is true, and +// Succs[1] is the successor if the condition is false. type Block struct { Nodes []ast.Node // statements, expressions, and ValueSpecs Succs []*Block // successor nodes in the graph diff --git a/src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go b/src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go index d3c2913bef..6c0c74968f 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go +++ b/src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go @@ -698,7 +698,10 @@ func Object(pkg *types.Package, p Path) (types.Object, error) { } else if false && aliases.Enabled() { // The Enabled check is too expensive, so for now we // simply assume that aliases are not enabled. - // TODO(adonovan): replace with "if true {" when go1.24 is assured. + // + // Now that go1.24 is assured, we should be able to + // replace this with "if true {", but it causes tests + // to fail. TODO(adonovan): investigate. return nil, fmt.Errorf("cannot apply %q to %s (got %T, want alias)", code, t, t) } diff --git a/src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go b/src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go index b6d542c64e..f035a0b6be 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go +++ b/src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go @@ -11,7 +11,6 @@ import ( "fmt" "go/types" "hash/maphash" - "unsafe" "golang.org/x/tools/internal/typeparams" ) @@ -380,22 +379,8 @@ var theSeed = maphash.MakeSeed() func (hasher) hashTypeName(tname *types.TypeName) uint32 { // Since types.Identical uses == to compare TypeNames, // the Hash function uses maphash.Comparable. - // TODO(adonovan): or will, when it becomes available in go1.24. - // In the meantime we use the pointer's numeric value. - // - // hash := maphash.Comparable(theSeed, tname) - // - // (Another approach would be to hash the name and package - // path, and whether or not it is a package-level typename. It - // is rare for a package to define multiple local types with - // the same name.) - ptr := uintptr(unsafe.Pointer(tname)) - if unsafe.Sizeof(ptr) == 8 { - hash := uint64(ptr) - return uint32(hash ^ (hash >> 32)) - } else { - return uint32(ptr) - } + hash := maphash.Comparable(theSeed, tname) + return uint32(hash ^ (hash >> 32)) } // shallowHash computes a hash of t without looking at any of its diff --git a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go index e46aab02d6..c8e349f4fe 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go @@ -22,6 +22,7 @@ import ( "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/ast/inspector" + "golang.org/x/tools/internal/moreiters" "golang.org/x/tools/internal/typesinternal" ) @@ -276,19 +277,27 @@ func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member before = decl0.Doc } } - // If the first decl is an import group, add this new import at the end. if gd, ok := before.(*ast.GenDecl); ok && gd.Tok == token.IMPORT && gd.Rparen.IsValid() { - pos = gd.Rparen - // if it's a std lib, we should append it at the beginning of import group. - // otherwise we may see the std package is put at the last behind a 3rd module which doesn't follow our convention. - // besides, gofmt doesn't help in this case. - if IsStdPackage(pkgpath) && len(gd.Specs) != 0 { - pos = gd.Specs[0].Pos() + // Have existing grouped import ( ... ) decl. + if IsStdPackage(pkgpath) && len(gd.Specs) > 0 { + // Add spec for a std package before + // first existing spec, followed by + // a blank line if the next one is non-std. + first := gd.Specs[0].(*ast.ImportSpec) + pos = first.Pos() + if !IsStdPackage(first.Path.Value) { + newText += "\n" + } newText += "\n\t" } else { + // Add spec at end of group. + pos = gd.Rparen newText = "\t" + newText + "\n" } } else { + // No import decl, or non-grouped import. + // Add a new import decl before first decl. + // (gofmt will merge multiple import decls.) pos = before.Pos() newText = "import " + newText + "\n\n" } @@ -519,24 +528,11 @@ func CanImport(from, to string) bool { return true } -// DeleteStmt returns the edits to remove stmt if it is contained -// in a BlockStmt, CaseClause, CommClause, or is the STMT in switch STMT; ... {...} -// The report function abstracts gopls' bug.Report. -func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report func(string, ...any)) []analysis.TextEdit { - // TODO: pass in the cursor to a ast.Stmt. callers should provide the Cursor - insp := inspector.New([]*ast.File{astFile}) - root := insp.Root() - cstmt, ok := root.FindNode(stmt) - if !ok { - report("%s not found in file", stmt.Pos()) - return nil - } - // some paranoia - if !stmt.Pos().IsValid() || !stmt.End().IsValid() { - report("%s: stmt has invalid position", stmt.Pos()) - return nil - } - +// DeleteStmt returns the edits to remove the [ast.Stmt] identified by +// curStmt, if it is contained within a BlockStmt, CaseClause, +// CommClause, or is the STMT in switch STMT; ... {...}. It returns nil otherwise. +func DeleteStmt(fset *token.FileSet, curStmt inspector.Cursor) []analysis.TextEdit { + stmt := curStmt.Node().(ast.Stmt) // if the stmt is on a line by itself delete the whole line // otherwise just delete the statement. @@ -562,7 +558,7 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu // (removing the blocks requires more rewriting than this routine would do) // CommCase = "case" ( SendStmt | RecvStmt ) | "default" . // (removing the stmt requires more rewriting, and it's unclear what the user means) - switch parent := cstmt.Parent().Node().(type) { + switch parent := curStmt.Parent().Node().(type) { case *ast.SwitchStmt: limits(parent.Switch, parent.Body.Lbrace) case *ast.TypeSwitchStmt: @@ -573,12 +569,12 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu case *ast.BlockStmt: limits(parent.Lbrace, parent.Rbrace) case *ast.CommClause: - limits(parent.Colon, cstmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace) + limits(parent.Colon, curStmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace) if parent.Comm == stmt { return nil // maybe the user meant to remove the entire CommClause? } case *ast.CaseClause: - limits(parent.Colon, cstmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace) + limits(parent.Colon, curStmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace) case *ast.ForStmt: limits(parent.For, parent.Body.Lbrace) @@ -586,15 +582,15 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu return nil // not one of ours } - if prev, found := cstmt.PrevSibling(); found && lineOf(prev.Node().End()) == stmtStartLine { + if prev, found := curStmt.PrevSibling(); found && lineOf(prev.Node().End()) == stmtStartLine { from = prev.Node().End() // preceding statement ends on same line } - if next, found := cstmt.NextSibling(); found && lineOf(next.Node().Pos()) == stmtEndLine { + if next, found := curStmt.NextSibling(); found && lineOf(next.Node().Pos()) == stmtEndLine { to = next.Node().Pos() // following statement begins on same line } // and now for the comments Outer: - for _, cg := range astFile.Comments { + for _, cg := range enclosingFile(curStmt).Comments { for _, co := range cg.List { if lineOf(co.End()) < stmtStartLine { continue @@ -681,3 +677,9 @@ type tokenRange struct{ StartPos, EndPos token.Pos } func (r tokenRange) Pos() token.Pos { return r.StartPos } func (r tokenRange) End() token.Pos { return r.EndPos } + +// enclosingFile returns the syntax tree for the file enclosing c. +func enclosingFile(c inspector.Cursor) *ast.File { + c, _ = moreiters.First(c.Enclosing((*ast.File)(nil))) + return c.Node().(*ast.File) +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go new file mode 100644 index 0000000000..c945de02d4 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go @@ -0,0 +1,99 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package astutil + +import ( + "go/ast" + "go/token" + "reflect" +) + +// Equal reports whether two nodes are structurally equal, +// ignoring fields of type [token.Pos], [ast.Object], +// and [ast.Scope], and comments. +// +// The operands x and y may be nil. +// A nil slice is not equal to an empty slice. +// +// The provided function determines whether two identifiers +// should be considered identical. +func Equal(x, y ast.Node, identical func(x, y *ast.Ident) bool) bool { + if x == nil || y == nil { + return x == y + } + return equal(reflect.ValueOf(x), reflect.ValueOf(y), identical) +} + +func equal(x, y reflect.Value, identical func(x, y *ast.Ident) bool) bool { + // Ensure types are the same + if x.Type() != y.Type() { + return false + } + switch x.Kind() { + case reflect.Pointer: + if x.IsNil() || y.IsNil() { + return x.IsNil() == y.IsNil() + } + switch t := x.Interface().(type) { + // Skip fields of types potentially involved in cycles. + case *ast.Object, *ast.Scope, *ast.CommentGroup: + return true + case *ast.Ident: + return identical(t, y.Interface().(*ast.Ident)) + default: + return equal(x.Elem(), y.Elem(), identical) + } + + case reflect.Interface: + if x.IsNil() || y.IsNil() { + return x.IsNil() == y.IsNil() + } + return equal(x.Elem(), y.Elem(), identical) + + case reflect.Struct: + for i := range x.NumField() { + xf := x.Field(i) + yf := y.Field(i) + // Skip position fields. + if xpos, ok := xf.Interface().(token.Pos); ok { + ypos := yf.Interface().(token.Pos) + // Numeric value of a Pos is not significant but its "zeroness" is, + // because it is often significant, e.g. CallExpr.Variadic(Ellipsis), ChanType.Arrow. + if xpos.IsValid() != ypos.IsValid() { + return false + } + } else if !equal(xf, yf, identical) { + return false + } + } + return true + + case reflect.Slice: + if x.IsNil() || y.IsNil() { + return x.IsNil() == y.IsNil() + } + if x.Len() != y.Len() { + return false + } + for i := range x.Len() { + if !equal(x.Index(i), y.Index(i), identical) { + return false + } + } + return true + + case reflect.String: + return x.String() == y.String() + + case reflect.Bool: + return x.Bool() == y.Bool() + + case reflect.Int: + return x.Int() == y.Int() + + default: + panic(x) + } +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go new file mode 100644 index 0000000000..8b81ea47a4 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go @@ -0,0 +1,35 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package astutil + +import ( + "go/ast" + "iter" +) + +// FlatFields 'flattens' an ast.FieldList, returning an iterator over each +// (name, field) combination in the list. For unnamed fields, the identifier is +// nil. +func FlatFields(list *ast.FieldList) iter.Seq2[*ast.Ident, *ast.Field] { + return func(yield func(*ast.Ident, *ast.Field) bool) { + if list == nil { + return + } + + for _, field := range list.List { + if len(field.Names) == 0 { + if !yield(nil, field) { + return + } + } else { + for _, name := range field.Names { + if !yield(name, field) { + return + } + } + } + } + } +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go new file mode 100644 index 0000000000..81ac46a0c4 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go @@ -0,0 +1,72 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package astutil provides various AST utility functions for gopls. +package astutil + +import ( + "bytes" + "go/scanner" + "go/token" +) + +// PurgeFuncBodies returns a copy of src in which the contents of each +// outermost {...} region except struct and interface types have been +// deleted. This reduces the amount of work required to parse the +// top-level declarations. +// +// PurgeFuncBodies does not preserve newlines or position information. +// Also, if the input is invalid, parsing the output of +// PurgeFuncBodies may result in a different tree due to its effects +// on parser error recovery. +func PurgeFuncBodies(src []byte) []byte { + // Destroy the content of any {...}-bracketed regions that are + // not immediately preceded by a "struct" or "interface" + // token. That includes function bodies, composite literals, + // switch/select bodies, and all blocks of statements. + // This will lead to non-void functions that don't have return + // statements, which of course is a type error, but that's ok. + + var out bytes.Buffer + file := token.NewFileSet().AddFile("", -1, len(src)) + var sc scanner.Scanner + sc.Init(file, src, nil, 0) + var prev token.Token + var cursor int // last consumed src offset + var braces []token.Pos // stack of unclosed braces or -1 for struct/interface type + for { + pos, tok, _ := sc.Scan() + if tok == token.EOF { + break + } + switch tok { + case token.COMMENT: + // TODO(adonovan): opt: skip, to save an estimated 20% of time. + + case token.LBRACE: + if prev == token.STRUCT || prev == token.INTERFACE { + pos = -1 + } + braces = append(braces, pos) + + case token.RBRACE: + if last := len(braces) - 1; last >= 0 { + top := braces[last] + braces = braces[:last] + if top < 0 { + // struct/interface type: leave alone + } else if len(braces) == 0 { // toplevel only + // Delete {...} body. + start := file.Offset(top) + end := file.Offset(pos) + out.Write(src[cursor : start+len("{")]) + cursor = end + } + } + } + prev = tok + } + out.Write(src[cursor:]) + return out.Bytes() +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go new file mode 100644 index 0000000000..849d45d853 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go @@ -0,0 +1,59 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package astutil + +import ( + "fmt" + "go/ast" + "go/token" + "strconv" + "unicode/utf8" +) + +// RangeInStringLiteral calculates the positional range within a string literal +// corresponding to the specified start and end byte offsets within the logical string. +func RangeInStringLiteral(lit *ast.BasicLit, start, end int) (token.Pos, token.Pos, error) { + startPos, err := PosInStringLiteral(lit, start) + if err != nil { + return 0, 0, fmt.Errorf("start: %v", err) + } + endPos, err := PosInStringLiteral(lit, end) + if err != nil { + return 0, 0, fmt.Errorf("end: %v", err) + } + return startPos, endPos, nil +} + +// PosInStringLiteral returns the position within a string literal +// corresponding to the specified byte offset within the logical +// string that it denotes. +func PosInStringLiteral(lit *ast.BasicLit, offset int) (token.Pos, error) { + raw := lit.Value + + value, err := strconv.Unquote(raw) + if err != nil { + return 0, err + } + if !(0 <= offset && offset <= len(value)) { + return 0, fmt.Errorf("invalid offset") + } + + // remove quotes + quote := raw[0] // '"' or '`' + raw = raw[1 : len(raw)-1] + + var ( + i = 0 // byte index within logical value + pos = lit.ValuePos + 1 // position within literal + ) + for raw != "" && i < offset { + r, _, rest, _ := strconv.UnquoteChar(raw, quote) // can't fail + sz := len(raw) - len(rest) // length of literal char in raw bytes + pos += token.Pos(sz) + raw = raw[sz:] + i += utf8.RuneLen(r) + } + return pos, nil +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go new file mode 100644 index 0000000000..2538a7428b --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go @@ -0,0 +1,61 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package astutil + +import ( + "go/ast" + + "golang.org/x/tools/internal/typeparams" +) + +// UnpackRecv unpacks a receiver type expression, reporting whether it is a +// pointer receiver, along with the type name identifier and any receiver type +// parameter identifiers. +// +// Copied (with modifications) from go/types. +func UnpackRecv(rtyp ast.Expr) (ptr bool, rname *ast.Ident, tparams []*ast.Ident) { +L: // unpack receiver type + // This accepts invalid receivers such as ***T and does not + // work for other invalid receivers, but we don't care. The + // validity of receiver expressions is checked elsewhere. + for { + switch t := rtyp.(type) { + case *ast.ParenExpr: + rtyp = t.X + case *ast.StarExpr: + ptr = true + rtyp = t.X + default: + break L + } + } + + // unpack type parameters, if any + switch rtyp.(type) { + case *ast.IndexExpr, *ast.IndexListExpr: + var indices []ast.Expr + rtyp, _, indices, _ = typeparams.UnpackIndexExpr(rtyp) + for _, arg := range indices { + var par *ast.Ident + switch arg := arg.(type) { + case *ast.Ident: + par = arg + default: + // ignore errors + } + if par == nil { + par = &ast.Ident{NamePos: arg.Pos(), Name: "_"} + } + tparams = append(tparams, par) + } + } + + // unpack receiver name + if name, _ := rtyp.(*ast.Ident); name != nil { + rname = name + } + + return +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go index f06dbda369..14189155e4 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go @@ -5,59 +5,10 @@ package astutil import ( - "fmt" "go/ast" "go/token" - "strconv" - "unicode/utf8" ) -// RangeInStringLiteral calculates the positional range within a string literal -// corresponding to the specified start and end byte offsets within the logical string. -func RangeInStringLiteral(lit *ast.BasicLit, start, end int) (token.Pos, token.Pos, error) { - startPos, err := PosInStringLiteral(lit, start) - if err != nil { - return 0, 0, fmt.Errorf("start: %v", err) - } - endPos, err := PosInStringLiteral(lit, end) - if err != nil { - return 0, 0, fmt.Errorf("end: %v", err) - } - return startPos, endPos, nil -} - -// PosInStringLiteral returns the position within a string literal -// corresponding to the specified byte offset within the logical -// string that it denotes. -func PosInStringLiteral(lit *ast.BasicLit, offset int) (token.Pos, error) { - raw := lit.Value - - value, err := strconv.Unquote(raw) - if err != nil { - return 0, err - } - if !(0 <= offset && offset <= len(value)) { - return 0, fmt.Errorf("invalid offset") - } - - // remove quotes - quote := raw[0] // '"' or '`' - raw = raw[1 : len(raw)-1] - - var ( - i = 0 // byte index within logical value - pos = lit.ValuePos + 1 // position within literal - ) - for raw != "" && i < offset { - r, _, rest, _ := strconv.UnquoteChar(raw, quote) // can't fail - sz := len(raw) - len(rest) // length of literal char in raw bytes - pos += token.Pos(sz) - raw = raw[sz:] - i += utf8.RuneLen(r) - } - return pos, nil -} - // PreorderStack traverses the tree rooted at root, // calling f before visiting each node. // @@ -91,3 +42,28 @@ func PreorderStack(root ast.Node, stack []ast.Node, f func(n ast.Node, stack []a panic("push/pop mismatch") } } + +// NodeContains reports whether the Pos/End range of node n encloses +// the given position pos. +// +// It is inclusive of both end points, to allow hovering (etc) when +// the cursor is immediately after a node. +// +// For unfortunate historical reasons, the Pos/End extent of an +// ast.File runs from the start of its package declaration---excluding +// copyright comments, build tags, and package documentation---to the +// end of its last declaration, excluding any trailing comments. So, +// as a special case, if n is an [ast.File], NodeContains uses +// n.FileStart <= pos && pos <= n.FileEnd to report whether the +// position lies anywhere within the file. +// +// Precondition: n must not be nil. +func NodeContains(n ast.Node, pos token.Pos) bool { + var start, end token.Pos + if file, ok := n.(*ast.File); ok { + start, end = file.FileStart, file.FileEnd // entire file + } else { + start, end = n.Pos(), n.End() + } + return start <= pos && pos <= end +} diff --git a/src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go b/src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go new file mode 100644 index 0000000000..69c76ccb9b --- /dev/null +++ b/src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go @@ -0,0 +1,47 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package moreiters + +import "iter" + +// First returns the first value of seq and true. +// If seq is empty, it returns the zero value of T and false. +func First[T any](seq iter.Seq[T]) (z T, ok bool) { + for t := range seq { + return t, true + } + return z, false +} + +// Contains reports whether x is an element of the sequence seq. +func Contains[T comparable](seq iter.Seq[T], x T) bool { + for cand := range seq { + if cand == x { + return true + } + } + return false +} + +// Every reports whether every pred(t) for t in seq returns true, +// stopping at the first false element. +func Every[T any](seq iter.Seq[T], pred func(T) bool) bool { + for t := range seq { + if !pred(t) { + return false + } + } + return true +} + +// Any reports whether any pred(t) for t in seq returns true. +func Any[T any](seq iter.Seq[T], pred func(T) bool) bool { + for t := range seq { + if pred(t) { + return true + } + } + return false +} diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt index ebdac1a8b7..37cd448bc9 100644 --- a/src/cmd/vendor/modules.txt +++ b/src/cmd/vendor/modules.txt @@ -28,8 +28,8 @@ golang.org/x/arch/x86/x86asm # golang.org/x/build v0.0.0-20250806225920-b7c66c047964 ## explicit; go 1.23.0 golang.org/x/build/relnote -# golang.org/x/mod v0.27.0 -## explicit; go 1.23.0 +# golang.org/x/mod v0.28.0 +## explicit; go 1.24.0 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/modfile golang.org/x/mod/module @@ -39,17 +39,17 @@ golang.org/x/mod/sumdb/dirhash golang.org/x/mod/sumdb/note golang.org/x/mod/sumdb/tlog golang.org/x/mod/zip -# golang.org/x/sync v0.16.0 -## explicit; go 1.23.0 +# golang.org/x/sync v0.17.0 +## explicit; go 1.24.0 golang.org/x/sync/errgroup golang.org/x/sync/semaphore -# golang.org/x/sys v0.35.0 -## explicit; go 1.23.0 +# golang.org/x/sys v0.36.0 +## explicit; go 1.24.0 golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488 -## explicit; go 1.23.0 +# golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 +## explicit; go 1.24.0 golang.org/x/telemetry golang.org/x/telemetry/counter golang.org/x/telemetry/counter/countertest @@ -63,8 +63,8 @@ golang.org/x/telemetry/internal/upload # golang.org/x/term v0.34.0 ## explicit; go 1.23.0 golang.org/x/term -# golang.org/x/text v0.28.0 -## explicit; go 1.23.0 +# golang.org/x/text v0.29.0 +## explicit; go 1.24.0 golang.org/x/text/cases golang.org/x/text/internal golang.org/x/text/internal/language @@ -73,7 +73,7 @@ golang.org/x/text/internal/tag golang.org/x/text/language golang.org/x/text/transform golang.org/x/text/unicode/norm -# golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08 +# golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d ## explicit; go 1.24.0 golang.org/x/tools/cmd/bisect golang.org/x/tools/cover @@ -132,6 +132,7 @@ golang.org/x/tools/internal/diff golang.org/x/tools/internal/diff/lcs golang.org/x/tools/internal/facts golang.org/x/tools/internal/fmtstr +golang.org/x/tools/internal/moreiters golang.org/x/tools/internal/stdlib golang.org/x/tools/internal/typeparams golang.org/x/tools/internal/typesinternal diff --git a/src/go.mod b/src/go.mod index 51c38f3bc0..4b400fe871 100644 --- a/src/go.mod +++ b/src/go.mod @@ -3,11 +3,11 @@ module std go 1.26 require ( - golang.org/x/crypto v0.41.0 - golang.org/x/net v0.43.0 + golang.org/x/crypto v0.42.0 + golang.org/x/net v0.44.0 ) require ( - golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/sys v0.36.0 // indirect + golang.org/x/text v0.29.0 // indirect ) diff --git a/src/go.sum b/src/go.sum index 3bc4cb5372..c90970a9cb 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1,8 +1,8 @@ -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= -golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= -golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= +golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= diff --git a/src/internal/copyright/copyright_test.go b/src/internal/copyright/copyright_test.go index fa33a944b0..11b6a9b229 100644 --- a/src/internal/copyright/copyright_test.go +++ b/src/internal/copyright/copyright_test.go @@ -29,6 +29,7 @@ var permitted = [][]byte{ []byte("// mkerrors"), []byte("// mksys"), []byte("// run\n// Code generated by"), // cmd/compile/internal/test/constFold_test.go + []byte("//go:build !nethttpomithttp2"), // hack to pacify h2_bundle, which drops copyright header } func TestCopyright(t *testing.T) { @@ -64,6 +65,7 @@ func TestCopyright(t *testing.T) { return nil } } + t.Logf("%.100s %s", b, path) t.Errorf("%s: missing copyright notice", path) return nil }) diff --git a/src/internal/syscall/windows/registry/zsyscall_windows.go b/src/internal/syscall/windows/registry/zsyscall_windows.go index cab1319374..07371f137d 100644 --- a/src/internal/syscall/windows/registry/zsyscall_windows.go +++ b/src/internal/syscall/windows/registry/zsyscall_windows.go @@ -50,7 +50,7 @@ var ( ) func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition))) + r0, _, _ := syscall.SyscallN(procRegCreateKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -58,7 +58,7 @@ func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class * } func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0) + r0, _, _ := syscall.SyscallN(procRegDeleteKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -66,7 +66,7 @@ func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { } func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0) + r0, _, _ := syscall.SyscallN(procRegDeleteValueW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -74,7 +74,7 @@ func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { } func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0) + r0, _, _ := syscall.SyscallN(procRegEnumValueW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -82,7 +82,7 @@ func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint3 } func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0) + r0, _, _ := syscall.SyscallN(procRegLoadMUIStringW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -90,7 +90,7 @@ func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint } func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) + r0, _, _ := syscall.SyscallN(procRegSetValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -98,7 +98,7 @@ func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype } func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) diff --git a/src/internal/syscall/windows/zsyscall_windows.go b/src/internal/syscall/windows/zsyscall_windows.go index 90cf0b92a4..53f456c5cf 100644 --- a/src/internal/syscall/windows/zsyscall_windows.go +++ b/src/internal/syscall/windows/zsyscall_windows.go @@ -116,7 +116,7 @@ func adjustTokenPrivileges(token syscall.Token, disableAllPrivileges bool, newst if disableAllPrivileges { _p0 = 1 } - r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r0, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) ret = uint32(r0) if true { err = errnoErr(e1) @@ -125,7 +125,7 @@ func adjustTokenPrivileges(token syscall.Token, disableAllPrivileges bool, newst } func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTokenAttributes *syscall.SecurityAttributes, impersonationLevel uint32, tokenType TokenType, phNewToken *syscall.Token) (err error) { - r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(hExistingToken), uintptr(dwDesiredAccess), uintptr(unsafe.Pointer(lpTokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(phNewToken))) + r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(hExistingToken), uintptr(dwDesiredAccess), uintptr(unsafe.Pointer(lpTokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(phNewToken))) if r1 == 0 { err = errnoErr(e1) } @@ -133,25 +133,25 @@ func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTo } func getSidIdentifierAuthority(sid *syscall.SID) (idauth uintptr) { - r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid))) idauth = uintptr(r0) return } func getSidSubAuthority(sid *syscall.SID, subAuthorityIdx uint32) (subAuth uintptr) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(subAuthorityIdx), 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(subAuthorityIdx)) subAuth = uintptr(r0) return } func getSidSubAuthorityCount(sid *syscall.SID) (count uintptr) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid))) count = uintptr(r0) return } func ImpersonateLoggedOnUser(token syscall.Token) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateLoggedOnUser.Addr(), 1, uintptr(token), 0, 0) + r1, _, e1 := syscall.SyscallN(procImpersonateLoggedOnUser.Addr(), uintptr(token)) if r1 == 0 { err = errnoErr(e1) } @@ -159,7 +159,7 @@ func ImpersonateLoggedOnUser(token syscall.Token) (err error) { } func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) + r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel)) if r1 == 0 { err = errnoErr(e1) } @@ -167,13 +167,13 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) { } func IsValidSid(sid *syscall.SID) (valid bool) { - r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid))) valid = r0 != 0 return } func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uint32, logonProvider uint32, token *syscall.Token) (err error) { - r1, _, e1 := syscall.Syscall6(procLogonUserW.Addr(), 6, uintptr(unsafe.Pointer(username)), uintptr(unsafe.Pointer(domain)), uintptr(unsafe.Pointer(password)), uintptr(logonType), uintptr(logonProvider), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.SyscallN(procLogonUserW.Addr(), uintptr(unsafe.Pointer(username)), uintptr(unsafe.Pointer(domain)), uintptr(unsafe.Pointer(password)), uintptr(logonType), uintptr(logonProvider), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -181,7 +181,7 @@ func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uin } func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) if r1 == 0 { err = errnoErr(e1) } @@ -189,7 +189,7 @@ func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err err } func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) handle = syscall.Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -198,7 +198,7 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha } func OpenService(mgr syscall.Handle, serviceName *uint16, access uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) handle = syscall.Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -211,7 +211,7 @@ func OpenThreadToken(h syscall.Handle, access uint32, openasself bool, token *sy if openasself { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(h), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) + r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(h), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -219,7 +219,7 @@ func OpenThreadToken(h syscall.Handle, access uint32, openasself bool, token *sy } func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(hService), uintptr(unsafe.Pointer(lpServiceStatus)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(hService), uintptr(unsafe.Pointer(lpServiceStatus))) if r1 == 0 { err = errnoErr(e1) } @@ -227,7 +227,7 @@ func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS } func RevertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) if r1 == 0 { err = errnoErr(e1) } @@ -235,7 +235,7 @@ func RevertToSelf() (err error) { } func SetTokenInformation(tokenHandle syscall.Token, tokenInformationClass uint32, tokenInformation unsafe.Pointer, tokenInformationLength uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(tokenHandle), uintptr(tokenInformationClass), uintptr(tokenInformation), uintptr(tokenInformationLength), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(tokenHandle), uintptr(tokenInformationClass), uintptr(tokenInformation), uintptr(tokenInformationLength)) if r1 == 0 { err = errnoErr(e1) } @@ -247,7 +247,7 @@ func ProcessPrng(buf []byte) (err error) { if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall(procProcessPrng.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0) + r1, _, e1 := syscall.SyscallN(procProcessPrng.Addr(), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf))) if r1 == 0 { err = errnoErr(e1) } @@ -255,7 +255,7 @@ func ProcessPrng(buf []byte) (err error) { } func GetAdaptersAddresses(family uint32, flags uint32, reserved unsafe.Pointer, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) + r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -263,7 +263,7 @@ func GetAdaptersAddresses(family uint32, flags uint32, reserved unsafe.Pointer, } func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name))) handle = syscall.Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -272,7 +272,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat } func CreateIoCompletionPort(filehandle syscall.Handle, cphandle syscall.Handle, key uintptr, threadcnt uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) handle = syscall.Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -281,7 +281,7 @@ func CreateIoCompletionPort(filehandle syscall.Handle, cphandle syscall.Handle, } func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) + r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) handle = syscall.Handle(r0) if handle == syscall.InvalidHandle { err = errnoErr(e1) @@ -290,13 +290,13 @@ func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances u } func GetACP() (acp uint32) { - r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetACP.Addr()) acp = uint32(r0) return } func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nameformat), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nameformat), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -304,13 +304,13 @@ func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) { } func GetConsoleCP() (ccp uint32) { - r0, _, _ := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetConsoleCP.Addr()) ccp = uint32(r0) return } func GetCurrentThread() (pseudoHandle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetCurrentThread.Addr()) pseudoHandle = syscall.Handle(r0) if pseudoHandle == 0 { err = errnoErr(e1) @@ -319,7 +319,7 @@ func GetCurrentThread() (pseudoHandle syscall.Handle, err error) { } func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byte, bufsize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(info)), uintptr(bufsize), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(info)), uintptr(bufsize)) if r1 == 0 { err = errnoErr(e1) } @@ -327,7 +327,7 @@ func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byt } func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -336,7 +336,7 @@ func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSiz } func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(fn)), uintptr(len)) + r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(fn)), uintptr(len)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -345,7 +345,7 @@ func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32, } func GetModuleHandle(modulename *uint16) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(unsafe.Pointer(modulename)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetModuleHandleW.Addr(), uintptr(unsafe.Pointer(modulename))) handle = syscall.Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -358,7 +358,7 @@ func GetOverlappedResult(handle syscall.Handle, overlapped *syscall.Overlapped, if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -366,7 +366,7 @@ func GetOverlappedResult(handle syscall.Handle, overlapped *syscall.Overlapped, } func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTempPath2W.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := syscall.SyscallN(procGetTempPath2W.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -375,7 +375,7 @@ func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) { } func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -383,7 +383,7 @@ func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16, } func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) + r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { err = errnoErr(e1) } @@ -391,7 +391,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint } func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -399,7 +399,7 @@ func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uin } func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -407,7 +407,7 @@ func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err err } func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -415,7 +415,7 @@ func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err erro } func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -423,7 +423,7 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { } func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) nwrite = int32(r0) if nwrite == 0 { err = errnoErr(e1) @@ -432,19 +432,19 @@ func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, } func RtlLookupFunctionEntry(pc uintptr, baseAddress *uintptr, table unsafe.Pointer) (ret *RUNTIME_FUNCTION) { - r0, _, _ := syscall.Syscall(procRtlLookupFunctionEntry.Addr(), 3, uintptr(pc), uintptr(unsafe.Pointer(baseAddress)), uintptr(table)) + r0, _, _ := syscall.SyscallN(procRtlLookupFunctionEntry.Addr(), uintptr(pc), uintptr(unsafe.Pointer(baseAddress)), uintptr(table)) ret = (*RUNTIME_FUNCTION)(unsafe.Pointer(r0)) return } func RtlVirtualUnwind(handlerType uint32, baseAddress uintptr, pc uintptr, entry *RUNTIME_FUNCTION, ctxt unsafe.Pointer, data unsafe.Pointer, frame *uintptr, ctxptrs unsafe.Pointer) (ret uintptr) { - r0, _, _ := syscall.Syscall9(procRtlVirtualUnwind.Addr(), 8, uintptr(handlerType), uintptr(baseAddress), uintptr(pc), uintptr(unsafe.Pointer(entry)), uintptr(ctxt), uintptr(data), uintptr(unsafe.Pointer(frame)), uintptr(ctxptrs), 0) + r0, _, _ := syscall.SyscallN(procRtlVirtualUnwind.Addr(), uintptr(handlerType), uintptr(baseAddress), uintptr(pc), uintptr(unsafe.Pointer(entry)), uintptr(ctxt), uintptr(data), uintptr(unsafe.Pointer(frame)), uintptr(ctxptrs)) ret = uintptr(r0) return } func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint32, buf unsafe.Pointer, bufsize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize)) if r1 == 0 { err = errnoErr(e1) } @@ -452,7 +452,7 @@ func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint } func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -460,7 +460,7 @@ func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHi } func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -468,7 +468,7 @@ func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintpt } func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetShareAdd.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetShareAdd.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -476,7 +476,7 @@ func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) ( } func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr error) { - r0, _, _ := syscall.Syscall(procNetShareDel.Addr(), 3, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(netName)), uintptr(reserved)) + r0, _, _ := syscall.SyscallN(procNetShareDel.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(netName)), uintptr(reserved)) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -484,7 +484,7 @@ func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr e } func NetUserAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint32) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetUserAdd.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetUserAdd.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -492,7 +492,7 @@ func NetUserAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint32) (n } func NetUserDel(serverName *uint16, userName *uint16) (neterr error) { - r0, _, _ := syscall.Syscall(procNetUserDel.Addr(), 2, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), 0) + r0, _, _ := syscall.SyscallN(procNetUserDel.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -500,7 +500,7 @@ func NetUserDel(serverName *uint16, userName *uint16) (neterr error) { } func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, flags uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32) (neterr error) { - r0, _, _ := syscall.Syscall9(procNetUserGetLocalGroups.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(flags), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), 0) + r0, _, _ := syscall.SyscallN(procNetUserGetLocalGroups.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(flags), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -508,7 +508,7 @@ func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, f } func NtCreateFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer unsafe.Pointer, ealength uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) + r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -516,7 +516,7 @@ func NtCreateFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, } func NtOpenFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, options uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtOpenFile.Addr(), 6, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(options)) + r0, _, _ := syscall.SyscallN(procNtOpenFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(options)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -524,7 +524,7 @@ func NtOpenFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, io } func NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQueryInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class), 0) + r0, _, _ := syscall.SyscallN(procNtQueryInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -532,7 +532,7 @@ func NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuff } func NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class), 0) + r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -540,24 +540,24 @@ func NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer } func rtlGetVersion(info *_OSVERSIONINFOEXW) { - syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) + syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info))) return } func RtlIsDosDeviceName_U(name *uint16) (ret uint32) { - r0, _, _ := syscall.Syscall(procRtlIsDosDeviceName_U.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlIsDosDeviceName_U.Addr(), uintptr(unsafe.Pointer(name))) ret = uint32(r0) return } func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { - r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus)) ret = syscall.Errno(r0) return } func GetProcessMemoryInfo(handle syscall.Handle, memCounters *PROCESS_MEMORY_COUNTERS, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(memCounters)), uintptr(cb)) + r1, _, e1 := syscall.SyscallN(procGetProcessMemoryInfo.Addr(), uintptr(handle), uintptr(unsafe.Pointer(memCounters)), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -569,7 +569,7 @@ func CreateEnvironmentBlock(block **uint16, token syscall.Token, inheritExisting if inheritExisting { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -577,7 +577,7 @@ func CreateEnvironmentBlock(block **uint16, token syscall.Token, inheritExisting } func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block))) if r1 == 0 { err = errnoErr(e1) } @@ -585,7 +585,7 @@ func DestroyEnvironmentBlock(block *uint16) (err error) { } func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProfilesDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)), 0) + r1, _, e1 := syscall.SyscallN(procGetProfilesDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { err = errnoErr(e1) } @@ -593,7 +593,7 @@ func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) { } func WSADuplicateSocket(s syscall.Handle, processID uint32, info *syscall.WSAProtocolInfo) (err error) { - r1, _, e1 := syscall.Syscall(procWSADuplicateSocketW.Addr(), 3, uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) if r1 != 0 { err = errnoErr(e1) } @@ -605,7 +605,7 @@ func WSAGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) + r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) if r1 == 0 { err = errnoErr(e1) } @@ -613,7 +613,7 @@ func WSAGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint } func WSASocket(af int32, typ int32, protocol int32, protinfo *syscall.WSAProtocolInfo, group uint32, flags uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protinfo)), uintptr(group), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protinfo)), uintptr(group), uintptr(flags)) handle = syscall.Handle(r0) if handle == syscall.InvalidHandle { err = errnoErr(e1) diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index a57d613134..3abd7476f0 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -13,10 +13,6 @@ // // See https://http2.github.io/ for more information on HTTP/2. // -// Copyright 2024 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// package http @@ -1079,7 +1075,7 @@ func http2configFromServer(h1 *Server, h2 *http2Server) http2http2Config { PermitProhibitedCipherSuites: h2.PermitProhibitedCipherSuites, CountError: h2.CountError, } - http2fillNetHTTPServerConfig(&conf, h1) + http2fillNetHTTPConfig(&conf, h1.HTTP2) http2setConfigDefaults(&conf, true) return conf } @@ -1105,7 +1101,7 @@ func http2configFromTransport(h2 *http2Transport) http2http2Config { } if h2.t1 != nil { - http2fillNetHTTPTransportConfig(&conf, h2.t1) + http2fillNetHTTPConfig(&conf, h2.t1.HTTP2) } http2setConfigDefaults(&conf, false) return conf @@ -1145,16 +1141,6 @@ func http2adjustHTTP1MaxHeaderSize(n int64) int64 { return n + typicalHeaders*perFieldOverhead } -// fillNetHTTPServerConfig sets fields in conf from srv.HTTP2. -func http2fillNetHTTPServerConfig(conf *http2http2Config, srv *Server) { - http2fillNetHTTPConfig(conf, srv.HTTP2) -} - -// fillNetHTTPTransportConfig sets fields in conf from tr.HTTP2. -func http2fillNetHTTPTransportConfig(conf *http2http2Config, tr *Transport) { - http2fillNetHTTPConfig(conf, tr.HTTP2) -} - func http2fillNetHTTPConfig(conf *http2http2Config, h2 *HTTP2Config) { if h2 == nil { return @@ -3273,17 +3259,27 @@ func http2summarizeFrame(f http2Frame) string { var http2DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1" +// Setting DebugGoroutines to false during a test to disable goroutine debugging +// results in race detector complaints when a test leaves goroutines running before +// returning. Tests shouldn't do this, of course, but when they do it generally shows +// up as infrequent, hard-to-debug flakes. (See #66519.) +// +// Disable goroutine debugging during individual tests with an atomic bool. +// (Note that it's safe to enable/disable debugging mid-test, so the actual race condition +// here is harmless.) +var http2disableDebugGoroutines atomic.Bool + type http2goroutineLock uint64 func http2newGoroutineLock() http2goroutineLock { - if !http2DebugGoroutines { + if !http2DebugGoroutines || http2disableDebugGoroutines.Load() { return 0 } return http2goroutineLock(http2curGoroutineID()) } func (g http2goroutineLock) check() { - if !http2DebugGoroutines { + if !http2DebugGoroutines || http2disableDebugGoroutines.Load() { return } if http2curGoroutineID() != uint64(g) { @@ -3292,7 +3288,7 @@ func (g http2goroutineLock) check() { } func (g http2goroutineLock) checkNotOn() { - if !http2DebugGoroutines { + if !http2DebugGoroutines || http2disableDebugGoroutines.Load() { return } if http2curGoroutineID() == uint64(g) { @@ -3647,15 +3643,13 @@ func (cw http2closeWaiter) Wait() { // idle memory usage with many connections. type http2bufferedWriter struct { _ http2incomparable - group http2synctestGroupInterface // immutable - conn net.Conn // immutable - bw *bufio.Writer // non-nil when data is buffered - byteTimeout time.Duration // immutable, WriteByteTimeout + conn net.Conn // immutable + bw *bufio.Writer // non-nil when data is buffered + byteTimeout time.Duration // immutable, WriteByteTimeout } -func http2newBufferedWriter(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration) *http2bufferedWriter { +func http2newBufferedWriter(conn net.Conn, timeout time.Duration) *http2bufferedWriter { return &http2bufferedWriter{ - group: group, conn: conn, byteTimeout: timeout, } @@ -3706,24 +3700,18 @@ func (w *http2bufferedWriter) Flush() error { type http2bufferedWriterTimeoutWriter http2bufferedWriter func (w *http2bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error) { - return http2writeWithByteTimeout(w.group, w.conn, w.byteTimeout, p) + return http2writeWithByteTimeout(w.conn, w.byteTimeout, p) } // writeWithByteTimeout writes to conn. // If more than timeout passes without any bytes being written to the connection, // the write fails. -func http2writeWithByteTimeout(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration, p []byte) (n int, err error) { +func http2writeWithByteTimeout(conn net.Conn, timeout time.Duration, p []byte) (n int, err error) { if timeout <= 0 { return conn.Write(p) } for { - var now time.Time - if group == nil { - now = time.Now() - } else { - now = group.Now() - } - conn.SetWriteDeadline(now.Add(timeout)) + conn.SetWriteDeadline(time.Now().Add(timeout)) nn, err := conn.Write(p[n:]) n += nn if n == len(p) || nn == 0 || !errors.Is(err, os.ErrDeadlineExceeded) { @@ -3814,17 +3802,6 @@ func (s *http2sorter) SortStrings(ss []string) { // any size (as long as it's first). type http2incomparable [0]func() -// synctestGroupInterface is the methods of synctestGroup used by Server and Transport. -// It's defined as an interface here to let us keep synctestGroup entirely test-only -// and not a part of non-test builds. -type http2synctestGroupInterface interface { - Join() - Now() time.Time - NewTimer(d time.Duration) http2timer - AfterFunc(d time.Duration, f func()) http2timer - ContextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) -} - // pipe is a goroutine-safe io.Reader/io.Writer pair. It's like // io.Pipe except there are no PipeReader/PipeWriter halves, and the // underlying buffer is an interface. (io.Pipe is always unbuffered) @@ -4121,39 +4098,6 @@ type http2Server struct { // so that we don't embed a Mutex in this struct, which will make the // struct non-copyable, which might break some callers. state *http2serverInternalState - - // Synchronization group used for testing. - // Outside of tests, this is nil. - group http2synctestGroupInterface -} - -func (s *http2Server) markNewGoroutine() { - if s.group != nil { - s.group.Join() - } -} - -func (s *http2Server) now() time.Time { - if s.group != nil { - return s.group.Now() - } - return time.Now() -} - -// newTimer creates a new time.Timer, or a synthetic timer in tests. -func (s *http2Server) newTimer(d time.Duration) http2timer { - if s.group != nil { - return s.group.NewTimer(d) - } - return http2timeTimer{time.NewTimer(d)} -} - -// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests. -func (s *http2Server) afterFunc(d time.Duration, f func()) http2timer { - if s.group != nil { - return s.group.AfterFunc(d, f) - } - return http2timeTimer{time.AfterFunc(d, f)} } type http2serverInternalState struct { @@ -4368,6 +4312,9 @@ func (o *http2ServeConnOpts) handler() Handler { // // The opts parameter is optional. If nil, default values are used. func (s *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts) { + if opts == nil { + opts = &http2ServeConnOpts{} + } s.serveConn(c, opts, nil) } @@ -4383,7 +4330,7 @@ func (s *http2Server) serveConn(c net.Conn, opts *http2ServeConnOpts, newf func( conn: c, baseCtx: baseCtx, remoteAddrStr: c.RemoteAddr().String(), - bw: http2newBufferedWriter(s.group, c, conf.WriteByteTimeout), + bw: http2newBufferedWriter(c, conf.WriteByteTimeout), handler: opts.handler(), streams: make(map[uint32]*http2stream), readFrameCh: make(chan http2readFrameResult), @@ -4583,11 +4530,11 @@ type http2serverConn struct { pingSent bool sentPingData [8]byte goAwayCode http2ErrCode - shutdownTimer http2timer // nil until used - idleTimer http2timer // nil if unused + shutdownTimer *time.Timer // nil until used + idleTimer *time.Timer // nil if unused readIdleTimeout time.Duration pingTimeout time.Duration - readIdleTimer http2timer // nil if unused + readIdleTimer *time.Timer // nil if unused // Owned by the writeFrameAsync goroutine: headerWriteBuf bytes.Buffer @@ -4632,12 +4579,12 @@ type http2stream struct { flow http2outflow // limits writing from Handler to client inflow http2inflow // what the client is allowed to POST/etc to us state http2streamState - resetQueued bool // RST_STREAM queued for write; set by sc.resetStream - gotTrailerHeader bool // HEADER frame for trailers was seen - wroteHeaders bool // whether we wrote headers (not status 100) - readDeadline http2timer // nil if unused - writeDeadline http2timer // nil if unused - closeErr error // set before cw is closed + resetQueued bool // RST_STREAM queued for write; set by sc.resetStream + gotTrailerHeader bool // HEADER frame for trailers was seen + wroteHeaders bool // whether we wrote headers (not status 100) + readDeadline *time.Timer // nil if unused + writeDeadline *time.Timer // nil if unused + closeErr error // set before cw is closed trailer Header // accumulated trailers reqTrailer Header // handler's Request.Trailer @@ -4796,7 +4743,6 @@ type http2readFrameResult struct { // consumer is done with the frame. // It's run on its own goroutine. func (sc *http2serverConn) readFrames() { - sc.srv.markNewGoroutine() gate := make(chan struct{}) gateDone := func() { gate <- struct{}{} } for { @@ -4829,7 +4775,6 @@ type http2frameWriteResult struct { // At most one goroutine can be running writeFrameAsync at a time per // serverConn. func (sc *http2serverConn) writeFrameAsync(wr http2FrameWriteRequest, wd *http2writeData) { - sc.srv.markNewGoroutine() var err error if wd == nil { err = wr.write.writeFrame(sc) @@ -4913,22 +4858,22 @@ func (sc *http2serverConn) serve(conf http2http2Config) { sc.setConnState(StateIdle) if sc.srv.IdleTimeout > 0 { - sc.idleTimer = sc.srv.afterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) + sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) defer sc.idleTimer.Stop() } if conf.SendPingTimeout > 0 { sc.readIdleTimeout = conf.SendPingTimeout - sc.readIdleTimer = sc.srv.afterFunc(conf.SendPingTimeout, sc.onReadIdleTimer) + sc.readIdleTimer = time.AfterFunc(conf.SendPingTimeout, sc.onReadIdleTimer) defer sc.readIdleTimer.Stop() } go sc.readFrames() // closed by defer sc.conn.Close above - settingsTimer := sc.srv.afterFunc(http2firstSettingsTimeout, sc.onSettingsTimer) + settingsTimer := time.AfterFunc(http2firstSettingsTimeout, sc.onSettingsTimer) defer settingsTimer.Stop() - lastFrameTime := sc.srv.now() + lastFrameTime := time.Now() loopNum := 0 for { loopNum++ @@ -4942,7 +4887,7 @@ func (sc *http2serverConn) serve(conf http2http2Config) { case res := <-sc.wroteFrameCh: sc.wroteFrame(res) case res := <-sc.readFrameCh: - lastFrameTime = sc.srv.now() + lastFrameTime = time.Now() // Process any written frames before reading new frames from the client since a // written frame could have triggered a new stream to be started. if sc.writingFrameAsync { @@ -5025,7 +4970,7 @@ func (sc *http2serverConn) handlePingTimer(lastFrameReadTime time.Time) { } pingAt := lastFrameReadTime.Add(sc.readIdleTimeout) - now := sc.srv.now() + now := time.Now() if pingAt.After(now) { // We received frames since arming the ping timer. // Reset it for the next possible timeout. @@ -5092,10 +5037,10 @@ func (sc *http2serverConn) readPreface() error { errc <- nil } }() - timer := sc.srv.newTimer(http2prefaceTimeout) // TODO: configurable on *Server? + timer := time.NewTimer(http2prefaceTimeout) // TODO: configurable on *Server? defer timer.Stop() select { - case <-timer.C(): + case <-timer.C: return http2errPrefaceTimeout case err := <-errc: if err == nil { @@ -5111,6 +5056,21 @@ var http2errChanPool = sync.Pool{ New: func() interface{} { return make(chan error, 1) }, } +func http2getErrChan() chan error { + if http2inTests { + // Channels cannot be reused across synctest tests. + return make(chan error, 1) + } else { + return http2errChanPool.Get().(chan error) + } +} + +func http2putErrChan(ch chan error) { + if !http2inTests { + http2errChanPool.Put(ch) + } +} + var http2writeDataPool = sync.Pool{ New: func() interface{} { return new(http2writeData) }, } @@ -5118,7 +5078,7 @@ var http2writeDataPool = sync.Pool{ // writeDataFromHandler writes DATA response frames from a handler on // the given stream. func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte, endStream bool) error { - ch := http2errChanPool.Get().(chan error) + ch := http2getErrChan() writeArg := http2writeDataPool.Get().(*http2writeData) *writeArg = http2writeData{stream.id, data, endStream} err := sc.writeFrameFromHandler(http2FrameWriteRequest{ @@ -5150,7 +5110,7 @@ func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte return http2errStreamClosed } } - http2errChanPool.Put(ch) + http2putErrChan(ch) if frameWriteDone { http2writeDataPool.Put(writeArg) } @@ -5464,7 +5424,7 @@ func (sc *http2serverConn) goAway(code http2ErrCode) { func (sc *http2serverConn) shutDownIn(d time.Duration) { sc.serveG.check() - sc.shutdownTimer = sc.srv.afterFunc(d, sc.onShutdownTimer) + sc.shutdownTimer = time.AfterFunc(d, sc.onShutdownTimer) } func (sc *http2serverConn) resetStream(se http2StreamError) { @@ -6069,7 +6029,7 @@ func (sc *http2serverConn) processHeaders(f *http2MetaHeadersFrame) error { // (in Go 1.8), though. That's a more sane option anyway. if sc.hs.ReadTimeout > 0 { sc.conn.SetReadDeadline(time.Time{}) - st.readDeadline = sc.srv.afterFunc(sc.hs.ReadTimeout, st.onReadTimeout) + st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) } return sc.scheduleHandler(id, rw, req, handler) @@ -6167,7 +6127,7 @@ func (sc *http2serverConn) newStream(id, pusherID uint32, state http2streamState st.flow.add(sc.initialStreamSendWindowSize) st.inflow.init(sc.initialStreamRecvWindowSize) if sc.hs.WriteTimeout > 0 { - st.writeDeadline = sc.srv.afterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) + st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) } sc.streams[id] = st @@ -6356,7 +6316,6 @@ func (sc *http2serverConn) handlerDone() { // Run on its own goroutine. func (sc *http2serverConn) runHandler(rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request)) { - sc.srv.markNewGoroutine() defer sc.sendServeMsg(http2handlerDoneMsg) didPanic := true defer func() { @@ -6405,7 +6364,7 @@ func (sc *http2serverConn) writeHeaders(st *http2stream, headerData *http2writeR // waiting for this frame to be written, so an http.Flush mid-handler // writes out the correct value of keys, before a handler later potentially // mutates it. - errc = http2errChanPool.Get().(chan error) + errc = http2getErrChan() } if err := sc.writeFrameFromHandler(http2FrameWriteRequest{ write: headerData, @@ -6417,7 +6376,7 @@ func (sc *http2serverConn) writeHeaders(st *http2stream, headerData *http2writeR if errc != nil { select { case err := <-errc: - http2errChanPool.Put(errc) + http2putErrChan(errc) return err case <-sc.doneServing: return http2errClientDisconnected @@ -6524,7 +6483,7 @@ func (b *http2requestBody) Read(p []byte) (n int, err error) { if err == io.EOF { b.sawEOF = true } - if b.conn == nil && http2inTests { + if b.conn == nil { return } b.conn.noteBodyReadFromHandler(b.stream, n, err) @@ -6653,7 +6612,7 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) { var date string if _, ok := rws.snapHeader["Date"]; !ok { // TODO(bradfitz): be faster here, like net/http? measure. - date = rws.conn.srv.now().UTC().Format(TimeFormat) + date = time.Now().UTC().Format(TimeFormat) } for _, v := range rws.snapHeader["Trailer"] { @@ -6775,7 +6734,7 @@ func (rws *http2responseWriterState) promoteUndeclaredTrailers() { func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error { st := w.rws.stream - if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) { + if !deadline.IsZero() && deadline.Before(time.Now()) { // If we're setting a deadline in the past, reset the stream immediately // so writes after SetWriteDeadline returns will fail. st.onReadTimeout() @@ -6791,9 +6750,9 @@ func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error { if deadline.IsZero() { st.readDeadline = nil } else if st.readDeadline == nil { - st.readDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onReadTimeout) + st.readDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onReadTimeout) } else { - st.readDeadline.Reset(deadline.Sub(sc.srv.now())) + st.readDeadline.Reset(deadline.Sub(time.Now())) } }) return nil @@ -6801,7 +6760,7 @@ func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error { func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error { st := w.rws.stream - if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) { + if !deadline.IsZero() && deadline.Before(time.Now()) { // If we're setting a deadline in the past, reset the stream immediately // so writes after SetWriteDeadline returns will fail. st.onWriteTimeout() @@ -6817,9 +6776,9 @@ func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error { if deadline.IsZero() { st.writeDeadline = nil } else if st.writeDeadline == nil { - st.writeDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onWriteTimeout) + st.writeDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onWriteTimeout) } else { - st.writeDeadline.Reset(deadline.Sub(sc.srv.now())) + st.writeDeadline.Reset(deadline.Sub(time.Now())) } }) return nil @@ -7098,7 +7057,7 @@ func (w *http2responseWriter) Push(target string, opts *PushOptions) error { method: opts.Method, url: u, header: http2cloneHeader(opts.Header), - done: http2errChanPool.Get().(chan error), + done: http2getErrChan(), } select { @@ -7115,7 +7074,7 @@ func (w *http2responseWriter) Push(target string, opts *PushOptions) error { case <-st.cw: return http2errStreamClosed case err := <-msg.done: - http2errChanPool.Put(msg.done) + http2putErrChan(msg.done) return err } } @@ -7300,20 +7259,6 @@ func (sc *http2serverConn) countError(name string, err error) error { return err } -// A timer is a time.Timer, as an interface which can be replaced in tests. -type http2timer = interface { - C() <-chan time.Time - Reset(d time.Duration) bool - Stop() bool -} - -// timeTimer adapts a time.Timer to the timer interface. -type http2timeTimer struct { - *time.Timer -} - -func (t http2timeTimer) C() <-chan time.Time { return t.Timer.C } - const ( // transportDefaultConnFlow is how many connection-level flow control // tokens we give the server at start-up, past the default 64k. @@ -7470,50 +7415,6 @@ type http2Transport struct { type http2transportTestHooks struct { newclientconn func(*http2ClientConn) - group http2synctestGroupInterface -} - -func (t *http2Transport) markNewGoroutine() { - if t != nil && t.http2transportTestHooks != nil { - t.http2transportTestHooks.group.Join() - } -} - -func (t *http2Transport) now() time.Time { - if t != nil && t.http2transportTestHooks != nil { - return t.http2transportTestHooks.group.Now() - } - return time.Now() -} - -func (t *http2Transport) timeSince(when time.Time) time.Duration { - if t != nil && t.http2transportTestHooks != nil { - return t.now().Sub(when) - } - return time.Since(when) -} - -// newTimer creates a new time.Timer, or a synthetic timer in tests. -func (t *http2Transport) newTimer(d time.Duration) http2timer { - if t.http2transportTestHooks != nil { - return t.http2transportTestHooks.group.NewTimer(d) - } - return http2timeTimer{time.NewTimer(d)} -} - -// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests. -func (t *http2Transport) afterFunc(d time.Duration, f func()) http2timer { - if t.http2transportTestHooks != nil { - return t.http2transportTestHooks.group.AfterFunc(d, f) - } - return http2timeTimer{time.AfterFunc(d, f)} -} - -func (t *http2Transport) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) { - if t.http2transportTestHooks != nil { - return t.http2transportTestHooks.group.ContextWithTimeout(ctx, d) - } - return context.WithTimeout(ctx, d) } func (t *http2Transport) maxHeaderListSize() uint32 { @@ -7643,7 +7544,7 @@ type http2ClientConn struct { readerErr error // set before readerDone is closed idleTimeout time.Duration // or 0 for never - idleTimer http2timer + idleTimer *time.Timer mu sync.Mutex // guards following cond *sync.Cond // hold mu; broadcast on flow/closed changes @@ -7811,14 +7712,12 @@ func (cs *http2clientStream) closeReqBodyLocked() { cs.reqBodyClosed = make(chan struct{}) reqBodyClosed := cs.reqBodyClosed go func() { - cs.cc.t.markNewGoroutine() cs.reqBody.Close() close(reqBodyClosed) }() } type http2stickyErrWriter struct { - group http2synctestGroupInterface conn net.Conn timeout time.Duration err *error @@ -7828,7 +7727,7 @@ func (sew http2stickyErrWriter) Write(p []byte) (n int, err error) { if *sew.err != nil { return 0, *sew.err } - n, err = http2writeWithByteTimeout(sew.group, sew.conn, sew.timeout, p) + n, err = http2writeWithByteTimeout(sew.conn, sew.timeout, p) *sew.err = err return n, err } @@ -7928,9 +7827,9 @@ func (t *http2Transport) RoundTripOpt(req *Request, opt http2RoundTripOpt) (*Res backoff := float64(uint(1) << (uint(retry) - 1)) backoff += backoff * (0.1 * mathrand.Float64()) d := time.Second * time.Duration(backoff) - tm := t.newTimer(d) + tm := time.NewTimer(d) select { - case <-tm.C(): + case <-tm.C: t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue case <-req.Context().Done(): @@ -7977,6 +7876,7 @@ var ( http2errClientConnUnusable = errors.New("http2: client conn not usable") http2errClientConnNotEstablished = errors.New("http2: client conn could not be established") http2errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY") + http2errClientConnForceClosed = errors.New("http2: client connection force closed via ClientConn.Close") ) // shouldRetryRequest is called by RoundTrip when a request fails to get @@ -8116,14 +8016,11 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client pingTimeout: conf.PingTimeout, pings: make(map[[8]byte]chan struct{}), reqHeaderMu: make(chan struct{}, 1), - lastActive: t.now(), + lastActive: time.Now(), } - var group http2synctestGroupInterface if t.http2transportTestHooks != nil { - t.markNewGoroutine() t.http2transportTestHooks.newclientconn(cc) c = cc.tconn - group = t.group } if http2VerboseLogs { t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr()) @@ -8135,7 +8032,6 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client // TODO: adjust this writer size to account for frame size + // MTU + crypto/tls record padding. cc.bw = bufio.NewWriter(http2stickyErrWriter{ - group: group, conn: c, timeout: conf.WriteByteTimeout, err: &cc.werr, @@ -8184,7 +8080,7 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client // Start the idle timer after the connection is fully initialized. if d := t.idleConnTimeout(); d != 0 { cc.idleTimeout = d - cc.idleTimer = t.afterFunc(d, cc.onIdleTimeout) + cc.idleTimer = time.AfterFunc(d, cc.onIdleTimeout) } go cc.readLoop() @@ -8195,7 +8091,7 @@ func (cc *http2ClientConn) healthCheck() { pingTimeout := cc.pingTimeout // We don't need to periodically ping in the health check, because the readLoop of ClientConn will // trigger the healthCheck again if there is no frame received. - ctx, cancel := cc.t.contextWithTimeout(context.Background(), pingTimeout) + ctx, cancel := context.WithTimeout(context.Background(), pingTimeout) defer cancel() cc.vlogf("http2: Transport sending health check") err := cc.Ping(ctx) @@ -8398,7 +8294,7 @@ func (cc *http2ClientConn) tooIdleLocked() bool { // times are compared based on their wall time. We don't want // to reuse a connection that's been sitting idle during // VM/laptop suspend if monotonic time was also frozen. - return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && cc.t.timeSince(cc.lastIdle.Round(0)) > cc.idleTimeout + return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && time.Since(cc.lastIdle.Round(0)) > cc.idleTimeout } // onIdleTimeout is called from a time.AfterFunc goroutine. It will @@ -8464,7 +8360,6 @@ func (cc *http2ClientConn) Shutdown(ctx context.Context) error { done := make(chan struct{}) cancelled := false // guarded by cc.mu go func() { - cc.t.markNewGoroutine() cc.mu.Lock() defer cc.mu.Unlock() for { @@ -8535,8 +8430,7 @@ func (cc *http2ClientConn) closeForError(err error) { // // In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead. func (cc *http2ClientConn) Close() error { - err := errors.New("http2: client connection force closed via ClientConn.Close") - cc.closeForError(err) + cc.closeForError(http2errClientConnForceClosed) return nil } @@ -8705,7 +8599,6 @@ func (cc *http2ClientConn) roundTrip(req *Request, streamf func(*http2clientStre // // It sends the request and performs post-request cleanup (closing Request.Body, etc.). func (cs *http2clientStream) doRequest(req *Request, streamf func(*http2clientStream)) { - cs.cc.t.markNewGoroutine() err := cs.writeRequest(req, streamf) cs.cleanupWriteRequest(err) } @@ -8836,9 +8729,9 @@ func (cs *http2clientStream) writeRequest(req *Request, streamf func(*http2clien var respHeaderTimer <-chan time.Time var respHeaderRecv chan struct{} if d := cc.responseHeaderTimeout(); d != 0 { - timer := cc.t.newTimer(d) + timer := time.NewTimer(d) defer timer.Stop() - respHeaderTimer = timer.C() + respHeaderTimer = timer.C respHeaderRecv = cs.respHeaderRecv } // Wait until the peer half-closes its end of the stream, @@ -9031,7 +8924,7 @@ func (cc *http2ClientConn) awaitOpenSlotForStreamLocked(cs *http2clientStream) e // Return a fatal error which aborts the retry loop. return http2errClientConnNotEstablished } - cc.lastActive = cc.t.now() + cc.lastActive = time.Now() if cc.closed || !cc.canTakeNewRequestLocked() { return http2errClientConnUnusable } @@ -9371,10 +9264,10 @@ func (cc *http2ClientConn) forgetStreamID(id uint32) { if len(cc.streams) != slen-1 { panic("forgetting unknown stream id") } - cc.lastActive = cc.t.now() + cc.lastActive = time.Now() if len(cc.streams) == 0 && cc.idleTimer != nil { cc.idleTimer.Reset(cc.idleTimeout) - cc.lastIdle = cc.t.now() + cc.lastIdle = time.Now() } // Wake up writeRequestBody via clientStream.awaitFlowControl and // wake up RoundTrip if there is a pending request. @@ -9400,7 +9293,6 @@ type http2clientConnReadLoop struct { // readLoop runs in its own goroutine and reads and dispatches frames. func (cc *http2ClientConn) readLoop() { - cc.t.markNewGoroutine() rl := &http2clientConnReadLoop{cc: cc} defer rl.cleanup() cc.readerErr = rl.run() @@ -9467,9 +9359,9 @@ func (rl *http2clientConnReadLoop) cleanup() { if cc.idleTimeout > 0 && unusedWaitTime > cc.idleTimeout { unusedWaitTime = cc.idleTimeout } - idleTime := cc.t.now().Sub(cc.lastActive) + idleTime := time.Now().Sub(cc.lastActive) if atomic.LoadUint32(&cc.atomicReused) == 0 && idleTime < unusedWaitTime && !cc.closedOnIdle { - cc.idleTimer = cc.t.afterFunc(unusedWaitTime-idleTime, func() { + cc.idleTimer = time.AfterFunc(unusedWaitTime-idleTime, func() { cc.t.connPool().MarkDead(cc) }) } else { @@ -9529,9 +9421,9 @@ func (rl *http2clientConnReadLoop) run() error { cc := rl.cc gotSettings := false readIdleTimeout := cc.readIdleTimeout - var t http2timer + var t *time.Timer if readIdleTimeout != 0 { - t = cc.t.afterFunc(readIdleTimeout, cc.healthCheck) + t = time.AfterFunc(readIdleTimeout, cc.healthCheck) } for { f, err := cc.fr.ReadFrame() @@ -10277,7 +10169,6 @@ func (cc *http2ClientConn) Ping(ctx context.Context) error { var pingError error errc := make(chan struct{}) go func() { - cc.t.markNewGoroutine() cc.wmu.Lock() defer cc.wmu.Unlock() if pingError = cc.fr.WritePing(false, p); pingError != nil { @@ -10510,7 +10401,7 @@ func http2traceGotConn(req *Request, cc *http2ClientConn, reused bool) { cc.mu.Lock() ci.WasIdle = len(cc.streams) == 0 && reused if ci.WasIdle && !cc.lastActive.IsZero() { - ci.IdleTime = cc.t.timeSince(cc.lastActive) + ci.IdleTime = time.Since(cc.lastActive) } cc.mu.Unlock() diff --git a/src/syscall/zsyscall_windows.go b/src/syscall/zsyscall_windows.go index 93ef850975..70ac19a9d6 100644 --- a/src/syscall/zsyscall_windows.go +++ b/src/syscall/zsyscall_windows.go @@ -200,7 +200,7 @@ var ( ) func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) + r1, _, e1 := SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid))) if r1 == 0 { err = errnoErr(e1) } @@ -208,7 +208,7 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { } func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) + r1, _, e1 := SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid))) if r1 == 0 { err = errnoErr(e1) } @@ -216,7 +216,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { } func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) + r1, _, e1 := SyscallN(procCopySid.Addr(), uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) if r1 == 0 { err = errnoErr(e1) } @@ -228,7 +228,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc if inheritHandles { _p0 = 1 } - r1, _, e1 := Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0) + r1, _, e1 := SyscallN(procCreateProcessAsUserW.Addr(), uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -236,7 +236,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc } func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) + r1, _, e1 := SyscallN(procCryptAcquireContextW.Addr(), uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -244,7 +244,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 } func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r1, _, e1 := SyscallN(procCryptGenRandom.Addr(), uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if r1 == 0 { err = errnoErr(e1) } @@ -252,7 +252,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { } func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) + r1, _, e1 := SyscallN(procCryptReleaseContext.Addr(), uintptr(provhandle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -260,13 +260,13 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { } func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := SyscallN(procGetLengthSid.Addr(), uintptr(unsafe.Pointer(sid))) len = uint32(r0) return } func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) + r1, _, e1 := SyscallN(procGetTokenInformation.Addr(), uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen))) if r1 == 0 { err = errnoErr(e1) } @@ -274,7 +274,7 @@ func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, } func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -282,7 +282,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen } func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -290,7 +290,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 } func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { - r1, _, e1 := Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) + r1, _, e1 := SyscallN(procOpenProcessToken.Addr(), uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -298,7 +298,7 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { } func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) + r0, _, _ := SyscallN(procRegCloseKey.Addr(), uintptr(key)) if r0 != 0 { regerrno = Errno(r0) } @@ -306,7 +306,7 @@ func RegCloseKey(key Handle) (regerrno error) { } func regEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) + r0, _, _ := SyscallN(procRegEnumKeyExW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = Errno(r0) } @@ -314,7 +314,7 @@ func regEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reser } func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) + r0, _, _ := SyscallN(procRegOpenKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) if r0 != 0 { regerrno = Errno(r0) } @@ -322,7 +322,7 @@ func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint } func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) + r0, _, _ := SyscallN(procRegQueryInfoKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = Errno(r0) } @@ -330,7 +330,7 @@ func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint } func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + r0, _, _ := SyscallN(procRegQueryValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) if r0 != 0 { regerrno = Errno(r0) } @@ -338,7 +338,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 } func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) + r1, _, e1 := SyscallN(procCertAddCertificateContextToStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext))) if r1 == 0 { err = errnoErr(e1) } @@ -346,7 +346,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad } func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) + r1, _, e1 := SyscallN(procCertCloseStore.Addr(), uintptr(store), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -354,7 +354,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { } func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) + r0, _, e1 := SyscallN(procCertCreateCertificateContext.Addr(), uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -363,7 +363,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en } func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) + r0, _, e1 := SyscallN(procCertEnumCertificatesInStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(prevContext))) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -372,12 +372,12 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex } func CertFreeCertificateChain(ctx *CertChainContext) { - Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + SyscallN(procCertFreeCertificateChain.Addr(), uintptr(unsafe.Pointer(ctx))) return } func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + r1, _, e1 := SyscallN(procCertFreeCertificateContext.Addr(), uintptr(unsafe.Pointer(ctx))) if r1 == 0 { err = errnoErr(e1) } @@ -385,7 +385,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { } func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) + r1, _, e1 := SyscallN(procCertGetCertificateChain.Addr(), uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx))) if r1 == 0 { err = errnoErr(e1) } @@ -393,7 +393,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a } func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) + r0, _, e1 := SyscallN(procCertOpenStore.Addr(), uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -402,7 +402,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr } func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := SyscallN(procCertOpenSystemStoreW.Addr(), uintptr(hprov), uintptr(unsafe.Pointer(name))) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -411,7 +411,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { } func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) + r1, _, e1 := SyscallN(procCertVerifyCertificateChainPolicy.Addr(), uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -419,7 +419,7 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext } func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) + r0, _, _ := SyscallN(procDnsNameCompare_W.Addr(), uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2))) same = r0 != 0 return } @@ -434,7 +434,7 @@ func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSR } func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + r0, _, _ := SyscallN(procDnsQuery_W.Addr(), uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) if r0 != 0 { status = Errno(r0) } @@ -442,12 +442,12 @@ func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DN } func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) + SyscallN(procDnsRecordListFree.Addr(), uintptr(unsafe.Pointer(rl)), uintptr(freetype)) return } func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) + r0, _, _ := SyscallN(procGetAdaptersInfo.Addr(), uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol))) if r0 != 0 { errcode = Errno(r0) } @@ -455,7 +455,7 @@ func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { } func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) + r0, _, _ := SyscallN(procGetIfEntry.Addr(), uintptr(unsafe.Pointer(pIfRow))) if r0 != 0 { errcode = Errno(r0) } @@ -463,7 +463,7 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { } func CancelIo(s Handle) (err error) { - r1, _, e1 := Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := SyscallN(procCancelIo.Addr(), uintptr(s)) if r1 == 0 { err = errnoErr(e1) } @@ -471,7 +471,7 @@ func CancelIo(s Handle) (err error) { } func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) + r1, _, e1 := SyscallN(procCancelIoEx.Addr(), uintptr(s), uintptr(unsafe.Pointer(o))) if r1 == 0 { err = errnoErr(e1) } @@ -479,7 +479,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { } func CloseHandle(handle Handle) (err error) { - r1, _, e1 := Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := SyscallN(procCloseHandle.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -487,7 +487,7 @@ func CloseHandle(handle Handle) (err error) { } func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) + r1, _, e1 := SyscallN(procCreateDirectoryW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa))) if r1 == 0 { err = errnoErr(e1) } @@ -495,7 +495,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { } func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + r0, _, e1 := SyscallN(procCreateFileMappingW.Addr(), uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -504,7 +504,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS } func createFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { - r0, _, e1 := Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) + r0, _, e1 := SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) handle = Handle(r0) if handle == InvalidHandle || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -513,7 +513,7 @@ func createFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes } func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + r1, _, e1 := SyscallN(procCreateHardLinkW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -521,7 +521,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr } func createIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + r0, _, e1 := SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -530,7 +530,7 @@ func createIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, thr } func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) + r1, _, e1 := SyscallN(procCreatePipe.Addr(), uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -542,7 +542,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA if inheritHandles { _p0 = 1 } - r1, _, e1 := Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) + r1, _, e1 := SyscallN(procCreateProcessW.Addr(), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -550,7 +550,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA } func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + r1, _, e1 := SyscallN(procCreateSymbolicLinkW.Addr(), uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -558,7 +558,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u } func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) + r0, _, e1 := SyscallN(procCreateToolhelp32Snapshot.Addr(), uintptr(flags), uintptr(processId)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -567,7 +567,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er } func DeleteFile(path *uint16) (err error) { - r1, _, e1 := Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := SyscallN(procDeleteFileW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -575,12 +575,12 @@ func DeleteFile(path *uint16) (err error) { } func deleteProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST) { - Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) + SyscallN(procDeleteProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist))) return } func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := SyscallN(procDeviceIoControl.Addr(), uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -592,7 +592,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP if bInheritHandle { _p0 = 1 } - r1, _, e1 := Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) + r1, _, e1 := SyscallN(procDuplicateHandle.Addr(), uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions)) if r1 == 0 { err = errnoErr(e1) } @@ -600,12 +600,12 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP } func ExitProcess(exitcode uint32) { - Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) + SyscallN(procExitProcess.Addr(), uintptr(exitcode)) return } func FindClose(handle Handle) (err error) { - r1, _, e1 := Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := SyscallN(procFindClose.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -613,7 +613,7 @@ func FindClose(handle Handle) (err error) { } func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) + r0, _, e1 := SyscallN(procFindFirstFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data))) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -622,7 +622,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro } func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := SyscallN(procFindNextFileW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -630,7 +630,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { } func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := SyscallN(procFlushFileBuffers.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -638,7 +638,7 @@ func FlushFileBuffers(handle Handle) (err error) { } func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := SyscallN(procFlushViewOfFile.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -650,7 +650,7 @@ func formatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) + r0, _, e1 := SyscallN(procFormatMessageW.Addr(), uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -659,7 +659,7 @@ func formatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu } func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) + r1, _, e1 := SyscallN(procFreeEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(envs))) if r1 == 0 { err = errnoErr(e1) } @@ -667,7 +667,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { } func FreeLibrary(handle Handle) (err error) { - r1, _, e1 := Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := SyscallN(procFreeLibrary.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -675,13 +675,13 @@ func FreeLibrary(handle Handle) (err error) { } func GetCommandLine() (cmd *uint16) { - r0, _, _ := Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) + r0, _, _ := SyscallN(procGetCommandLineW.Addr()) cmd = (*uint16)(unsafe.Pointer(r0)) return } func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) + r1, _, e1 := SyscallN(procGetComputerNameW.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -689,7 +689,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { } func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) + r1, _, e1 := SyscallN(procGetConsoleMode.Addr(), uintptr(console), uintptr(unsafe.Pointer(mode))) if r1 == 0 { err = errnoErr(e1) } @@ -697,7 +697,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { } func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := SyscallN(procGetCurrentDirectoryW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -706,7 +706,7 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { } func GetCurrentProcess() (pseudoHandle Handle, err error) { - r0, _, e1 := Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0) + r0, _, e1 := SyscallN(procGetCurrentProcess.Addr()) pseudoHandle = Handle(r0) if pseudoHandle == 0 { err = errnoErr(e1) @@ -715,13 +715,13 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) { } func getCurrentProcessId() (pid uint32) { - r0, _, _ := Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) + r0, _, _ := SyscallN(procGetCurrentProcessId.Addr()) pid = uint32(r0) return } func GetEnvironmentStrings() (envs *uint16, err error) { - r0, _, e1 := Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) + r0, _, e1 := SyscallN(procGetEnvironmentStringsW.Addr()) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { err = errnoErr(e1) @@ -730,7 +730,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { } func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + r0, _, e1 := SyscallN(procGetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -739,7 +739,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 } func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) + r1, _, e1 := SyscallN(procGetExitCodeProcess.Addr(), uintptr(handle), uintptr(unsafe.Pointer(exitcode))) if r1 == 0 { err = errnoErr(e1) } @@ -747,7 +747,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { } func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) + r1, _, e1 := SyscallN(procGetFileAttributesExW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -755,7 +755,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { } func GetFileAttributes(name *uint16) (attrs uint32, err error) { - r0, _, e1 := Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := SyscallN(procGetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name))) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { err = errnoErr(e1) @@ -764,7 +764,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { } func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := SyscallN(procGetFileInformationByHandle.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -772,7 +772,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e } func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) + r0, _, e1 := SyscallN(procGetFileType.Addr(), uintptr(filehandle)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -781,7 +781,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { } func getFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { - r0, _, e1 := Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) + r0, _, e1 := SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) n = uint32(r0) if n == 0 || n >= filePathSize { err = errnoErr(e1) @@ -790,7 +790,7 @@ func getFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32 } func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) + r0, _, e1 := SyscallN(procGetFullPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -799,7 +799,7 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( } func GetLastError() (lasterr error) { - r0, _, _ := Syscall(procGetLastError.Addr(), 0, 0, 0, 0) + r0, _, _ := SyscallN(procGetLastError.Addr()) if r0 != 0 { lasterr = Errno(r0) } @@ -807,7 +807,7 @@ func GetLastError() (lasterr error) { } func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) + r0, _, e1 := SyscallN(procGetLongPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -825,7 +825,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { } func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { - r0, _, e1 := Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) + r0, _, e1 := SyscallN(procGetProcAddress.Addr(), uintptr(module), uintptr(unsafe.Pointer(procname))) proc = uintptr(r0) if proc == 0 { err = errnoErr(e1) @@ -834,7 +834,7 @@ func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { } func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) + r1, _, e1 := SyscallN(procGetProcessTimes.Addr(), uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) if r1 == 0 { err = errnoErr(e1) } @@ -842,7 +842,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, } func getQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) + r1, _, e1 := SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout)) if r1 == 0 { err = errnoErr(e1) } @@ -850,7 +850,7 @@ func getQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overl } func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + r0, _, e1 := SyscallN(procGetShortPathNameW.Addr(), uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -859,12 +859,12 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin } func getStartupInfo(startupInfo *StartupInfo) { - Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) + SyscallN(procGetStartupInfoW.Addr(), uintptr(unsafe.Pointer(startupInfo))) return } func GetStdHandle(stdhandle int) (handle Handle, err error) { - r0, _, e1 := Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) + r0, _, e1 := SyscallN(procGetStdHandle.Addr(), uintptr(stdhandle)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -873,12 +873,12 @@ func GetStdHandle(stdhandle int) (handle Handle, err error) { } func GetSystemTimeAsFileTime(time *Filetime) { - Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + SyscallN(procGetSystemTimeAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) return } func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := SyscallN(procGetTempPathW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -887,7 +887,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { } func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) + r0, _, e1 := SyscallN(procGetTimeZoneInformation.Addr(), uintptr(unsafe.Pointer(tzi))) rc = uint32(r0) if rc == 0xffffffff { err = errnoErr(e1) @@ -896,7 +896,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { } func GetVersion() (ver uint32, err error) { - r0, _, e1 := Syscall(procGetVersion.Addr(), 0, 0, 0, 0) + r0, _, e1 := SyscallN(procGetVersion.Addr()) ver = uint32(r0) if ver == 0 { err = errnoErr(e1) @@ -905,7 +905,7 @@ func GetVersion() (ver uint32, err error) { } func initializeProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, attrcount uint32, flags uint32, size *uintptr) (err error) { - r1, _, e1 := Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := SyscallN(procInitializeProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -922,7 +922,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { } func _LoadLibrary(libname *uint16) (handle Handle, err error) { - r0, _, e1 := Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) + r0, _, e1 := SyscallN(procLoadLibraryW.Addr(), uintptr(unsafe.Pointer(libname))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -931,7 +931,7 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { } func localAlloc(flags uint32, length uint32) (ptr uintptr, err error) { - r0, _, e1 := Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) + r0, _, e1 := SyscallN(procLocalAlloc.Addr(), uintptr(flags), uintptr(length)) ptr = uintptr(r0) if ptr == 0 { err = errnoErr(e1) @@ -940,7 +940,7 @@ func localAlloc(flags uint32, length uint32) (ptr uintptr, err error) { } func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) + r0, _, e1 := SyscallN(procLocalFree.Addr(), uintptr(hmem)) handle = Handle(r0) if handle != 0 { err = errnoErr(e1) @@ -949,7 +949,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { } func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) + r0, _, e1 := SyscallN(procMapViewOfFile.Addr(), uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length)) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -958,7 +958,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui } func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) + r1, _, e1 := SyscallN(procMoveFileW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to))) if r1 == 0 { err = errnoErr(e1) } @@ -970,7 +970,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err if inheritHandle { _p0 = 1 } - r0, _, e1 := Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid)) + r0, _, e1 := SyscallN(procOpenProcess.Addr(), uintptr(da), uintptr(_p0), uintptr(pid)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -979,7 +979,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err } func postQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { - r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) + r1, _, e1 := SyscallN(procPostQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -987,7 +987,7 @@ func postQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overla } func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := SyscallN(procProcess32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -995,7 +995,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := SyscallN(procProcess32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -1003,7 +1003,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) + r1, _, e1 := SyscallN(procReadConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl))) if r1 == 0 { err = errnoErr(e1) } @@ -1015,7 +1015,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree if watchSubTree { _p0 = 1 } - r1, _, e1 := Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) + r1, _, e1 := SyscallN(procReadDirectoryChangesW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == 0 { err = errnoErr(e1) } @@ -1027,7 +1027,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := SyscallN(procReadFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1035,7 +1035,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( } func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := SyscallN(procRemoveDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -1043,7 +1043,7 @@ func RemoveDirectory(path *uint16) (err error) { } func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := SyscallN(procSetCurrentDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -1051,7 +1051,7 @@ func SetCurrentDirectory(path *uint16) (err error) { } func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := SyscallN(procSetEndOfFile.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1059,7 +1059,7 @@ func SetEndOfFile(handle Handle) (err error) { } func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) + r1, _, e1 := SyscallN(procSetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value))) if r1 == 0 { err = errnoErr(e1) } @@ -1067,7 +1067,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { } func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) + r1, _, e1 := SyscallN(procSetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(attrs)) if r1 == 0 { err = errnoErr(e1) } @@ -1075,7 +1075,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { } func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) + r1, _, e1 := SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(handle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -1083,7 +1083,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) } func setFileInformationByHandle(handle Handle, fileInformationClass uint32, buf unsafe.Pointer, bufsize uint32) (err error) { - r1, _, e1 := Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize), 0, 0) + r1, _, e1 := SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize)) if r1 == 0 { err = errnoErr(e1) } @@ -1091,7 +1091,7 @@ func setFileInformationByHandle(handle Handle, fileInformationClass uint32, buf } func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) + r0, _, e1 := SyscallN(procSetFilePointer.Addr(), uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence)) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { err = errnoErr(e1) @@ -1100,7 +1100,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence } func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + r1, _, e1 := SyscallN(procSetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) if r1 == 0 { err = errnoErr(e1) } @@ -1108,7 +1108,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) + r1, _, e1 := SyscallN(procSetHandleInformation.Addr(), uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -1116,7 +1116,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) } func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) + r1, _, e1 := SyscallN(procTerminateProcess.Addr(), uintptr(handle), uintptr(exitcode)) if r1 == 0 { err = errnoErr(e1) } @@ -1124,7 +1124,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { } func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) + r1, _, e1 := SyscallN(procUnmapViewOfFile.Addr(), uintptr(addr)) if r1 == 0 { err = errnoErr(e1) } @@ -1132,7 +1132,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { } func updateProcThreadAttribute(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { - r1, _, e1 := Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) + r1, _, e1 := SyscallN(procUpdateProcThreadAttribute.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize))) if r1 == 0 { err = errnoErr(e1) } @@ -1140,7 +1140,7 @@ func updateProcThreadAttribute(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, flags uint } func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := SyscallN(procVirtualLock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -1148,7 +1148,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { } func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := SyscallN(procVirtualUnlock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -1156,7 +1156,7 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { } func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) + r0, _, e1 := SyscallN(procWaitForSingleObject.Addr(), uintptr(handle), uintptr(waitMilliseconds)) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -1165,7 +1165,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, } func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) + r1, _, e1 := SyscallN(procWriteConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved))) if r1 == 0 { err = errnoErr(e1) } @@ -1177,7 +1177,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := SyscallN(procWriteFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1185,7 +1185,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) } func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := SyscallN(procAcceptEx.Addr(), uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1193,12 +1193,12 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 } func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) + SyscallN(procGetAcceptExSockaddrs.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen))) return } func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + r1, _, e1 := SyscallN(procTransmitFile.Addr(), uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -1206,7 +1206,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint } func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := SyscallN(procNetApiBufferFree.Addr(), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = Errno(r0) } @@ -1214,7 +1214,7 @@ func NetApiBufferFree(buf *byte) (neterr error) { } func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + r0, _, _ := SyscallN(procNetGetJoinInformation.Addr(), uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) if r0 != 0 { neterr = Errno(r0) } @@ -1222,7 +1222,7 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete } func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := SyscallN(procNetUserGetInfo.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = Errno(r0) } @@ -1230,7 +1230,7 @@ func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **by } func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + r1, _, e1 := SyscallN(procGetUserNameExW.Addr(), uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1238,7 +1238,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er } func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) + r1, _, e1 := SyscallN(procTranslateNameW.Addr(), uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1246,7 +1246,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint } func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { - r0, _, e1 := Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) + r0, _, e1 := SyscallN(procCommandLineToArgvW.Addr(), uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc))) argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) if argv == nil { err = errnoErr(e1) @@ -1255,7 +1255,7 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err } func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) + r1, _, e1 := SyscallN(procGetUserProfileDirectoryW.Addr(), uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { err = errnoErr(e1) } @@ -1263,12 +1263,12 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { } func FreeAddrInfoW(addrinfo *AddrinfoW) { - Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) + SyscallN(procFreeAddrInfoW.Addr(), uintptr(unsafe.Pointer(addrinfo))) return } func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) + r0, _, _ := SyscallN(procGetAddrInfoW.Addr(), uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result))) if r0 != 0 { sockerr = Errno(r0) } @@ -1276,7 +1276,7 @@ func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, resul } func WSACleanup() (err error) { - r1, _, e1 := Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) + r1, _, e1 := SyscallN(procWSACleanup.Addr()) if r1 == socket_error { err = errnoErr(e1) } @@ -1284,7 +1284,7 @@ func WSACleanup() (err error) { } func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + r0, _, e1 := SyscallN(procWSAEnumProtocolsW.Addr(), uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -1293,7 +1293,7 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL } func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + r1, _, e1 := SyscallN(procWSAIoctl.Addr(), uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { err = errnoErr(e1) } @@ -1301,7 +1301,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo } func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := SyscallN(procWSARecv.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -1309,7 +1309,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 } func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := SyscallN(procWSARecvFrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -1317,7 +1317,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui } func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := SyscallN(procWSASend.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -1325,7 +1325,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, } func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := SyscallN(procWSASendTo.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -1333,7 +1333,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 } func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) + r0, _, _ := SyscallN(procWSAStartup.Addr(), uintptr(verreq), uintptr(unsafe.Pointer(data))) if r0 != 0 { sockerr = Errno(r0) } @@ -1341,7 +1341,7 @@ func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { } func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -1349,7 +1349,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { } func Closesocket(s Handle) (err error) { - r1, _, e1 := Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := SyscallN(procclosesocket.Addr(), uintptr(s)) if r1 == socket_error { err = errnoErr(e1) } @@ -1357,7 +1357,7 @@ func Closesocket(s Handle) (err error) { } func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := SyscallN(procconnect.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -1374,7 +1374,7 @@ func GetHostByName(name string) (h *Hostent, err error) { } func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := SyscallN(procgethostbyname.Addr(), uintptr(unsafe.Pointer(name))) h = (*Hostent)(unsafe.Pointer(r0)) if h == nil { err = errnoErr(e1) @@ -1383,7 +1383,7 @@ func _GetHostByName(name *byte) (h *Hostent, err error) { } func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -1400,7 +1400,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { } func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := SyscallN(procgetprotobyname.Addr(), uintptr(unsafe.Pointer(name))) p = (*Protoent)(unsafe.Pointer(r0)) if p == nil { err = errnoErr(e1) @@ -1423,7 +1423,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { } func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) + r0, _, e1 := SyscallN(procgetservbyname.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto))) s = (*Servent)(unsafe.Pointer(r0)) if s == nil { err = errnoErr(e1) @@ -1432,7 +1432,7 @@ func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { } func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -1440,7 +1440,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { } func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) + r1, _, e1 := SyscallN(procgetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -1448,7 +1448,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 } func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) + r1, _, e1 := SyscallN(proclisten.Addr(), uintptr(s), uintptr(backlog)) if r1 == socket_error { err = errnoErr(e1) } @@ -1456,13 +1456,13 @@ func listen(s Handle, backlog int32) (err error) { } func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) + r0, _, _ := SyscallN(procntohs.Addr(), uintptr(netshort)) u = uint16(r0) return } func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) + r1, _, e1 := SyscallN(procsetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen)) if r1 == socket_error { err = errnoErr(e1) } @@ -1470,7 +1470,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 } func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) + r1, _, e1 := SyscallN(procshutdown.Addr(), uintptr(s), uintptr(how)) if r1 == socket_error { err = errnoErr(e1) } @@ -1478,7 +1478,7 @@ func shutdown(s Handle, how int32) (err error) { } func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) + r0, _, e1 := SyscallN(procsocket.Addr(), uintptr(af), uintptr(typ), uintptr(protocol)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 645cec45e2..cf5c27c745 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -1,13 +1,13 @@ -# golang.org/x/crypto v0.41.0 -## explicit; go 1.23.0 +# golang.org/x/crypto v0.42.0 +## explicit; go 1.24.0 golang.org/x/crypto/chacha20 golang.org/x/crypto/chacha20poly1305 golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 -# golang.org/x/net v0.43.0 -## explicit; go 1.23.0 +# golang.org/x/net v0.44.0 +## explicit; go 1.24.0 golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts golang.org/x/net/http/httpproxy @@ -15,11 +15,11 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/lif golang.org/x/net/nettest -# golang.org/x/sys v0.35.0 -## explicit; go 1.23.0 +# golang.org/x/sys v0.36.0 +## explicit; go 1.24.0 golang.org/x/sys/cpu -# golang.org/x/text v0.28.0 -## explicit; go 1.23.0 +# golang.org/x/text v0.29.0 +## explicit; go 1.24.0 golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi -- cgit v1.3-5-g45d5 From ac803b5949f6dbc5bfa559afe506d35f9e1b3195 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Thu, 11 Sep 2025 11:02:03 -0400 Subject: cmd/go/internal/work: copy vet tool's stdout to our stdout The go command connects both the stdout and stderr files of its child commands (cmd/compile, cmd/vet, etc) to the go command's own stderr. If the child command is supposed to produce structure output on stderr, as is the case for go vet -json or go fix -diff, it will be merged with the error stream, making it useless. This change to the go vet <-> unitchecker protocol specifies the name of a file into which the vet tool should write its stdout. On success, the go command will then copy the entire content of that file to its own stdout, under a lock. This ensures that partial writes to stdout in case of failure, concurrent writes to stdout by parallel vet tasks, or other junk on stderr, cannot interfere with the integrity of the go command's structure output on stdout. CL 702835 is the corresponding change on the x/tools side. For #75432 Change-Id: Ib4db25b6b0095d359152d7543bd9bf692551bbfa Reviewed-on: https://go-review.googlesource.com/c/go/+/702815 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob Auto-Submit: Alan Donovan --- src/cmd/go/internal/work/exec.go | 18 ++++++++++++++++-- src/cmd/go/testdata/script/vet_asm.txt | 11 ++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index b68795b917..51cb2e5a04 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1184,6 +1184,7 @@ type vetConfig struct { PackageVetx map[string]string // map package path to vetx data from earlier vet run VetxOnly bool // only compute vetx data; don't report detected problems VetxOutput string // write vetx data to this output file + Stdout string // write stdout (JSON, unified diff) to this output file GoVersion string // Go version for package SucceedOnTypecheckFailure bool // awful hack; see #18395 and below @@ -1297,6 +1298,7 @@ func (b *Builder) vet(ctx context.Context, a *Action) error { vcfg.VetxOnly = a.VetxOnly vcfg.VetxOutput = a.Objdir + "vet.out" + vcfg.Stdout = a.Objdir + "vet.stdout" vcfg.PackageVetx = make(map[string]string) h := cache.NewHash("vet " + a.Package.ImportPath) @@ -1392,13 +1394,25 @@ func (b *Builder) vet(ctx context.Context, a *Action) error { // If vet wrote export data, save it for input to future vets. if f, err := os.Open(vcfg.VetxOutput); err == nil { a.built = vcfg.VetxOutput - cache.Default().Put(key, f) - f.Close() + cache.Default().Put(key, f) // ignore error + f.Close() // ignore error + } + + // If vet wrote to stdout, copy it to go's stdout, atomically. + if f, err := os.Open(vcfg.Stdout); err == nil { + stdoutMu.Lock() + if _, err := io.Copy(os.Stdout, f); err != nil && runErr == nil { + runErr = fmt.Errorf("copying vet tool stdout: %w", err) + } + f.Close() // ignore error + stdoutMu.Unlock() } return runErr } +var stdoutMu sync.Mutex // serializes concurrent writes (e.g. JSON values) to stdout + // linkActionID computes the action ID for a link action. func (b *Builder) linkActionID(a *Action) cache.ActionID { p := a.Package diff --git a/src/cmd/go/testdata/script/vet_asm.txt b/src/cmd/go/testdata/script/vet_asm.txt index ae2db97794..8aa69ce1a3 100644 --- a/src/cmd/go/testdata/script/vet_asm.txt +++ b/src/cmd/go/testdata/script/vet_asm.txt @@ -14,12 +14,13 @@ stderr '2 MOVW' stderr '3 RET' stderr '4' -# -json causes success, even with diagnostics and errors. +# -json causes success, even with diagnostics and errors, +# and writes to stdout. go vet -json -asmdecl a -stderr '"a": {' -stderr '"asmdecl":' -stderr '"posn": ".*asm.s:2:1",' -stderr '"message": ".*invalid MOVW.*"' +stdout '"a": {' +stdout '"asmdecl":' +stdout '"posn": ".*asm.s:2:1",' +stdout '"message": ".*invalid MOVW.*"' -- a/a.go -- package a -- cgit v1.3-5-g45d5 From 30d510ca2de41fd7af21890ee23611b72048e462 Mon Sep 17 00:00:00 2001 From: apocelipes Date: Thu, 11 Sep 2025 19:08:37 +0000 Subject: cmd/compile,cmd/gofmt: use reflect.TypeFor Use "reflect.TypeFor" to simplify the code. Updates #60088 Change-Id: I93db6cbd4f02813d9a81f5d02996db8128cb81a9 GitHub-Last-Rev: 2aee64dac6e13ef869aa73f2abf236650e1c1757 GitHub-Pull-Request: golang/go#75349 Reviewed-on: https://go-review.googlesource.com/c/go/+/701676 Reviewed-by: Mark Freeman Auto-Submit: Keith Randall Reviewed-by: Keith Randall Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/base/flag.go | 16 ++++++++-------- src/cmd/compile/internal/ir/fmt.go | 2 +- src/cmd/compile/internal/rttype/rttype.go | 32 +++++++++++++++---------------- src/cmd/gofmt/rewrite.go | 10 +++++----- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index e87f57cdaa..1b52ab660c 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -383,14 +383,14 @@ func ParseFlags() { // See the comment on type CmdFlags for the rules. func registerFlags() { var ( - boolType = reflect.TypeOf(bool(false)) - intType = reflect.TypeOf(int(0)) - stringType = reflect.TypeOf(string("")) - ptrBoolType = reflect.TypeOf(new(bool)) - ptrIntType = reflect.TypeOf(new(int)) - ptrStringType = reflect.TypeOf(new(string)) - countType = reflect.TypeOf(CountFlag(0)) - funcType = reflect.TypeOf((func(string))(nil)) + boolType = reflect.TypeFor[bool]() + intType = reflect.TypeFor[int]() + stringType = reflect.TypeFor[string]() + ptrBoolType = reflect.TypeFor[*bool]() + ptrIntType = reflect.TypeFor[*int]() + ptrStringType = reflect.TypeFor[*string]() + countType = reflect.TypeFor[CountFlag]() + funcType = reflect.TypeFor[func(string)]() ) v := reflect.ValueOf(&Flag).Elem() diff --git a/src/cmd/compile/internal/ir/fmt.go b/src/cmd/compile/internal/ir/fmt.go index 31c610348b..ae4ff62652 100644 --- a/src/cmd/compile/internal/ir/fmt.go +++ b/src/cmd/compile/internal/ir/fmt.go @@ -1194,7 +1194,7 @@ func dumpNode(w io.Writer, n Node, depth int) { } } -var nodeType = reflect.TypeOf((*Node)(nil)).Elem() +var nodeType = reflect.TypeFor[Node]() func dumpNodes(w io.Writer, list Nodes, depth int) { if len(list) == 0 { diff --git a/src/cmd/compile/internal/rttype/rttype.go b/src/cmd/compile/internal/rttype/rttype.go index 925d3901d4..b8c9533991 100644 --- a/src/cmd/compile/internal/rttype/rttype.go +++ b/src/cmd/compile/internal/rttype/rttype.go @@ -49,25 +49,25 @@ func Init() { // Note: this has to be called explicitly instead of being // an init function so it runs after the types package has // been properly initialized. - Type = FromReflect(reflect.TypeOf(abi.Type{})) - ArrayType = FromReflect(reflect.TypeOf(abi.ArrayType{})) - ChanType = FromReflect(reflect.TypeOf(abi.ChanType{})) - FuncType = FromReflect(reflect.TypeOf(abi.FuncType{})) - InterfaceType = FromReflect(reflect.TypeOf(abi.InterfaceType{})) - MapType = FromReflect(reflect.TypeOf(abi.MapType{})) - PtrType = FromReflect(reflect.TypeOf(abi.PtrType{})) - SliceType = FromReflect(reflect.TypeOf(abi.SliceType{})) - StructType = FromReflect(reflect.TypeOf(abi.StructType{})) + Type = FromReflect(reflect.TypeFor[abi.Type]()) + ArrayType = FromReflect(reflect.TypeFor[abi.ArrayType]()) + ChanType = FromReflect(reflect.TypeFor[abi.ChanType]()) + FuncType = FromReflect(reflect.TypeFor[abi.FuncType]()) + InterfaceType = FromReflect(reflect.TypeFor[abi.InterfaceType]()) + MapType = FromReflect(reflect.TypeFor[abi.MapType]()) + PtrType = FromReflect(reflect.TypeFor[abi.PtrType]()) + SliceType = FromReflect(reflect.TypeFor[abi.SliceType]()) + StructType = FromReflect(reflect.TypeFor[abi.StructType]()) - IMethod = FromReflect(reflect.TypeOf(abi.Imethod{})) - Method = FromReflect(reflect.TypeOf(abi.Method{})) - StructField = FromReflect(reflect.TypeOf(abi.StructField{})) - UncommonType = FromReflect(reflect.TypeOf(abi.UncommonType{})) + IMethod = FromReflect(reflect.TypeFor[abi.Imethod]()) + Method = FromReflect(reflect.TypeFor[abi.Method]()) + StructField = FromReflect(reflect.TypeFor[abi.StructField]()) + UncommonType = FromReflect(reflect.TypeFor[abi.UncommonType]()) - InterfaceSwitch = FromReflect(reflect.TypeOf(abi.InterfaceSwitch{})) - TypeAssert = FromReflect(reflect.TypeOf(abi.TypeAssert{})) + InterfaceSwitch = FromReflect(reflect.TypeFor[abi.InterfaceSwitch]()) + TypeAssert = FromReflect(reflect.TypeFor[abi.TypeAssert]()) - ITab = FromReflect(reflect.TypeOf(abi.ITab{})) + ITab = FromReflect(reflect.TypeFor[abi.ITab]()) // Make sure abi functions are correct. These functions are used // by the linker which doesn't have the ability to do type layout, diff --git a/src/cmd/gofmt/rewrite.go b/src/cmd/gofmt/rewrite.go index 8ed093041c..847ac510ce 100644 --- a/src/cmd/gofmt/rewrite.go +++ b/src/cmd/gofmt/rewrite.go @@ -105,11 +105,11 @@ var ( objectPtrNil = reflect.ValueOf((*ast.Object)(nil)) scopePtrNil = reflect.ValueOf((*ast.Scope)(nil)) - identType = reflect.TypeOf((*ast.Ident)(nil)) - objectPtrType = reflect.TypeOf((*ast.Object)(nil)) - positionType = reflect.TypeOf(token.NoPos) - callExprType = reflect.TypeOf((*ast.CallExpr)(nil)) - scopePtrType = reflect.TypeOf((*ast.Scope)(nil)) + identType = reflect.TypeFor[*ast.Ident]() + objectPtrType = reflect.TypeFor[*ast.Object]() + positionType = reflect.TypeFor[token.Pos]() + callExprType = reflect.TypeFor[*ast.CallExpr]() + scopePtrType = reflect.TypeFor[*ast.Scope]() ) // apply replaces each AST field x in val with f(x), returning val. -- cgit v1.3-5-g45d5 From e603e9834e83ec67f0dd39c4e77683eef0593946 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 12 Sep 2025 13:46:31 -0400 Subject: cmd/link: support race mode with MSVC clang I couldn't make --print-file-name work with -msvc clang. (The library name is synchronization.lib, but even with that name it still doesn't print the full path.) Assume it always synchronization.lib. Change-Id: I22e8f14824f7f7e96b71b913217b1f604f1e2da7 Reviewed-on: https://go-review.googlesource.com/c/go/+/703398 Reviewed-by: Than McIntosh Reviewed-by: Florian Zenker LUCI-TryBot-Result: Go LUCI --- src/cmd/link/internal/ld/lib.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 516150a0a7..1a1bc18675 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -1943,7 +1943,11 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-T,"+p) } if *flagRace { - if p := ctxt.findLibPath("libsynchronization.a"); p != "libsynchronization.a" { + // Apparently --print-file-name doesn't work with -msvc clang. + // (The library name is synchronization.lib, but even with that + // name it still doesn't print the full path.) Assume it always + // it. + if isMSVC || ctxt.findLibPath("libsynchronization.a") != "libsynchronization.a" { argv = append(argv, "-lsynchronization") } } -- cgit v1.3-5-g45d5 From dbde15800c97e425f4ad1b47c1ee0c302f963fb5 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 15 Sep 2025 16:33:47 -0400 Subject: cmd: vendor x/tools@9fccddc (This brings in CL 703995.) For #71859 Change-Id: I823f2da9ebbdbef943cb37123d44a7ad2e6d708b Reviewed-on: https://go-review.googlesource.com/c/go/+/703896 Reviewed-by: Michael Matloob LUCI-TryBot-Result: Go LUCI Auto-Submit: Alan Donovan Reviewed-by: Michael Matloob --- src/cmd/go.mod | 2 +- src/cmd/go.sum | 4 +- .../x/tools/go/analysis/passes/asmdecl/asmdecl.go | 2 +- .../tools/go/analysis/passes/buildtag/buildtag.go | 2 +- .../tools/go/analysis/passes/hostport/hostport.go | 53 ++++++++++++++++------ .../x/tools/go/analysis/passes/printf/printf.go | 2 +- .../analysis/passes/unusedresult/unusedresult.go | 2 +- .../x/tools/go/analysis/unitchecker/unitchecker.go | 11 +++-- .../x/tools/internal/analysisinternal/analysis.go | 19 -------- .../tools/internal/analysisinternal/extractdoc.go | 2 +- .../golang.org/x/tools/internal/astutil/comment.go | 2 +- .../x/tools/internal/typesinternal/qualifier.go | 8 ++++ src/cmd/vendor/modules.txt | 2 +- 13 files changed, 64 insertions(+), 47 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/go.mod b/src/cmd/go.mod index e6431c0f20..c72a250aea 100644 --- a/src/cmd/go.mod +++ b/src/cmd/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/sys v0.36.0 golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 golang.org/x/term v0.34.0 - golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d + golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef ) require ( diff --git a/src/cmd/go.sum b/src/cmd/go.sum index 5a70558fe9..a4801f1843 100644 --- a/src/cmd/go.sum +++ b/src/cmd/go.sum @@ -22,7 +22,7 @@ golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= -golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d h1:ykSs3aFXygx903AtF0IG27E/xLaCW5t85BAdCALyp8s= -golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= +golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef h1:ISPkUgvOYIt0oS7oVnwAPktCKBvgWkDlWWGMgX0veZM= +golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ= diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go index 1aa7afb9c2..efbf05d596 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go @@ -237,7 +237,7 @@ Files: // so accumulate them all and then prefer the one that // matches build.Default.GOARCH. var archCandidates []*asmArch - for _, fld := range strings.Fields(m[1]) { + for fld := range strings.FieldsSeq(m[1]) { for _, a := range arches { if a.name == fld { archCandidates = append(archCandidates, a) diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go index 6c7a0df585..6e32f298dc 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go @@ -298,7 +298,7 @@ func (check *checker) plusBuildLine(pos token.Pos, line string) { fields := strings.Fields(line[len("//"):]) // IsPlusBuildConstraint check above implies fields[0] == "+build" for _, arg := range fields[1:] { - for _, elem := range strings.Split(arg, ",") { + for elem := range strings.SplitSeq(arg, ",") { if strings.HasPrefix(elem, "!!") { check.pass.Reportf(pos, "invalid double negative in build constraint: %s", arg) check.crossCheck = false diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport/hostport.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport/hostport.go index e808b1aa1b..07f154963e 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport/hostport.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport/hostport.go @@ -10,7 +10,9 @@ import ( "fmt" "go/ast" "go/constant" + "go/token" "go/types" + "strconv" "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/analysis/passes/inspect" @@ -57,13 +59,16 @@ func run(pass *analysis.Pass) (any, error) { } // checkAddr reports a diagnostic (and returns true) if e - // is a call of the form fmt.Sprintf("%d:%d", ...). + // is a call of the form fmt.Sprintf("%s:%d", ...). // The diagnostic includes a fix. // // dialCall is non-nil if the Dial call is non-local // but within the same file. checkAddr := func(e ast.Expr, dialCall *ast.CallExpr) { - if call, ok := e.(*ast.CallExpr); ok && typeutil.Callee(info, call) == fmtSprintf { + if call, ok := e.(*ast.CallExpr); ok && + len(call.Args) == 3 && + typeutil.Callee(info, call) == fmtSprintf { + // Examine format string. formatArg := call.Args[0] if tv := info.Types[formatArg]; tv.Value != nil { @@ -99,21 +104,41 @@ func run(pass *analysis.Pass) (any, error) { // Turn numeric port into a string. if numericPort { - // port => fmt.Sprintf("%d", port) - // 123 => "123" port := call.Args[2] - newPort := fmt.Sprintf(`fmt.Sprintf("%%d", %s)`, port) - if port := info.Types[port].Value; port != nil { - if i, ok := constant.Int64Val(port); ok { - newPort = fmt.Sprintf(`"%d"`, i) // numeric constant + + // Is port an integer literal? + // + // (Don't allow arbitrary constants k otherwise the + // transformation k => fmt.Sprintf("%d", "123") + // loses the symbolic connection to k.) + var kPort int64 = -1 + if lit, ok := port.(*ast.BasicLit); ok && lit.Kind == token.INT { + if v, err := strconv.ParseInt(lit.Value, 0, 64); err == nil { + kPort = v } } - - edits = append(edits, analysis.TextEdit{ - Pos: port.Pos(), - End: port.End(), - NewText: []byte(newPort), - }) + if kPort >= 0 { + // literal: 0x7B => "123" + edits = append(edits, analysis.TextEdit{ + Pos: port.Pos(), + End: port.End(), + NewText: fmt.Appendf(nil, `"%d"`, kPort), // (decimal) + }) + } else { + // non-literal: port => fmt.Sprintf("%d", port) + edits = append(edits, []analysis.TextEdit{ + { + Pos: port.Pos(), + End: port.Pos(), + NewText: []byte(`fmt.Sprintf("%d", `), + }, + { + Pos: port.End(), + End: port.End(), + NewText: []byte(`)`), + }, + }...) + } } // Refer to Dial call, if not adjacent. diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go index 9ad18a041e..f008eca36f 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go @@ -992,7 +992,7 @@ func (ss stringSet) String() string { } func (ss stringSet) Set(flag string) error { - for _, name := range strings.Split(flag, ",") { + for name := range strings.SplitSeq(flag, ",") { if len(name) == 0 { return fmt.Errorf("empty string") } diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult.go index 556ffed7d9..ed4cf7ae0b 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult.go @@ -188,7 +188,7 @@ func (ss *stringSetFlag) String() string { func (ss *stringSetFlag) Set(s string) error { m := make(map[string]bool) // clobber previous value if s != "" { - for _, name := range strings.Split(s, ",") { + for name := range strings.SplitSeq(s, ",") { if name == "" { continue // TODO: report error? proceed? } diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go index 633af5a1da..7b805b882b 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go @@ -74,7 +74,8 @@ type Config struct { VetxOnly bool // run analysis only for facts, not diagnostics VetxOutput string // where to write file of fact information Stdout string // write stdout (e.g. JSON, unified diff) to this file - SucceedOnTypecheckFailure bool + SucceedOnTypecheckFailure bool // obsolete awful hack; see #18395 and below + WarnDiagnostics bool // printing diagnostics should not cause a non-zero exit } // Main is the main function of a vet-like analysis tool that must be @@ -162,7 +163,7 @@ func Run(configFile string, analyzers []*analysis.Analyzer) { // In VetxOnly mode, the analysis is run only for facts. if !cfg.VetxOnly { - code = processResults(fset, cfg.ID, results) + code = processResults(fset, cfg.ID, results, cfg.WarnDiagnostics) } os.Exit(code) @@ -186,7 +187,7 @@ func readConfig(filename string) (*Config, error) { return cfg, nil } -func processResults(fset *token.FileSet, id string, results []result) (exit int) { +func processResults(fset *token.FileSet, id string, results []result, warnDiagnostics bool) (exit int) { if analysisflags.Fix { // Don't print the diagnostics, // but apply all fixes from the root actions. @@ -235,7 +236,9 @@ func processResults(fset *token.FileSet, id string, results []result) (exit int) for _, res := range results { for _, diag := range res.diagnostics { analysisflags.PrintPlain(os.Stderr, fset, analysisflags.Context, diag) - exit = 1 + if !warnDiagnostics { + exit = 1 + } } } } diff --git a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go index c8e349f4fe..bc7f9984e9 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go @@ -74,25 +74,6 @@ func TypeErrorEndPos(fset *token.FileSet, src []byte, start token.Pos) token.Pos return end } -// WalkASTWithParent walks the AST rooted at n. The semantics are -// similar to ast.Inspect except it does not call f(nil). -func WalkASTWithParent(n ast.Node, f func(n ast.Node, parent ast.Node) bool) { - var ancestors []ast.Node - ast.Inspect(n, func(n ast.Node) (recurse bool) { - if n == nil { - ancestors = ancestors[:len(ancestors)-1] - return false - } - - var parent ast.Node - if len(ancestors) > 0 { - parent = ancestors[len(ancestors)-1] - } - ancestors = append(ancestors, n) - return f(n, parent) - }) -} - // MatchingIdents finds the names of all identifiers in 'node' that match any of the given types. // 'pos' represents the position at which the identifiers may be inserted. 'pos' must be within // the scope of each of identifier we select. Otherwise, we will insert a variable at 'pos' that diff --git a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/extractdoc.go b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/extractdoc.go index 39507723d3..bfb5900f1b 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/extractdoc.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/extractdoc.go @@ -97,7 +97,7 @@ func ExtractDoc(content, name string) (string, error) { if f.Doc == nil { return "", fmt.Errorf("Go source file has no package doc comment") } - for _, section := range strings.Split(f.Doc.Text(), "\n# ") { + for section := range strings.SplitSeq(f.Doc.Text(), "\n# ") { if body := strings.TrimPrefix(section, "Analyzer "+name); body != section && body != "" && body[0] == '\r' || body[0] == '\n' { diff --git a/src/cmd/vendor/golang.org/x/tools/internal/astutil/comment.go b/src/cmd/vendor/golang.org/x/tools/internal/astutil/comment.go index ee4be23f22..c3a256c987 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/astutil/comment.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/astutil/comment.go @@ -15,7 +15,7 @@ import ( // https://go.dev/wiki/Deprecated, or "" if the documented symbol is not // deprecated. func Deprecation(doc *ast.CommentGroup) string { - for _, p := range strings.Split(doc.Text(), "\n\n") { + for p := range strings.SplitSeq(doc.Text(), "\n\n") { // There is still some ambiguity for deprecation message. This function // only returns the paragraph introduced by "Deprecated: ". More // information related to the deprecation may follow in additional diff --git a/src/cmd/vendor/golang.org/x/tools/internal/typesinternal/qualifier.go b/src/cmd/vendor/golang.org/x/tools/internal/typesinternal/qualifier.go index b64f714eb3..64f47919f0 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/typesinternal/qualifier.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/typesinternal/qualifier.go @@ -15,6 +15,14 @@ import ( // file. // If the same package is imported multiple times, the last appearance is // recorded. +// +// TODO(adonovan): this function ignores the effect of shadowing. It +// should accept a [token.Pos] and a [types.Info] and compute only the +// set of imports that are not shadowed at that point, analogous to +// [analysisinternal.AddImport]. It could also compute (as a side +// effect) the set of additional imports required to ensure that there +// is an accessible import for each necessary package, making it +// converge even more closely with AddImport. func FileQualifier(f *ast.File, pkg *types.Package) types.Qualifier { // Construct mapping of import paths to their defined names. // It is only necessary to look at renaming imports. diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt index 37cd448bc9..f166b77ea2 100644 --- a/src/cmd/vendor/modules.txt +++ b/src/cmd/vendor/modules.txt @@ -73,7 +73,7 @@ golang.org/x/text/internal/tag golang.org/x/text/language golang.org/x/text/transform golang.org/x/text/unicode/norm -# golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d +# golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef ## explicit; go 1.24.0 golang.org/x/tools/cmd/bisect golang.org/x/tools/cover -- cgit v1.3-5-g45d5 From 004858ccddb2f092d3413e96ba8526a8df8e3906 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 11 Sep 2025 23:48:04 +0000 Subject: all: replace os.Getenv("GO_BUILDER_NAME") with testenv.Builder in tests Some tests still reach for GO_BUILDER_NAME directly. This change makes it so that they go through testenv.Builder. There are a couple more, but changing them may also cause tests to start failing. Done in a follow-up. Change-Id: Id2453b7b62f5ebf3594e92fa53724a577a97440f Reviewed-on: https://go-review.googlesource.com/c/go/+/703135 Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI --- src/cmd/cgo/internal/testcarchive/carchive_test.go | 2 +- src/cmd/cgo/internal/testcshared/cshared_test.go | 2 +- src/cmd/cgo/internal/testplugin/plugin_test.go | 2 +- src/cmd/cgo/internal/testshared/shared_test.go | 4 ++-- src/cmd/link/link_test.go | 2 +- src/syscall/getdirentries_test.go | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/cgo/internal/testcarchive/carchive_test.go b/src/cmd/cgo/internal/testcarchive/carchive_test.go index 155eca9a73..c0ad79f231 100644 --- a/src/cmd/cgo/internal/testcarchive/carchive_test.go +++ b/src/cmd/cgo/internal/testcarchive/carchive_test.go @@ -58,7 +58,7 @@ func TestMain(m *testing.M) { } func testMain(m *testing.M) int { - if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if testing.Short() && testenv.Builder() == "" { globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") } return m.Run() } diff --git a/src/cmd/cgo/internal/testcshared/cshared_test.go b/src/cmd/cgo/internal/testcshared/cshared_test.go index 096959562c..2c4d33f599 100644 --- a/src/cmd/cgo/internal/testcshared/cshared_test.go +++ b/src/cmd/cgo/internal/testcshared/cshared_test.go @@ -44,7 +44,7 @@ func TestMain(m *testing.M) { func testMain(m *testing.M) int { log.SetFlags(log.Lshortfile) flag.Parse() - if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if testing.Short() && testenv.Builder() == "" { globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") } return m.Run() } diff --git a/src/cmd/cgo/internal/testplugin/plugin_test.go b/src/cmd/cgo/internal/testplugin/plugin_test.go index 5bff81092c..2afb542ec4 100644 --- a/src/cmd/cgo/internal/testplugin/plugin_test.go +++ b/src/cmd/cgo/internal/testplugin/plugin_test.go @@ -46,7 +46,7 @@ func prettyPrintf(format string, args ...interface{}) { } func testMain(m *testing.M) int { - if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if testing.Short() && testenv.Builder() == "" { globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") } return m.Run() } diff --git a/src/cmd/cgo/internal/testshared/shared_test.go b/src/cmd/cgo/internal/testshared/shared_test.go index e927460376..3d401b604e 100644 --- a/src/cmd/cgo/internal/testshared/shared_test.go +++ b/src/cmd/cgo/internal/testshared/shared_test.go @@ -96,7 +96,7 @@ func goCmd(t *testing.T, args ...string) string { // TestMain calls testMain so that the latter can use defer (TestMain exits with os.Exit). func testMain(m *testing.M) (int, error) { - if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if testing.Short() && testenv.Builder() == "" { globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") } return m.Run(), nil } @@ -554,7 +554,7 @@ func checkPIE(t *testing.T, name string) { } func TestTrivialPIE(t *testing.T) { - if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-alpine") { + if strings.Contains(testenv.Builder(), "-alpine") { t.Skip("skipping on alpine until issue #54354 resolved") } globalSkip(t) diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index a87d452ed3..0125ba8e0f 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -280,7 +280,7 @@ func TestBuildForTvOS(t *testing.T) { if runtime.GOOS != "darwin" { t.Skip("skipping on non-darwin platform") } - if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if testing.Short() && testenv.Builder() == "" { t.Skip("skipping in -short mode with $GO_BUILDER_NAME empty") } if err := testenv.Command(t, "xcrun", "--help").Run(); err != nil { diff --git a/src/syscall/getdirentries_test.go b/src/syscall/getdirentries_test.go index b5361ddaef..f879e2a539 100644 --- a/src/syscall/getdirentries_test.go +++ b/src/syscall/getdirentries_test.go @@ -8,6 +8,7 @@ package syscall_test import ( "fmt" + "internal/testenv" "os" "path/filepath" "slices" @@ -24,7 +25,7 @@ func TestGetdirentries(t *testing.T) { } } func testGetdirentries(t *testing.T, count int) { - if count > 100 && testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + if count > 100 && testing.Short() && testenv.Builder() == "" { t.Skip("skipping in -short mode") } d := t.TempDir() -- cgit v1.3-5-g45d5 From 9e71d8a9f7b7ff0ec2f86f4b38dd7c0fa53ad328 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 11 Sep 2025 23:50:00 +0000 Subject: cmd/internal/testdir: re-enable default all codegen flag on linux-amd64 This was limited to just the mainline linux-amd64 builder, but we don't use that name anymore. Use the LUCI name instead, gotip-linux-amd64. Change-Id: Ib4377ad336c529512d9939ff9dce0ea242528b74 Reviewed-on: https://go-review.googlesource.com/c/go/+/703136 Auto-Submit: Michael Knyszek Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI --- src/cmd/internal/testdir/testdir_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go index 5781276afa..c5aa91ba47 100644 --- a/src/cmd/internal/testdir/testdir_test.go +++ b/src/cmd/internal/testdir/testdir_test.go @@ -52,7 +52,7 @@ var ( // the linux-amd64 builder that's already very fast, so we get more // test coverage on trybots. See https://go.dev/issue/34297. func defaultAllCodeGen() bool { - return os.Getenv("GO_BUILDER_NAME") == "linux-amd64" + return testenv.Builder() == "gotip-linux-amd64" } var ( -- cgit v1.3-5-g45d5 From 8105d0ccc273afa717ba536f4d42dac3920c017e Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Fri, 12 Sep 2025 00:19:55 +0200 Subject: cmd/go,crypto/internal/fips140: prevent using FIPS 140-3 mode with purego tag Change-Id: I6a6a696414f8d5d9dc77c65b0ac9edfc982c2798 Reviewed-on: https://go-review.googlesource.com/c/go/+/703095 Auto-Submit: Filippo Valsorda LUCI-TryBot-Result: Go LUCI Reviewed-by: Mark Freeman Reviewed-by: Daniel McCarney Reviewed-by: Michael Knyszek --- src/cmd/dist/test.go | 2 ++ src/cmd/go/internal/fips140/fips140.go | 4 ++++ src/crypto/internal/fips140/fips140.go | 6 ++++++ src/crypto/internal/fips140/notpurego.go | 9 +++++++++ src/crypto/internal/fips140/purego.go | 9 +++++++++ 5 files changed, 30 insertions(+) create mode 100644 src/crypto/internal/fips140/notpurego.go create mode 100644 src/crypto/internal/fips140/purego.go (limited to 'src/cmd') diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index ec4ff649b3..7c26d001bc 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -1823,6 +1823,8 @@ func isEnvSet(evar string) bool { func (t *tester) fipsSupported() bool { // Keep this in sync with [crypto/internal/fips140.Supported]. + // We don't test with the purego tag, so no need to check it. + // Use GOFIPS140 or GOEXPERIMENT=boringcrypto, but not both. if strings.Contains(goexperiment, "boringcrypto") { return false diff --git a/src/cmd/go/internal/fips140/fips140.go b/src/cmd/go/internal/fips140/fips140.go index 7ca0cde588..4194f0ff6a 100644 --- a/src/cmd/go/internal/fips140/fips140.go +++ b/src/cmd/go/internal/fips140/fips140.go @@ -94,6 +94,7 @@ import ( "os" "path" "path/filepath" + "slices" "strings" "golang.org/x/mod/module" @@ -121,6 +122,9 @@ func Init() { if cfg.ExperimentErr == nil && cfg.Experiment.BoringCrypto && Enabled() { base.Fatalf("go: cannot use GOFIPS140 with GOEXPERIMENT=boringcrypto") } + if slices.Contains(cfg.BuildContext.BuildTags, "purego") && Enabled() { + base.Fatalf("go: cannot use GOFIPS140 with the purego build tag") + } } var initDone bool diff --git a/src/crypto/internal/fips140/fips140.go b/src/crypto/internal/fips140/fips140.go index fd265718e0..ca96c88442 100644 --- a/src/crypto/internal/fips140/fips140.go +++ b/src/crypto/internal/fips140/fips140.go @@ -33,6 +33,12 @@ func init() { func Supported() error { // Keep this in sync with fipsSupported in cmd/dist/test.go. + // The purego tag changes too much of the implementation to claim the + // validation still applies. + if puregoEnabled { + return errors.New("FIPS 140-3 mode is incompatible with the purego build tag") + } + // ASAN disapproves of reading swaths of global memory in fips140/check. // One option would be to expose runtime.asanunpoison through // crypto/internal/fips140deps and then call it to unpoison the range diff --git a/src/crypto/internal/fips140/notpurego.go b/src/crypto/internal/fips140/notpurego.go new file mode 100644 index 0000000000..7d1ec4b28b --- /dev/null +++ b/src/crypto/internal/fips140/notpurego.go @@ -0,0 +1,9 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +package fips140 + +const puregoEnabled = false diff --git a/src/crypto/internal/fips140/purego.go b/src/crypto/internal/fips140/purego.go new file mode 100644 index 0000000000..335977eabb --- /dev/null +++ b/src/crypto/internal/fips140/purego.go @@ -0,0 +1,9 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build purego + +package fips140 + +const puregoEnabled = true -- cgit v1.3-5-g45d5 From 2469e92d8c49536617136f744c9767e14f6461d2 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 11 Sep 2025 17:21:02 +0800 Subject: cmd/compile: combine doubling with shift on riscv64 Change-Id: I4bee2770fedf97e35b5a5b9187a8ba3c41f9ec2e Reviewed-on: https://go-review.googlesource.com/c/go/+/702697 Reviewed-by: Keith Randall Reviewed-by: Michael Knyszek Reviewed-by: Joel Sing LUCI-TryBot-Result: Go LUCI Auto-Submit: Keith Randall --- src/cmd/compile/internal/ssa/_gen/RISCV64.rules | 4 +++ src/cmd/compile/internal/ssa/rewriteRISCV64.go | 36 +++++++++++++++++++++++++ test/codegen/shift.go | 14 ++++++++++ 3 files changed, 54 insertions(+) (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/ssa/_gen/RISCV64.rules b/src/cmd/compile/internal/ssa/_gen/RISCV64.rules index e14de328ea..7059273eb2 100644 --- a/src/cmd/compile/internal/ssa/_gen/RISCV64.rules +++ b/src/cmd/compile/internal/ssa/_gen/RISCV64.rules @@ -782,6 +782,10 @@ (SRLI [x] (MOVDconst [y])) => (MOVDconst [int64(uint64(y) >> uint32(x))]) (SRAI [x] (MOVDconst [y])) => (MOVDconst [int64(y) >> uint32(x)]) +// Combine doubling via addition with shift. +(SLLI [c] (ADD x x)) && c < t.Size() * 8 - 1 => (SLLI [c+1] x) +(SLLI [c] (ADD x x)) && c >= t.Size() * 8 - 1 => (MOVDconst [0]) + // SLTI/SLTIU with constants. (SLTI [x] (MOVDconst [y])) => (MOVDconst [b2i(int64(y) < int64(x))]) (SLTIU [x] (MOVDconst [y])) => (MOVDconst [b2i(uint64(y) < uint64(x))]) diff --git a/src/cmd/compile/internal/ssa/rewriteRISCV64.go b/src/cmd/compile/internal/ssa/rewriteRISCV64.go index 5723327bc9..a7b4cf1bc4 100644 --- a/src/cmd/compile/internal/ssa/rewriteRISCV64.go +++ b/src/cmd/compile/internal/ssa/rewriteRISCV64.go @@ -7185,6 +7185,42 @@ func rewriteValueRISCV64_OpRISCV64SLLI(v *Value) bool { v.AuxInt = int64ToAuxInt(y << uint32(x)) return true } + // match: (SLLI [c] (ADD x x)) + // cond: c < t.Size() * 8 - 1 + // result: (SLLI [c+1] x) + for { + t := v.Type + c := auxIntToInt64(v.AuxInt) + if v_0.Op != OpRISCV64ADD { + break + } + x := v_0.Args[1] + if x != v_0.Args[0] || !(c < t.Size()*8-1) { + break + } + v.reset(OpRISCV64SLLI) + v.Type = t + v.AuxInt = int64ToAuxInt(c + 1) + v.AddArg(x) + return true + } + // match: (SLLI [c] (ADD x x)) + // cond: c >= t.Size() * 8 - 1 + // result: (MOVDconst [0]) + for { + t := v.Type + c := auxIntToInt64(v.AuxInt) + if v_0.Op != OpRISCV64ADD { + break + } + x := v_0.Args[1] + if x != v_0.Args[0] || !(c >= t.Size()*8-1) { + break + } + v.reset(OpRISCV64MOVDconst) + v.AuxInt = int64ToAuxInt(0) + return true + } return false } func rewriteValueRISCV64_OpRISCV64SLLW(v *Value) bool { diff --git a/test/codegen/shift.go b/test/codegen/shift.go index 1c71b0f3ef..7385058726 100644 --- a/test/codegen/shift.go +++ b/test/codegen/shift.go @@ -122,27 +122,41 @@ func rshConst64x32(v int64) int64 { func lshConst32x1Add(x int32) int32 { // amd64:"SHLL\t[$]2" // loong64:"SLL\t[$]2" + // riscv64:"SLLI\t[$]2" return (x + x) << 1 } func lshConst64x1Add(x int64) int64 { // amd64:"SHLQ\t[$]2" // loong64:"SLLV\t[$]2" + // riscv64:"SLLI\t[$]2" return (x + x) << 1 } func lshConst32x2Add(x int32) int32 { // amd64:"SHLL\t[$]3" // loong64:"SLL\t[$]3" + // riscv64:"SLLI\t[$]3" return (x + x) << 2 } func lshConst64x2Add(x int64) int64 { // amd64:"SHLQ\t[$]3" // loong64:"SLLV\t[$]3" + // riscv64:"SLLI\t[$]3" return (x + x) << 2 } +func lshConst32x31Add(x int32) int32 { + // riscv64:-"SLLI","MOV\t[$]0" + return (x + x) << 31 +} + +func lshConst64x63Add(x int64) int64 { + // riscv64:-"SLLI","MOV\t[$]0" + return (x + x) << 63 +} + // ------------------ // // masked shifts // // ------------------ // -- cgit v1.3-5-g45d5 From e3ed0fbe6a4c7c5e91a4a82c1bcbc96b9ac37016 Mon Sep 17 00:00:00 2001 From: 1911860538 Date: Mon, 15 Sep 2025 14:39:58 +0000 Subject: all: replace strings.Split with strings.SplitSeq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Go 1.25+, strings.SplitSeq offers better performance. Here are the benchmark results comparing strings.Split and strings.SplitSeq in a for-loop, with the benchmark code located in src/strings/iter_test.go: goos: darwin goarch: amd64 pkg: cmd/go/internal/auth cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ ParseGitAuth/standard-8 281.4n ± 1% 218.0n ± 11% -22.54% (p=0.000 n=10) ParseGitAuth/with_url-8 549.1n ± 1% 480.5n ± 13% -12.48% (p=0.002 n=10) ParseGitAuth/minimal-8 235.4n ± 1% 197.3n ± 7% -16.20% (p=0.000 n=10) ParseGitAuth/complex-8 797.6n ± 2% 805.2n ± 4% ~ (p=0.481 n=10) ParseGitAuth/empty-8 87.48n ± 3% 63.25n ± 6% -27.71% (p=0.000 n=10) ParseGitAuth/malformed-8 228.8n ± 1% 171.2n ± 3% -25.17% (p=0.000 n=10) geomean 288.9n 237.7n -17.72% │ old.txt │ new.txt │ │ B/op │ B/op vs base │ ParseGitAuth/standard-8 192.00 ± 0% 96.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/with_url-8 400.0 ± 0% 288.0 ± 0% -28.00% (p=0.000 n=10) ParseGitAuth/minimal-8 144.00 ± 0% 80.00 ± 0% -44.44% (p=0.000 n=10) ParseGitAuth/complex-8 528.0 ± 0% 400.0 ± 0% -24.24% (p=0.000 n=10) ParseGitAuth/empty-8 32.00 ± 0% 16.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 176.00 ± 0% 80.00 ± 0% -54.55% (p=0.000 n=10) geomean 179.0 102.1 -42.96% │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ ParseGitAuth/standard-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/with_url-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/minimal-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/complex-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/empty-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) geomean 3.086 2.040 -33.91% Updates #69315. Change-Id: Id0219edea45d9658d527b863162ebe917e7821d9 GitHub-Last-Rev: 392b315e122f2c9ef8703ca2dbce8f82ec198556 GitHub-Pull-Request: golang/go#75259 Reviewed-on: https://go-review.googlesource.com/c/go/+/701015 Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek Reviewed-by: Emmanuel Odeke Reviewed-by: Keith Randall Auto-Submit: Emmanuel Odeke --- misc/ios/go_ios_exec.go | 2 +- src/cmd/cgo/gcc.go | 4 +- src/cmd/cgo/internal/test/testx.go | 2 +- src/cmd/compile/internal/base/flag.go | 2 +- src/cmd/dist/build.go | 6 +- src/cmd/distpack/pack.go | 2 +- src/cmd/fix/main.go | 4 +- src/cmd/go/internal/auth/gitauth.go | 2 +- src/cmd/go/internal/auth/gitauth_test.go | 75 ++++++++++++++++++++++++ src/cmd/go/internal/auth/netrc.go | 2 +- src/cmd/go/internal/doc/dirs.go | 2 +- src/cmd/go/internal/doc/pkg.go | 2 +- src/cmd/go/internal/list/list.go | 2 +- src/cmd/go/internal/modfetch/codehost/git.go | 6 +- src/cmd/go/internal/modfetch/codehost/vcs.go | 4 +- src/cmd/go/internal/modindex/build.go | 2 +- src/cmd/go/internal/modindex/scan.go | 2 +- src/cmd/go/internal/modload/buildlist.go | 2 +- src/cmd/go/internal/modload/init.go | 2 +- src/cmd/go/internal/modload/vendor.go | 4 +- src/cmd/go/internal/test/testflag.go | 2 +- src/cmd/go/internal/toolchain/path_windows.go | 2 +- src/cmd/go/internal/vcs/vcs.go | 6 +- src/cmd/go/internal/vcweb/vcweb.go | 2 +- src/cmd/go/internal/work/build.go | 2 +- src/cmd/go/internal/work/exec.go | 4 +- src/cmd/go/internal/work/gccgo.go | 2 +- src/cmd/internal/objabi/flag.go | 2 +- src/cmd/internal/script/cmds.go | 2 +- src/cmd/internal/script/scripttest/conditions.go | 2 +- src/go/ast/ast.go | 2 +- src/go/build/build.go | 2 +- src/go/build/constraint/expr.go | 4 +- src/internal/buildcfg/cfg.go | 2 +- src/internal/buildcfg/exp.go | 2 +- src/internal/testenv/testenv.go | 2 +- src/internal/trace/traceviewer/mmu.go | 4 +- src/os/exec/lp_windows.go | 2 +- src/strings/iter_test.go | 53 +++++++++++++++++ 39 files changed, 178 insertions(+), 50 deletions(-) (limited to 'src/cmd') diff --git a/misc/ios/go_ios_exec.go b/misc/ios/go_ios_exec.go index b21ce1aaf3..e58457d051 100644 --- a/misc/ios/go_ios_exec.go +++ b/misc/ios/go_ios_exec.go @@ -212,7 +212,7 @@ func copyLocalData(dstbase string) (pkgpath string, err error) { // Copy all immediate files and testdata directories between // the package being tested and the source root. pkgpath = "" - for _, element := range strings.Split(finalPkgpath, string(filepath.Separator)) { + for element := range strings.SplitSeq(finalPkgpath, string(filepath.Separator)) { if debug { log.Printf("copying %s", pkgpath) } diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index 1f18657400..6c1695bdb0 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -251,7 +251,7 @@ func (f *File) loadDefines(gccOptions []string) bool { stdout := gccDefines(b.Bytes(), gccOptions) var gccIsClang bool - for _, line := range strings.Split(stdout, "\n") { + for line := range strings.SplitSeq(stdout, "\n") { if len(line) < 9 || line[0:7] != "#define" { continue } @@ -428,7 +428,7 @@ func (p *Package) guessKinds(f *File) []*Name { notDeclared ) sawUnmatchedErrors := false - for _, line := range strings.Split(stderr, "\n") { + for line := range strings.SplitSeq(stderr, "\n") { // Ignore warnings and random comments, with one // exception: newer GCC versions will sometimes emit // an error on a macro #define with a note referring diff --git a/src/cmd/cgo/internal/test/testx.go b/src/cmd/cgo/internal/test/testx.go index 0e2a51a522..9a63b9e100 100644 --- a/src/cmd/cgo/internal/test/testx.go +++ b/src/cmd/cgo/internal/test/testx.go @@ -447,7 +447,7 @@ func issue7978check(t *testing.T, wantFunc string, badFunc string, depth int) { runtime.GC() buf := make([]byte, 65536) trace := string(buf[:runtime.Stack(buf, true)]) - for _, goroutine := range strings.Split(trace, "\n\n") { + for goroutine := range strings.SplitSeq(trace, "\n\n") { if strings.Contains(goroutine, "test.issue7978go") { trace := strings.Split(goroutine, "\n") // look for the expected function in the stack diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index 1b52ab660c..a0ed876cfc 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -570,7 +570,7 @@ func readEmbedCfg(file string) { // parseSpectre parses the spectre configuration from the string s. func parseSpectre(s string) { - for _, f := range strings.Split(s, ",") { + for f := range strings.SplitSeq(s, ",") { f = strings.TrimSpace(f) switch f { default: diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index fb70047dd0..9a7951726f 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -380,7 +380,7 @@ func findgoversion() string { if i := strings.Index(b, "\n"); i >= 0 { rest := b[i+1:] b = chomp(b[:i]) - for _, line := range strings.Split(rest, "\n") { + for line := range strings.SplitSeq(rest, "\n") { f := strings.Fields(line) if len(f) == 0 { continue @@ -1137,7 +1137,7 @@ func shouldbuild(file, pkg string) bool { } // Check file contents for //go:build lines. - for _, p := range strings.Split(readfile(file), "\n") { + for p := range strings.SplitSeq(readfile(file), "\n") { p = strings.TrimSpace(p) if p == "" { continue @@ -2016,7 +2016,7 @@ func cmdlist() { } func setNoOpt() { - for _, gcflag := range strings.Split(gogcflags, " ") { + for gcflag := range strings.SplitSeq(gogcflags, " ") { if gcflag == "-N" || gcflag == "-l" { noOpt = true break diff --git a/src/cmd/distpack/pack.go b/src/cmd/distpack/pack.go index 27f73e593c..6bab45f1d3 100644 --- a/src/cmd/distpack/pack.go +++ b/src/cmd/distpack/pack.go @@ -271,7 +271,7 @@ func readVERSION(goroot string) (version string, t time.Time) { log.Fatal(err) } version, rest, _ := strings.Cut(string(data), "\n") - for _, line := range strings.Split(rest, "\n") { + for line := range strings.SplitSeq(rest, "\n") { f := strings.Fields(line) if len(f) == 0 { continue diff --git a/src/cmd/fix/main.go b/src/cmd/fix/main.go index 44ce396e37..933c32bcd9 100644 --- a/src/cmd/fix/main.go +++ b/src/cmd/fix/main.go @@ -84,14 +84,14 @@ func main() { if *allowedRewrites != "" { allowed = make(map[string]bool) - for _, f := range strings.Split(*allowedRewrites, ",") { + for f := range strings.SplitSeq(*allowedRewrites, ",") { allowed[f] = true } } if *forceRewrites != "" { force = make(map[string]bool) - for _, f := range strings.Split(*forceRewrites, ",") { + for f := range strings.SplitSeq(*forceRewrites, ",") { force[f] = true } } diff --git a/src/cmd/go/internal/auth/gitauth.go b/src/cmd/go/internal/auth/gitauth.go index 29d2852814..f11cd2fbf0 100644 --- a/src/cmd/go/internal/auth/gitauth.go +++ b/src/cmd/go/internal/auth/gitauth.go @@ -82,7 +82,7 @@ func runGitAuth(client *http.Client, dir, url string) (string, http.Header, erro // Any of these values may be empty if parsing fails. func parseGitAuth(data []byte) (parsedPrefix, username, password string) { prefix := new(url.URL) - for _, line := range strings.Split(string(data), "\n") { + for line := range strings.SplitSeq(string(data), "\n") { key, value, ok := strings.Cut(strings.TrimSpace(line), "=") if !ok { continue diff --git a/src/cmd/go/internal/auth/gitauth_test.go b/src/cmd/go/internal/auth/gitauth_test.go index 1ddd48fa7a..2ba93ad2c2 100644 --- a/src/cmd/go/internal/auth/gitauth_test.go +++ b/src/cmd/go/internal/auth/gitauth_test.go @@ -5,6 +5,7 @@ package auth import ( + "strings" "testing" ) @@ -82,3 +83,77 @@ password:secr3t } } } + +func BenchmarkParseGitAuth(b *testing.B) { + // Define different test scenarios to benchmark + testCases := []struct { + name string + data []byte + }{{ + // Standard scenario with all basic fields present + name: "standard", + data: []byte(` +protocol=https +host=example.com +username=bob +password=secr3t +`), + }, { + // Scenario with URL field included + name: "with_url", + data: []byte(` +protocol=https +host=example.com +username=bob +password=secr3t +url=https://example.com/repo +`), + }, { + // Minimal scenario with only required fields + name: "minimal", + data: []byte(` +protocol=https +host=example.com +`), + }, { + // Complex scenario with longer values and extra fields + name: "complex", + data: func() []byte { + var builder strings.Builder + builder.WriteString("protocol=https\n") + builder.WriteString("host=example.com\n") + builder.WriteString("username=longusernamenamename\n") + builder.WriteString("password=longpasswordwithmanycharacters123456789\n") + builder.WriteString("url=https://example.com/very/long/path/to/repository\n") + builder.WriteString("extra1=value1\n") + builder.WriteString("extra2=value2\n") + return []byte(builder.String()) + }(), + }, { + // Scenario with empty input + name: "empty", + data: []byte(``), + }, { + // Scenario with malformed input (using colon instead of equals) + name: "malformed", + data: []byte(` +protocol:https +host:example.com +username:bob +password:secr3t +`), + }} + + for _, tc := range testCases { + b.Run(tc.name, func(b *testing.B) { + b.ResetTimer() + for b.Loop() { + prefix, username, password := parseGitAuth(tc.data) + + _ = prefix + _ = username + _ = password + } + }) + } +} diff --git a/src/cmd/go/internal/auth/netrc.go b/src/cmd/go/internal/auth/netrc.go index 4191ccb293..78c884b31b 100644 --- a/src/cmd/go/internal/auth/netrc.go +++ b/src/cmd/go/internal/auth/netrc.go @@ -24,7 +24,7 @@ func parseNetrc(data string) []netrcLine { var nrc []netrcLine var l netrcLine inMacro := false - for _, line := range strings.Split(data, "\n") { + for line := range strings.SplitSeq(data, "\n") { if inMacro { if line == "" { inMacro = false diff --git a/src/cmd/go/internal/doc/dirs.go b/src/cmd/go/internal/doc/dirs.go index 8b1670f61c..5efd40b1d5 100644 --- a/src/cmd/go/internal/doc/dirs.go +++ b/src/cmd/go/internal/doc/dirs.go @@ -241,7 +241,7 @@ func findCodeRoots() []Dir { cmd := exec.Command(goCmd(), "list", "-m", "-f={{.Path}}\t{{.Dir}}", "all") cmd.Stderr = os.Stderr out, _ := cmd.Output() - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { path, dir, _ := strings.Cut(line, "\t") if dir != "" { list = append(list, Dir{importPath: path, dir: dir, inModule: true}) diff --git a/src/cmd/go/internal/doc/pkg.go b/src/cmd/go/internal/doc/pkg.go index 953b0d9a28..7b5e00365d 100644 --- a/src/cmd/go/internal/doc/pkg.go +++ b/src/cmd/go/internal/doc/pkg.go @@ -920,7 +920,7 @@ func trimUnexportedFields(fields *ast.FieldList, isInterface bool) *ast.FieldLis start := doc.List[0].Slash doc.List = doc.List[:0] - for _, line := range strings.Split(text, "\n") { + for line := range strings.SplitSeq(text, "\n") { prefix := "// " if len(line) > 0 && line[0] == '\t' { prefix = "//" diff --git a/src/cmd/go/internal/list/list.go b/src/cmd/go/internal/list/list.go index 86a6b1792c..bee7dc8053 100644 --- a/src/cmd/go/internal/list/list.go +++ b/src/cmd/go/internal/list/list.go @@ -381,7 +381,7 @@ func (v *jsonFlag) Set(s string) error { if *v == nil { *v = make(map[string]bool) } - for _, f := range strings.Split(s, ",") { + for f := range strings.SplitSeq(s, ",") { (*v)[f] = true } return nil diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go index 8a1c12b90a..74c4c646cd 100644 --- a/src/cmd/go/internal/modfetch/codehost/git.go +++ b/src/cmd/go/internal/modfetch/codehost/git.go @@ -173,7 +173,7 @@ func (r *gitRepo) loadLocalTags(ctx context.Context) { return } - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { if line != "" { r.localTags.Store(line, true) } @@ -273,7 +273,7 @@ func (r *gitRepo) loadRefs(ctx context.Context) (map[string]string, error) { } refs := make(map[string]string) - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { f := strings.Fields(line) if len(f) != 2 { continue @@ -745,7 +745,7 @@ func (r *gitRepo) RecentTag(ctx context.Context, rev, prefix string, allowed fun // prefixed tags aren't valid semver tags so compare without prefix, but only tags with correct prefix var highest string - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { line = strings.TrimSpace(line) // git do support lstrip in for-each-ref format, but it was added in v2.13.0. Stripping here // instead gives support for git v2.7.0. diff --git a/src/cmd/go/internal/modfetch/codehost/vcs.go b/src/cmd/go/internal/modfetch/codehost/vcs.go index 8e59479339..d80397502b 100644 --- a/src/cmd/go/internal/modfetch/codehost/vcs.go +++ b/src/cmd/go/internal/modfetch/codehost/vcs.go @@ -561,7 +561,7 @@ func bzrParseStat(rev, out string) (*RevInfo, error) { var revno int64 var tm time.Time var tags []string - for _, line := range strings.Split(out, "\n") { + for line := range strings.SplitSeq(out, "\n") { if line == "" || line[0] == ' ' || line[0] == '\t' { // End of header, start of commit message. break @@ -614,7 +614,7 @@ func bzrParseStat(rev, out string) (*RevInfo, error) { } func fossilParseStat(rev, out string) (*RevInfo, error) { - for _, line := range strings.Split(out, "\n") { + for line := range strings.SplitSeq(out, "\n") { if strings.HasPrefix(line, "uuid:") || strings.HasPrefix(line, "hash:") { f := strings.Fields(line) if len(f) != 5 || len(f[1]) != 40 || f[4] != "UTC" { diff --git a/src/cmd/go/internal/modindex/build.go b/src/cmd/go/internal/modindex/build.go index 761bda8d39..0fa78afe2c 100644 --- a/src/cmd/go/internal/modindex/build.go +++ b/src/cmd/go/internal/modindex/build.go @@ -426,7 +426,7 @@ Lines: // These lines set CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS and pkg-config directives // that affect the way cgo's C code is built. func (ctxt *Context) saveCgo(filename string, di *build.Package, text string) error { - for _, line := range strings.Split(text, "\n") { + for line := range strings.SplitSeq(text, "\n") { orig := line // Line is diff --git a/src/cmd/go/internal/modindex/scan.go b/src/cmd/go/internal/modindex/scan.go index 90be154e8e..af2c0abe04 100644 --- a/src/cmd/go/internal/modindex/scan.go +++ b/src/cmd/go/internal/modindex/scan.go @@ -275,7 +275,7 @@ func importRaw(modroot, reldir string) *rawPackage { // which is the comment on import "C". func extractCgoDirectives(doc string) []string { var out []string - for _, line := range strings.Split(doc, "\n") { + for line := range strings.SplitSeq(doc, "\n") { // Line is // #cgo [GOOS/GOARCH...] LDFLAGS: stuff // diff --git a/src/cmd/go/internal/modload/buildlist.go b/src/cmd/go/internal/modload/buildlist.go index cd3ec4f102..2ba04f707b 100644 --- a/src/cmd/go/internal/modload/buildlist.go +++ b/src/cmd/go/internal/modload/buildlist.go @@ -329,7 +329,7 @@ func readModGraph(ctx context.Context, pruning modPruning, roots []module.Versio // so it wouldn't be useful to log when that occurs (because it happens in // normal operation all the time). readModGraphDebugOnce.Do(func() { - for _, f := range strings.Split(os.Getenv("GODEBUG"), ",") { + for f := range strings.SplitSeq(os.Getenv("GODEBUG"), ",") { switch f { case "lazymod=log": debug.PrintStack() diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 25151103ed..498ff7433e 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -1597,7 +1597,7 @@ func modulesTextIsForWorkspace(vendorDir string) (bool, error) { } line, _, _ := strings.Cut(string(buf[:n]), "\n") if annotations, ok := strings.CutPrefix(line, "## "); ok { - for _, entry := range strings.Split(annotations, ";") { + for entry := range strings.SplitSeq(annotations, ";") { entry = strings.TrimSpace(entry) if entry == "workspace" { return true, nil diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go index b2cb44100e..c7fe731935 100644 --- a/src/cmd/go/internal/modload/vendor.go +++ b/src/cmd/go/internal/modload/vendor.go @@ -53,7 +53,7 @@ func readVendorList(vendorDir string) { } var mod module.Version - for _, line := range strings.Split(string(data), "\n") { + for line := range strings.SplitSeq(string(data), "\n") { if strings.HasPrefix(line, "# ") { f := strings.Fields(line) @@ -103,7 +103,7 @@ func readVendorList(vendorDir string) { if annotations, ok := strings.CutPrefix(line, "## "); ok { // Metadata. Take the union of annotations across multiple lines, if present. meta := vendorMeta[mod] - for _, entry := range strings.Split(annotations, ";") { + for entry := range strings.SplitSeq(annotations, ";") { entry = strings.TrimSpace(entry) if entry == "explicit" { meta.Explicit = true diff --git a/src/cmd/go/internal/test/testflag.go b/src/cmd/go/internal/test/testflag.go index 09e41533b6..983e8f56e9 100644 --- a/src/cmd/go/internal/test/testflag.go +++ b/src/cmd/go/internal/test/testflag.go @@ -149,7 +149,7 @@ func (f *vetFlag) Set(value string) error { *f = vetFlag{explicit: true} var single string - for _, arg := range strings.Split(value, ",") { + for arg := range strings.SplitSeq(value, ",") { switch arg { case "": return fmt.Errorf("-vet argument contains empty list element") diff --git a/src/cmd/go/internal/toolchain/path_windows.go b/src/cmd/go/internal/toolchain/path_windows.go index d88945ddc8..dfb2238a4d 100644 --- a/src/cmd/go/internal/toolchain/path_windows.go +++ b/src/cmd/go/internal/toolchain/path_windows.go @@ -21,7 +21,7 @@ var pathExts = sync.OnceValue(func() []string { } var exts []string - for _, e := range strings.Split(strings.ToLower(x), `;`) { + for e := range strings.SplitSeq(strings.ToLower(x), `;`) { if e == "" { continue } diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go index 7e081eb41a..edbc573440 100644 --- a/src/cmd/go/internal/vcs/vcs.go +++ b/src/cmd/go/internal/vcs/vcs.go @@ -110,7 +110,7 @@ func (v *Cmd) isSecureScheme(scheme string) bool { // colon-separated list of schemes that are allowed to be used with git // fetch/clone. Any scheme not mentioned will be considered insecure. if allow := os.Getenv("GIT_ALLOW_PROTOCOL"); allow != "" { - for _, s := range strings.Split(allow, ":") { + for s := range strings.SplitSeq(allow, ":") { if s == scheme { return true } @@ -440,7 +440,7 @@ func bzrStatus(vcsBzr *Cmd, rootDir string) (Status, error) { var rev string var commitTime time.Time - for _, line := range strings.Split(out, "\n") { + for line := range strings.SplitSeq(out, "\n") { i := strings.IndexByte(line, ':') if i < 0 { continue @@ -974,7 +974,7 @@ func parseGOVCS(s string) (govcsConfig, error) { } var cfg govcsConfig have := make(map[string]string) - for _, item := range strings.Split(s, ",") { + for item := range strings.SplitSeq(s, ",") { item = strings.TrimSpace(item) if item == "" { return nil, fmt.Errorf("empty entry in GOVCS") diff --git a/src/cmd/go/internal/vcweb/vcweb.go b/src/cmd/go/internal/vcweb/vcweb.go index 757a595808..b81ff5e63d 100644 --- a/src/cmd/go/internal/vcweb/vcweb.go +++ b/src/cmd/go/internal/vcweb/vcweb.go @@ -224,7 +224,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) { // uniqueness: if a path exists as a directory, then it cannot exist as a // ".txt" script (because the search would ignore that file). scriptPath := "." - for _, part := range strings.Split(clean, "/") { + for part := range strings.SplitSeq(clean, "/") { scriptPath = filepath.Join(scriptPath, part) dir := filepath.Join(s.scriptDir, scriptPath) if _, err := os.Stat(dir); err != nil { diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 742efe6490..6741b39f05 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -384,7 +384,7 @@ func (v *tagsFlag) Set(s string) error { // Split on commas, ignore empty strings. *v = []string{} - for _, s := range strings.Split(s, ",") { + for s := range strings.SplitSeq(s, ",") { if s != "" { *v = append(*v, s) } diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 51cb2e5a04..72b9177c9d 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1122,7 +1122,7 @@ func (b *Builder) loadCachedVet(a *Action) error { return fmt.Errorf("reading srcfiles list: %w", err) } var srcfiles []string - for _, name := range strings.Split(string(list), "\n") { + for name := range strings.SplitSeq(string(list), "\n") { if name == "" { // end of list continue } @@ -1146,7 +1146,7 @@ func (b *Builder) loadCachedCompiledGoFiles(a *Action) error { return fmt.Errorf("reading srcfiles list: %w", err) } var gofiles []string - for _, name := range strings.Split(string(list), "\n") { + for name := range strings.SplitSeq(string(list), "\n") { if name == "" { // end of list continue } else if !strings.HasSuffix(name, ".go") { diff --git a/src/cmd/go/internal/work/gccgo.go b/src/cmd/go/internal/work/gccgo.go index b42e92ea69..276e082b71 100644 --- a/src/cmd/go/internal/work/gccgo.go +++ b/src/cmd/go/internal/work/gccgo.go @@ -278,7 +278,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string return err } const ldflagsPrefix = "_CGO_LDFLAGS=" - for _, line := range strings.Split(string(flags), "\n") { + for line := range strings.SplitSeq(string(flags), "\n") { if strings.HasPrefix(line, ldflagsPrefix) { flag := line[len(ldflagsPrefix):] // Every _cgo_flags file has -g and -O2 in _CGO_LDFLAGS diff --git a/src/cmd/internal/objabi/flag.go b/src/cmd/internal/objabi/flag.go index 1bb46e3bcd..8709c4e5cf 100644 --- a/src/cmd/internal/objabi/flag.go +++ b/src/cmd/internal/objabi/flag.go @@ -277,7 +277,7 @@ func (f *DebugFlag) Set(debugstr string) error { if debugstr == "" { return nil } - for _, name := range strings.Split(debugstr, ",") { + for name := range strings.SplitSeq(debugstr, ",") { if name == "" { continue } diff --git a/src/cmd/internal/script/cmds.go b/src/cmd/internal/script/cmds.go index 7a930caf35..a682d9b3f6 100644 --- a/src/cmd/internal/script/cmds.go +++ b/src/cmd/internal/script/cmds.go @@ -513,7 +513,7 @@ func lookPath(s *State, command string) (string, error) { } pathEnv, _ := s.LookupEnv(pathEnvName()) - for _, dir := range strings.Split(pathEnv, string(filepath.ListSeparator)) { + for dir := range strings.SplitSeq(pathEnv, string(filepath.ListSeparator)) { if dir == "" { continue } diff --git a/src/cmd/internal/script/scripttest/conditions.go b/src/cmd/internal/script/scripttest/conditions.go index e35ac2ddb7..6702e9279b 100644 --- a/src/cmd/internal/script/scripttest/conditions.go +++ b/src/cmd/internal/script/scripttest/conditions.go @@ -88,7 +88,7 @@ func pieLinkExt(s *script.State) (bool, error) { func hasGodebug(s *script.State, value string) (bool, error) { godebug, _ := s.LookupEnv("GODEBUG") - for _, p := range strings.Split(godebug, ",") { + for p := range strings.SplitSeq(godebug, ",") { if strings.TrimSpace(p) == value { return true, nil } diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go index a3dc0c3220..2a0d9e6860 100644 --- a/src/go/ast/ast.go +++ b/src/go/ast/ast.go @@ -1123,7 +1123,7 @@ func generator(file *File) (string, bool) { // opt: check Contains first to avoid unnecessary array allocation in Split. const prefix = "// Code generated " if strings.Contains(comment.Text, prefix) { - for _, line := range strings.Split(comment.Text, "\n") { + for line := range strings.SplitSeq(comment.Text, "\n") { if rest, ok := strings.CutPrefix(line, prefix); ok { if gen, ok := strings.CutSuffix(rest, " DO NOT EDIT."); ok { return gen, true diff --git a/src/go/build/build.go b/src/go/build/build.go index 50288fcec6..76866c7487 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -1708,7 +1708,7 @@ Lines: // that affect the way cgo's C code is built. func (ctxt *Context) saveCgo(filename string, di *Package, cg *ast.CommentGroup) error { text := cg.Text() - for _, line := range strings.Split(text, "\n") { + for line := range strings.SplitSeq(text, "\n") { orig := line // Line is diff --git a/src/go/build/constraint/expr.go b/src/go/build/constraint/expr.go index 0f05f8db6a..1f39bb2011 100644 --- a/src/go/build/constraint/expr.go +++ b/src/go/build/constraint/expr.go @@ -406,9 +406,9 @@ func parsePlusBuildExpr(text string) (Expr, error) { size := 0 var x Expr - for _, clause := range strings.Fields(text) { + for clause := range strings.FieldsSeq(text) { var y Expr - for _, lit := range strings.Split(clause, ",") { + for lit := range strings.SplitSeq(clause, ",") { var z Expr var neg bool if strings.HasPrefix(lit, "!!") || lit == "!" { diff --git a/src/internal/buildcfg/cfg.go b/src/internal/buildcfg/cfg.go index 7e4ee365df..52d1c45afa 100644 --- a/src/internal/buildcfg/cfg.go +++ b/src/internal/buildcfg/cfg.go @@ -336,7 +336,7 @@ func (f gowasmFeatures) String() string { } func gowasm() (f gowasmFeatures) { - for _, opt := range strings.Split(envOr("GOWASM", ""), ",") { + for opt := range strings.SplitSeq(envOr("GOWASM", ""), ",") { switch opt { case "satconv": f.SatConv = true diff --git a/src/internal/buildcfg/exp.go b/src/internal/buildcfg/exp.go index 310226bc01..be9d1f7125 100644 --- a/src/internal/buildcfg/exp.go +++ b/src/internal/buildcfg/exp.go @@ -113,7 +113,7 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) { } // Parse names. - for _, f := range strings.Split(goexp, ",") { + for f := range strings.SplitSeq(goexp, ",") { if f == "" { continue } diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go index 947340ce83..96eacc60a3 100644 --- a/src/internal/testenv/testenv.go +++ b/src/internal/testenv/testenv.go @@ -489,7 +489,7 @@ func WriteImportcfg(t testing.TB, dstPath string, packageFiles map[string]string t.Fatalf("%v: %v\n%s", cmd, err, cmd.Stderr) } - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { if line == "" { continue } diff --git a/src/internal/trace/traceviewer/mmu.go b/src/internal/trace/traceviewer/mmu.go index 0bc1233b44..190ce5afca 100644 --- a/src/internal/trace/traceviewer/mmu.go +++ b/src/internal/trace/traceviewer/mmu.go @@ -69,7 +69,7 @@ var utilFlagNames = map[string]trace.UtilFlags{ func requestUtilFlags(r *http.Request) trace.UtilFlags { var flags trace.UtilFlags - for _, flagStr := range strings.Split(r.FormValue("flags"), "|") { + for flagStr := range strings.SplitSeq(r.FormValue("flags"), "|") { flags |= utilFlagNames[flagStr] } return flags @@ -119,7 +119,7 @@ func (m *mmu) HandlePlot(w http.ResponseWriter, r *http.Request) { } var quantiles []float64 - for _, flagStr := range strings.Split(r.FormValue("flags"), "|") { + for flagStr := range strings.SplitSeq(r.FormValue("flags"), "|") { if flagStr == "mut" { quantiles = []float64{0, 1 - .999, 1 - .99, 1 - .95} break diff --git a/src/os/exec/lp_windows.go b/src/os/exec/lp_windows.go index e01e7bbbba..74537dec68 100644 --- a/src/os/exec/lp_windows.go +++ b/src/os/exec/lp_windows.go @@ -123,7 +123,7 @@ func pathExt() []string { var exts []string x := os.Getenv(`PATHEXT`) if x != "" { - for _, e := range strings.Split(strings.ToLower(x), `;`) { + for e := range strings.SplitSeq(strings.ToLower(x), `;`) { if e == "" { continue } diff --git a/src/strings/iter_test.go b/src/strings/iter_test.go index 2db599377f..963349b1f4 100644 --- a/src/strings/iter_test.go +++ b/src/strings/iter_test.go @@ -50,3 +50,56 @@ func BenchmarkSplitAfterSeqMultiByteSeparator(b *testing.B) { } } } + +func findKvBySplit(s string, k string) string { + for _, kv := range Split(s, ",") { + if HasPrefix(kv, k) { + return kv + } + } + return "" +} + +func findKvBySplitSeq(s string, k string) string { + for kv := range SplitSeq(s, ",") { + if HasPrefix(kv, k) { + return kv + } + } + return "" +} + +func BenchmarkSplitAndSplitSeq(b *testing.B) { + testSplitString := "k1=v1,k2=v2,k3=v3,k4=v4" + testCases := []struct { + name string + input string + }{ + { + name: "Key found", + input: "k3", + }, + { + name: "Key not found", + input: "k100", + }, + } + + for _, testCase := range testCases { + b.Run("bySplit "+testCase.name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + for b.Loop() { + findKvBySplit(testSplitString, testCase.input) + } + }) + + b.Run("bySplitSeq "+testCase.name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + for b.Loop() { + findKvBySplitSeq(testSplitString, testCase.input) + } + }) + } +} -- cgit v1.3-5-g45d5 From 7ddbf4d820b46ec51eeb4e596c240c9b58501662 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 12 Sep 2025 14:23:23 +0800 Subject: cmd/asm: add double precision comparision testcases for riscv64 Change-Id: If8e03dfdb332a22ec9c6a0021d7e7955520f3ddc Reviewed-on: https://go-review.googlesource.com/c/go/+/702136 Reviewed-by: Mark Freeman LUCI-TryBot-Result: Go LUCI Reviewed-by: Mark Ryan Reviewed-by: Joel Sing Reviewed-by: Michael Knyszek --- src/cmd/asm/internal/asm/testdata/riscv64.s | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cmd') diff --git a/src/cmd/asm/internal/asm/testdata/riscv64.s b/src/cmd/asm/internal/asm/testdata/riscv64.s index 30f9989982..b216149a19 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64.s @@ -358,6 +358,11 @@ start: FNMSUBD F1, F2, F3, F4 // 4b82201a FNMADDD F1, F2, F3, F4 // 4f82201a + // 21.6: Double-Precision Floating-Point Compare Instructions + FEQD F0, F1, X7 // d3a300a2 + FLTD F0, F1, X7 // d39300a2 + FLED F0, F1, X7 // d38300a2 + // 21.7: Double-Precision Floating-Point Classify Instruction FCLASSD F0, X5 // d31200e2 -- cgit v1.3-5-g45d5 From 6b8d507508c75c7f60ab61429e346e3b28db4040 Mon Sep 17 00:00:00 2001 From: wangboyao Date: Wed, 30 Jul 2025 11:14:37 +0800 Subject: cmd/internal/obj/riscv: implement vector segment load/store instructions https://github.com/riscv/riscv-opcodes/pull/361. After this pr was merged, riscv-opcode can generate RVV segment load/store instructions for Go. Implement vector segment load/store instuctions. Change-Id: I154bb75be70c0a45e2279a75c67f68b5bb57c36e Reviewed-on: https://go-review.googlesource.com/c/go/+/691695 Reviewed-by: Mark Freeman Reviewed-by: Michael Knyszek Reviewed-by: Meng Zhuo LUCI-TryBot-Result: Go LUCI --- src/cmd/asm/internal/asm/testdata/riscv64.s | 572 +++++++++++++++++++++ src/cmd/asm/internal/asm/testdata/riscv64error.s | 9 + .../asm/internal/asm/testdata/riscv64validation.s | 27 + src/cmd/internal/obj/riscv/anames.go | 252 +++++++++ src/cmd/internal/obj/riscv/cpu.go | 266 ++++++++++ src/cmd/internal/obj/riscv/inst.go | 504 ++++++++++++++++++ src/cmd/internal/obj/riscv/obj.go | 296 ++++++++++- 7 files changed, 1923 insertions(+), 3 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/asm/internal/asm/testdata/riscv64.s b/src/cmd/asm/internal/asm/testdata/riscv64.s index b216149a19..4f7e7acd77 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64.s @@ -543,6 +543,578 @@ start: VSOXEI64V V3, V2, (X10) // a771250e VSOXEI64V V3, V2, V0, (X10) // a771250c + // 31.7.8: Vector Load/Store Segment Instructions + + // 31.7.8.1: Vector Unit-Stride Segment Loads and Stores + VLSEG2E8V (X10), V8 // 07040522 + VLSEG2E16V (X10), V8 // 07540522 + VLSEG2E32V (X10), V8 // 07640522 + VLSEG2E64V (X10), V8 // 07740522 + VLSEG2E8V (X10), V0, V8 // 07040520 + VLSEG2E16V (X10), V0, V8 // 07540520 + VLSEG2E32V (X10), V0, V8 // 07640520 + VLSEG2E64V (X10), V0, V8 // 07740520 + + VLSEG3E8V (X10), V8 // 07040542 + VLSEG3E16V (X10), V8 // 07540542 + VLSEG3E32V (X10), V8 // 07640542 + VLSEG3E64V (X10), V8 // 07740542 + VLSEG3E8V (X10), V0, V8 // 07040540 + VLSEG3E16V (X10), V0, V8 // 07540540 + VLSEG3E32V (X10), V0, V8 // 07640540 + VLSEG3E64V (X10), V0, V8 // 07740540 + + VLSEG4E8V (X10), V8 // 07040562 + VLSEG4E16V (X10), V8 // 07540562 + VLSEG4E32V (X10), V8 // 07640562 + VLSEG4E64V (X10), V8 // 07740562 + VLSEG4E8V (X10), V0, V8 // 07040560 + VLSEG4E16V (X10), V0, V8 // 07540560 + VLSEG4E32V (X10), V0, V8 // 07640560 + VLSEG4E64V (X10), V0, V8 // 07740560 + + VLSEG5E8V (X10), V8 // 07040582 + VLSEG5E16V (X10), V8 // 07540582 + VLSEG5E32V (X10), V8 // 07640582 + VLSEG5E64V (X10), V8 // 07740582 + VLSEG5E8V (X10), V0, V8 // 07040580 + VLSEG5E16V (X10), V0, V8 // 07540580 + VLSEG5E32V (X10), V0, V8 // 07640580 + VLSEG5E64V (X10), V0, V8 // 07740580 + + VLSEG6E8V (X10), V8 // 070405a2 + VLSEG6E16V (X10), V8 // 075405a2 + VLSEG6E32V (X10), V8 // 076405a2 + VLSEG6E64V (X10), V8 // 077405a2 + VLSEG6E8V (X10), V0, V8 // 070405a0 + VLSEG6E16V (X10), V0, V8 // 075405a0 + VLSEG6E32V (X10), V0, V8 // 076405a0 + VLSEG6E64V (X10), V0, V8 // 077405a0 + + VLSEG7E8V (X10), V8 // 070405c2 + VLSEG7E16V (X10), V8 // 075405c2 + VLSEG7E32V (X10), V8 // 076405c2 + VLSEG7E64V (X10), V8 // 077405c2 + VLSEG7E8V (X10), V0, V8 // 070405c0 + VLSEG7E16V (X10), V0, V8 // 075405c0 + VLSEG7E32V (X10), V0, V8 // 076405c0 + VLSEG7E64V (X10), V0, V8 // 077405c0 + + VLSEG8E8V (X10), V8 // 070405e2 + VLSEG8E16V (X10), V8 // 075405e2 + VLSEG8E32V (X10), V8 // 076405e2 + VLSEG8E64V (X10), V8 // 077405e2 + VLSEG8E8V (X10), V0, V8 // 070405e0 + VLSEG8E16V (X10), V0, V8 // 075405e0 + VLSEG8E32V (X10), V0, V8 // 076405e0 + VLSEG8E64V (X10), V0, V8 // 077405e0 + + VSSEG2E8V V24, (X10) // 270c0522 + VSSEG2E16V V24, (X10) // 275c0522 + VSSEG2E32V V24, (X10) // 276c0522 + VSSEG2E64V V24, (X10) // 277c0522 + VSSEG2E8V V24, V0, (X10) // 270c0520 + VSSEG2E16V V24, V0, (X10) // 275c0520 + VSSEG2E32V V24, V0, (X10) // 276c0520 + VSSEG2E64V V24, V0, (X10) // 277c0520 + + VSSEG3E8V V24, (X10) // 270c0542 + VSSEG3E16V V24, (X10) // 275c0542 + VSSEG3E32V V24, (X10) // 276c0542 + VSSEG3E64V V24, (X10) // 277c0542 + VSSEG3E8V V24, V0, (X10) // 270c0540 + VSSEG3E16V V24, V0, (X10) // 275c0540 + VSSEG3E32V V24, V0, (X10) // 276c0540 + VSSEG3E64V V24, V0, (X10) // 277c0540 + + VSSEG4E8V V24, (X10) // 270c0562 + VSSEG4E16V V24, (X10) // 275c0562 + VSSEG4E32V V24, (X10) // 276c0562 + VSSEG4E64V V24, (X10) // 277c0562 + VSSEG4E8V V24, V0, (X10) // 270c0560 + VSSEG4E16V V24, V0, (X10) // 275c0560 + VSSEG4E32V V24, V0, (X10) // 276c0560 + VSSEG4E64V V24, V0, (X10) // 277c0560 + + VSSEG5E8V V24, (X10) // 270c0582 + VSSEG5E16V V24, (X10) // 275c0582 + VSSEG5E32V V24, (X10) // 276c0582 + VSSEG5E64V V24, (X10) // 277c0582 + VSSEG5E8V V24, V0, (X10) // 270c0580 + VSSEG5E16V V24, V0, (X10) // 275c0580 + VSSEG5E32V V24, V0, (X10) // 276c0580 + VSSEG5E64V V24, V0, (X10) // 277c0580 + + VSSEG6E8V V24, (X10) // 270c05a2 + VSSEG6E16V V24, (X10) // 275c05a2 + VSSEG6E32V V24, (X10) // 276c05a2 + VSSEG6E64V V24, (X10) // 277c05a2 + VSSEG6E8V V24, V0, (X10) // 270c05a0 + VSSEG6E16V V24, V0, (X10) // 275c05a0 + VSSEG6E32V V24, V0, (X10) // 276c05a0 + VSSEG6E64V V24, V0, (X10) // 277c05a0 + + VSSEG7E8V V24, (X10) // 270c05c2 + VSSEG7E16V V24, (X10) // 275c05c2 + VSSEG7E32V V24, (X10) // 276c05c2 + VSSEG7E64V V24, (X10) // 277c05c2 + VSSEG7E8V V24, V0, (X10) // 270c05c0 + VSSEG7E16V V24, V0, (X10) // 275c05c0 + VSSEG7E32V V24, V0, (X10) // 276c05c0 + VSSEG7E64V V24, V0, (X10) // 277c05c0 + + VSSEG8E8V V24, (X10) // 270c05e2 + VSSEG8E16V V24, (X10) // 275c05e2 + VSSEG8E32V V24, (X10) // 276c05e2 + VSSEG8E64V V24, (X10) // 277c05e2 + VSSEG8E8V V24, V0, (X10) // 270c05e0 + VSSEG8E16V V24, V0, (X10) // 275c05e0 + VSSEG8E32V V24, V0, (X10) // 276c05e0 + VSSEG8E64V V24, V0, (X10) // 277c05e0 + + VLSEG2E8FFV (X10), V8 // 07040523 + VLSEG2E16FFV (X10), V8 // 07540523 + VLSEG2E32FFV (X10), V8 // 07640523 + VLSEG2E64FFV (X10), V8 // 07740523 + VLSEG2E8FFV (X10), V0, V8 // 07040521 + VLSEG2E16FFV (X10), V0, V8 // 07540521 + VLSEG2E32FFV (X10), V0, V8 // 07640521 + VLSEG2E64FFV (X10), V0, V8 // 07740521 + + VLSEG3E8FFV (X10), V8 // 07040543 + VLSEG3E16FFV (X10), V8 // 07540543 + VLSEG3E32FFV (X10), V8 // 07640543 + VLSEG3E64FFV (X10), V8 // 07740543 + VLSEG3E8FFV (X10), V0, V8 // 07040541 + VLSEG3E16FFV (X10), V0, V8 // 07540541 + VLSEG3E32FFV (X10), V0, V8 // 07640541 + VLSEG3E64FFV (X10), V0, V8 // 07740541 + + VLSEG4E8FFV (X10), V8 // 07040563 + VLSEG4E16FFV (X10), V8 // 07540563 + VLSEG4E32FFV (X10), V8 // 07640563 + VLSEG4E64FFV (X10), V8 // 07740563 + VLSEG4E8FFV (X10), V0, V8 // 07040561 + VLSEG4E16FFV (X10), V0, V8 // 07540561 + VLSEG4E32FFV (X10), V0, V8 // 07640561 + VLSEG4E64FFV (X10), V0, V8 // 07740561 + + VLSEG5E8FFV (X10), V8 // 07040583 + VLSEG5E16FFV (X10), V8 // 07540583 + VLSEG5E32FFV (X10), V8 // 07640583 + VLSEG5E64FFV (X10), V8 // 07740583 + VLSEG5E8FFV (X10), V0, V8 // 07040581 + VLSEG5E16FFV (X10), V0, V8 // 07540581 + VLSEG5E32FFV (X10), V0, V8 // 07640581 + VLSEG5E64FFV (X10), V0, V8 // 07740581 + + VLSEG6E8FFV (X10), V8 // 070405a3 + VLSEG6E16FFV (X10), V8 // 075405a3 + VLSEG6E32FFV (X10), V8 // 076405a3 + VLSEG6E64FFV (X10), V8 // 077405a3 + VLSEG6E8FFV (X10), V0, V8 // 070405a1 + VLSEG6E16FFV (X10), V0, V8 // 075405a1 + VLSEG6E32FFV (X10), V0, V8 // 076405a1 + VLSEG6E64FFV (X10), V0, V8 // 077405a1 + + VLSEG7E8FFV (X10), V8 // 070405c3 + VLSEG7E16FFV (X10), V8 // 075405c3 + VLSEG7E32FFV (X10), V8 // 076405c3 + VLSEG7E64FFV (X10), V8 // 077405c3 + VLSEG7E8FFV (X10), V0, V8 // 070405c1 + VLSEG7E16FFV (X10), V0, V8 // 075405c1 + VLSEG7E32FFV (X10), V0, V8 // 076405c1 + VLSEG7E64FFV (X10), V0, V8 // 077405c1 + + VLSEG8E8FFV (X10), V8 // 070405e3 + VLSEG8E16FFV (X10), V8 // 075405e3 + VLSEG8E32FFV (X10), V8 // 076405e3 + VLSEG8E64FFV (X10), V8 // 077405e3 + VLSEG8E8FFV (X10), V0, V8 // 070405e1 + VLSEG8E16FFV (X10), V0, V8 // 075405e1 + VLSEG8E32FFV (X10), V0, V8 // 076405e1 + VLSEG8E64FFV (X10), V0, V8 // 077405e1 + + // 31.7.8.2: Vector Strided Segment Loads and Stores + VLSSEG2E8V (X10), X11, V8 // 0704b52a + VLSSEG2E16V (X10), X11, V8 // 0754b52a + VLSSEG2E32V (X10), X11, V8 // 0764b52a + VLSSEG2E64V (X10), X11, V8 // 0774b52a + VLSSEG2E8V (X10), X11, V0, V8 // 0704b528 + VLSSEG2E16V (X10), X11, V0, V8 // 0754b528 + VLSSEG2E32V (X10), X11, V0, V8 // 0764b528 + VLSSEG2E64V (X10), X11, V0, V8 // 0774b528 + + VLSSEG3E8V (X10), X11, V8 // 0704b54a + VLSSEG3E16V (X10), X11, V8 // 0754b54a + VLSSEG3E32V (X10), X11, V8 // 0764b54a + VLSSEG3E64V (X10), X11, V8 // 0774b54a + VLSSEG3E8V (X10), X11, V0, V8 // 0704b548 + VLSSEG3E16V (X10), X11, V0, V8 // 0754b548 + VLSSEG3E32V (X10), X11, V0, V8 // 0764b548 + VLSSEG3E64V (X10), X11, V0, V8 // 0774b548 + + VLSSEG4E8V (X10), X11, V8 // 0704b56a + VLSSEG4E16V (X10), X11, V8 // 0754b56a + VLSSEG4E32V (X10), X11, V8 // 0764b56a + VLSSEG4E64V (X10), X11, V8 // 0774b56a + VLSSEG4E8V (X10), X11, V0, V8 // 0704b568 + VLSSEG4E16V (X10), X11, V0, V8 // 0754b568 + VLSSEG4E32V (X10), X11, V0, V8 // 0764b568 + VLSSEG4E64V (X10), X11, V0, V8 // 0774b568 + + VLSSEG5E8V (X10), X11, V8 // 0704b58a + VLSSEG5E16V (X10), X11, V8 // 0754b58a + VLSSEG5E32V (X10), X11, V8 // 0764b58a + VLSSEG5E64V (X10), X11, V8 // 0774b58a + VLSSEG5E8V (X10), X11, V0, V8 // 0704b588 + VLSSEG5E16V (X10), X11, V0, V8 // 0754b588 + VLSSEG5E32V (X10), X11, V0, V8 // 0764b588 + VLSSEG5E64V (X10), X11, V0, V8 // 0774b588 + + VLSSEG6E8V (X10), X11, V8 // 0704b5aa + VLSSEG6E16V (X10), X11, V8 // 0754b5aa + VLSSEG6E32V (X10), X11, V8 // 0764b5aa + VLSSEG6E64V (X10), X11, V8 // 0774b5aa + VLSSEG6E8V (X10), X11, V0, V8 // 0704b5a8 + VLSSEG6E16V (X10), X11, V0, V8 // 0754b5a8 + VLSSEG6E32V (X10), X11, V0, V8 // 0764b5a8 + VLSSEG6E64V (X10), X11, V0, V8 // 0774b5a8 + + VLSSEG7E8V (X10), X11, V8 // 0704b5ca + VLSSEG7E16V (X10), X11, V8 // 0754b5ca + VLSSEG7E32V (X10), X11, V8 // 0764b5ca + VLSSEG7E64V (X10), X11, V8 // 0774b5ca + VLSSEG7E8V (X10), X11, V0, V8 // 0704b5c8 + VLSSEG7E16V (X10), X11, V0, V8 // 0754b5c8 + VLSSEG7E32V (X10), X11, V0, V8 // 0764b5c8 + VLSSEG7E64V (X10), X11, V0, V8 // 0774b5c8 + + VLSSEG8E8V (X10), X11, V8 // 0704b5ea + VLSSEG8E16V (X10), X11, V8 // 0754b5ea + VLSSEG8E32V (X10), X11, V8 // 0764b5ea + VLSSEG8E64V (X10), X11, V8 // 0774b5ea + VLSSEG8E8V (X10), X11, V0, V8 // 0704b5e8 + VLSSEG8E16V (X10), X11, V0, V8 // 0754b5e8 + VLSSEG8E32V (X10), X11, V0, V8 // 0764b5e8 + VLSSEG8E64V (X10), X11, V0, V8 // 0774b5e8 + + VSSSEG2E8V V24, X11, (X10) // 270cb52a + VSSSEG2E16V V24, X11, (X10) // 275cb52a + VSSSEG2E32V V24, X11, (X10) // 276cb52a + VSSSEG2E64V V24, X11, (X10) // 277cb52a + VSSSEG2E8V V24, X11, V0, (X10) // 270cb528 + VSSSEG2E16V V24, X11, V0, (X10) // 275cb528 + VSSSEG2E32V V24, X11, V0, (X10) // 276cb528 + VSSSEG2E64V V24, X11, V0, (X10) // 277cb528 + + VSSSEG3E8V V24, X11, (X10) // 270cb54a + VSSSEG3E16V V24, X11, (X10) // 275cb54a + VSSSEG3E32V V24, X11, (X10) // 276cb54a + VSSSEG3E64V V24, X11, (X10) // 277cb54a + VSSSEG3E8V V24, X11, V0, (X10) // 270cb548 + VSSSEG3E16V V24, X11, V0, (X10) // 275cb548 + VSSSEG3E32V V24, X11, V0, (X10) // 276cb548 + VSSSEG3E64V V24, X11, V0, (X10) // 277cb548 + + VSSSEG4E8V V24, X11, (X10) // 270cb56a + VSSSEG4E16V V24, X11, (X10) // 275cb56a + VSSSEG4E32V V24, X11, (X10) // 276cb56a + VSSSEG4E64V V24, X11, (X10) // 277cb56a + VSSSEG4E8V V24, X11, V0, (X10) // 270cb568 + VSSSEG4E16V V24, X11, V0, (X10) // 275cb568 + VSSSEG4E32V V24, X11, V0, (X10) // 276cb568 + VSSSEG4E64V V24, X11, V0, (X10) // 277cb568 + + VSSSEG5E8V V24, X11, (X10) // 270cb58a + VSSSEG5E16V V24, X11, (X10) // 275cb58a + VSSSEG5E32V V24, X11, (X10) // 276cb58a + VSSSEG5E64V V24, X11, (X10) // 277cb58a + VSSSEG5E8V V24, X11, V0, (X10) // 270cb588 + VSSSEG5E16V V24, X11, V0, (X10) // 275cb588 + VSSSEG5E32V V24, X11, V0, (X10) // 276cb588 + VSSSEG5E64V V24, X11, V0, (X10) // 277cb588 + + VSSSEG6E8V V24, X11, (X10) // 270cb5aa + VSSSEG6E16V V24, X11, (X10) // 275cb5aa + VSSSEG6E32V V24, X11, (X10) // 276cb5aa + VSSSEG6E64V V24, X11, (X10) // 277cb5aa + VSSSEG6E8V V24, X11, V0, (X10) // 270cb5a8 + VSSSEG6E16V V24, X11, V0, (X10) // 275cb5a8 + VSSSEG6E32V V24, X11, V0, (X10) // 276cb5a8 + VSSSEG6E64V V24, X11, V0, (X10) // 277cb5a8 + + VSSSEG7E8V V24, X11, (X10) // 270cb5ca + VSSSEG7E16V V24, X11, (X10) // 275cb5ca + VSSSEG7E32V V24, X11, (X10) // 276cb5ca + VSSSEG7E64V V24, X11, (X10) // 277cb5ca + VSSSEG7E8V V24, X11, V0, (X10) // 270cb5c8 + VSSSEG7E16V V24, X11, V0, (X10) // 275cb5c8 + VSSSEG7E32V V24, X11, V0, (X10) // 276cb5c8 + VSSSEG7E64V V24, X11, V0, (X10) // 277cb5c8 + + VSSSEG8E8V V24, X11, (X10) // 270cb5ea + VSSSEG8E16V V24, X11, (X10) // 275cb5ea + VSSSEG8E32V V24, X11, (X10) // 276cb5ea + VSSSEG8E64V V24, X11, (X10) // 277cb5ea + VSSSEG8E8V V24, X11, V0, (X10) // 270cb5e8 + VSSSEG8E16V V24, X11, V0, (X10) // 275cb5e8 + VSSSEG8E32V V24, X11, V0, (X10) // 276cb5e8 + VSSSEG8E64V V24, X11, V0, (X10) // 277cb5e8 + + // 31.7.8.3: Vector Indexed Segment Loads and Stores + + VLUXSEG2EI8V (X10), V4, V8 // 07044526 + VLUXSEG2EI16V (X10), V4, V8 // 07544526 + VLUXSEG2EI32V (X10), V4, V8 // 07644526 + VLUXSEG2EI64V (X10), V4, V8 // 07744526 + VLUXSEG2EI8V (X10), V4, V0, V8 // 07044524 + VLUXSEG2EI16V (X10), V4, V0, V8 // 07544524 + VLUXSEG2EI32V (X10), V4, V0, V8 // 07644524 + VLUXSEG2EI64V (X10), V4, V0, V8 // 07744524 + + VLUXSEG3EI8V (X10), V4, V8 // 07044546 + VLUXSEG3EI16V (X10), V4, V8 // 07544546 + VLUXSEG3EI32V (X10), V4, V8 // 07644546 + VLUXSEG3EI64V (X10), V4, V8 // 07744546 + VLUXSEG3EI8V (X10), V4, V0, V8 // 07044544 + VLUXSEG3EI16V (X10), V4, V0, V8 // 07544544 + VLUXSEG3EI32V (X10), V4, V0, V8 // 07644544 + VLUXSEG3EI64V (X10), V4, V0, V8 // 07744544 + + VLUXSEG4EI8V (X10), V4, V8 // 07044566 + VLUXSEG4EI16V (X10), V4, V8 // 07544566 + VLUXSEG4EI32V (X10), V4, V8 // 07644566 + VLUXSEG4EI64V (X10), V4, V8 // 07744566 + VLUXSEG4EI8V (X10), V4, V0, V8 // 07044564 + VLUXSEG4EI16V (X10), V4, V0, V8 // 07544564 + VLUXSEG4EI32V (X10), V4, V0, V8 // 07644564 + VLUXSEG4EI64V (X10), V4, V0, V8 // 07744564 + + VLUXSEG5EI8V (X10), V4, V8 // 07044586 + VLUXSEG5EI16V (X10), V4, V8 // 07544586 + VLUXSEG5EI32V (X10), V4, V8 // 07644586 + VLUXSEG5EI64V (X10), V4, V8 // 07744586 + VLUXSEG5EI8V (X10), V4, V0, V8 // 07044584 + VLUXSEG5EI16V (X10), V4, V0, V8 // 07544584 + VLUXSEG5EI32V (X10), V4, V0, V8 // 07644584 + VLUXSEG5EI64V (X10), V4, V0, V8 // 07744584 + + VLUXSEG6EI8V (X10), V4, V8 // 070445a6 + VLUXSEG6EI16V (X10), V4, V8 // 075445a6 + VLUXSEG6EI32V (X10), V4, V8 // 076445a6 + VLUXSEG6EI64V (X10), V4, V8 // 077445a6 + VLUXSEG6EI8V (X10), V4, V0, V8 // 070445a4 + VLUXSEG6EI16V (X10), V4, V0, V8 // 075445a4 + VLUXSEG6EI32V (X10), V4, V0, V8 // 076445a4 + VLUXSEG6EI64V (X10), V4, V0, V8 // 077445a4 + + VLOXSEG6EI8V (X10), V4, V8 // 070445ae + VLOXSEG6EI16V (X10), V4, V8 // 075445ae + VLOXSEG6EI32V (X10), V4, V8 // 076445ae + VLOXSEG6EI64V (X10), V4, V8 // 077445ae + VLOXSEG6EI8V (X10), V4, V0, V8 // 070445ac + VLOXSEG6EI16V (X10), V4, V0, V8 // 075445ac + VLOXSEG6EI32V (X10), V4, V0, V8 // 076445ac + VLOXSEG6EI64V (X10), V4, V0, V8 // 077445ac + + VLUXSEG7EI8V (X10), V4, V8 // 070445c6 + VLUXSEG7EI16V (X10), V4, V8 // 075445c6 + VLUXSEG7EI32V (X10), V4, V8 // 076445c6 + VLUXSEG7EI64V (X10), V4, V8 // 077445c6 + VLUXSEG7EI8V (X10), V4, V0, V8 // 070445c4 + VLUXSEG7EI16V (X10), V4, V0, V8 // 075445c4 + VLUXSEG7EI32V (X10), V4, V0, V8 // 076445c4 + VLUXSEG7EI64V (X10), V4, V0, V8 // 077445c4 + + VLUXSEG8EI8V (X10), V4, V8 // 070445e6 + VLUXSEG8EI16V (X10), V4, V8 // 075445e6 + VLUXSEG8EI32V (X10), V4, V8 // 076445e6 + VLUXSEG8EI64V (X10), V4, V8 // 077445e6 + VLUXSEG8EI8V (X10), V4, V0, V8 // 070445e4 + VLUXSEG8EI16V (X10), V4, V0, V8 // 075445e4 + VLUXSEG8EI32V (X10), V4, V0, V8 // 076445e4 + VLUXSEG8EI64V (X10), V4, V0, V8 // 077445e4 + + VSUXSEG2EI8V V24, V4, (X10) // 270c4526 + VSUXSEG2EI16V V24, V4, (X10) // 275c4526 + VSUXSEG2EI32V V24, V4, (X10) // 276c4526 + VSUXSEG2EI64V V24, V4, (X10) // 277c4526 + VSUXSEG2EI8V V24, V4, V0, (X10) // 270c4524 + VSUXSEG2EI16V V24, V4, V0, (X10) // 275c4524 + VSUXSEG2EI32V V24, V4, V0, (X10) // 276c4524 + VSUXSEG2EI64V V24, V4, V0, (X10) // 277c4524 + + VSUXSEG3EI8V V24, V4, (X10) // 270c4546 + VSUXSEG3EI16V V24, V4, (X10) // 275c4546 + VSUXSEG3EI32V V24, V4, (X10) // 276c4546 + VSUXSEG3EI64V V24, V4, (X10) // 277c4546 + VSUXSEG3EI8V V24, V4, V0, (X10) // 270c4544 + VSUXSEG3EI16V V24, V4, V0, (X10) // 275c4544 + VSUXSEG3EI32V V24, V4, V0, (X10) // 276c4544 + VSUXSEG3EI64V V24, V4, V0, (X10) // 277c4544 + + VSUXSEG4EI8V V24, V4, (X10) // 270c4566 + VSUXSEG4EI16V V24, V4, (X10) // 275c4566 + VSUXSEG4EI32V V24, V4, (X10) // 276c4566 + VSUXSEG4EI64V V24, V4, (X10) // 277c4566 + VSUXSEG4EI8V V24, V4, V0, (X10) // 270c4564 + VSUXSEG4EI16V V24, V4, V0, (X10) // 275c4564 + VSUXSEG4EI32V V24, V4, V0, (X10) // 276c4564 + VSUXSEG4EI64V V24, V4, V0, (X10) // 277c4564 + + VSUXSEG5EI8V V24, V4, (X10) // 270c4586 + VSUXSEG5EI16V V24, V4, (X10) // 275c4586 + VSUXSEG5EI32V V24, V4, (X10) // 276c4586 + VSUXSEG5EI64V V24, V4, (X10) // 277c4586 + VSUXSEG5EI8V V24, V4, V0, (X10) // 270c4584 + VSUXSEG5EI16V V24, V4, V0, (X10) // 275c4584 + VSUXSEG5EI32V V24, V4, V0, (X10) // 276c4584 + VSUXSEG5EI64V V24, V4, V0, (X10) // 277c4584 + + VSUXSEG6EI8V V24, V4, (X10) // 270c45a6 + VSUXSEG6EI16V V24, V4, (X10) // 275c45a6 + VSUXSEG6EI32V V24, V4, (X10) // 276c45a6 + VSUXSEG6EI64V V24, V4, (X10) // 277c45a6 + VSUXSEG6EI8V V24, V4, V0, (X10) // 270c45a4 + VSUXSEG6EI16V V24, V4, V0, (X10) // 275c45a4 + VSUXSEG6EI32V V24, V4, V0, (X10) // 276c45a4 + VSUXSEG6EI64V V24, V4, V0, (X10) // 277c45a4 + + VSUXSEG7EI8V V24, V4, (X10) // 270c45c6 + VSUXSEG7EI16V V24, V4, (X10) // 275c45c6 + VSUXSEG7EI32V V24, V4, (X10) // 276c45c6 + VSUXSEG7EI64V V24, V4, (X10) // 277c45c6 + VSUXSEG7EI8V V24, V4, V0, (X10) // 270c45c4 + VSUXSEG7EI16V V24, V4, V0, (X10) // 275c45c4 + VSUXSEG7EI32V V24, V4, V0, (X10) // 276c45c4 + VSUXSEG7EI64V V24, V4, V0, (X10) // 277c45c4 + + VSUXSEG8EI8V V24, V4, (X10) // 270c45e6 + VSUXSEG8EI16V V24, V4, (X10) // 275c45e6 + VSUXSEG8EI32V V24, V4, (X10) // 276c45e6 + VSUXSEG8EI64V V24, V4, (X10) // 277c45e6 + VSUXSEG8EI8V V24, V4, V0, (X10) // 270c45e4 + VSUXSEG8EI16V V24, V4, V0, (X10) // 275c45e4 + VSUXSEG8EI32V V24, V4, V0, (X10) // 276c45e4 + VSUXSEG8EI64V V24, V4, V0, (X10) // 277c45e4 + + VLOXSEG2EI8V (X10), V4, V8 // 0704452e + VLOXSEG2EI16V (X10), V4, V8 // 0754452e + VLOXSEG2EI32V (X10), V4, V8 // 0764452e + VLOXSEG2EI64V (X10), V4, V8 // 0774452e + VLOXSEG2EI8V (X10), V4, V0, V8 // 0704452c + VLOXSEG2EI16V (X10), V4, V0, V8 // 0754452c + VLOXSEG2EI32V (X10), V4, V0, V8 // 0764452c + VLOXSEG2EI64V (X10), V4, V0, V8 // 0774452c + + VLOXSEG3EI8V (X10), V4, V8 // 0704454e + VLOXSEG3EI16V (X10), V4, V8 // 0754454e + VLOXSEG3EI32V (X10), V4, V8 // 0764454e + VLOXSEG3EI64V (X10), V4, V8 // 0774454e + VLOXSEG3EI8V (X10), V4, V0, V8 // 0704454c + VLOXSEG3EI16V (X10), V4, V0, V8 // 0754454c + VLOXSEG3EI32V (X10), V4, V0, V8 // 0764454c + VLOXSEG3EI64V (X10), V4, V0, V8 // 0774454c + VLOXSEG4EI8V (X10), V4, V8 // 0704456e + VLOXSEG4EI16V (X10), V4, V8 // 0754456e + VLOXSEG4EI32V (X10), V4, V8 // 0764456e + VLOXSEG4EI64V (X10), V4, V8 // 0774456e + VLOXSEG4EI8V (X10), V4, V0, V8 // 0704456c + VLOXSEG4EI16V (X10), V4, V0, V8 // 0754456c + VLOXSEG4EI32V (X10), V4, V0, V8 // 0764456c + VLOXSEG4EI64V (X10), V4, V0, V8 // 0774456c + + VLOXSEG5EI8V (X10), V4, V8 // 0704458e + VLOXSEG5EI16V (X10), V4, V8 // 0754458e + VLOXSEG5EI32V (X10), V4, V8 // 0764458e + VLOXSEG5EI64V (X10), V4, V8 // 0774458e + VLOXSEG5EI8V (X10), V4, V0, V8 // 0704458c + VLOXSEG5EI16V (X10), V4, V0, V8 // 0754458c + VLOXSEG5EI32V (X10), V4, V0, V8 // 0764458c + VLOXSEG5EI64V (X10), V4, V0, V8 // 0774458c + + VLOXSEG7EI8V (X10), V4, V8 // 070445ce + VLOXSEG7EI16V (X10), V4, V8 // 075445ce + VLOXSEG7EI32V (X10), V4, V8 // 076445ce + VLOXSEG7EI64V (X10), V4, V8 // 077445ce + VLOXSEG7EI8V (X10), V4, V0, V8 // 070445cc + VLOXSEG7EI16V (X10), V4, V0, V8 // 075445cc + VLOXSEG7EI32V (X10), V4, V0, V8 // 076445cc + VLOXSEG7EI64V (X10), V4, V0, V8 // 077445cc + + VLOXSEG8EI8V (X10), V4, V8 // 070445ee + VLOXSEG8EI16V (X10), V4, V8 // 075445ee + VLOXSEG8EI32V (X10), V4, V8 // 076445ee + VLOXSEG8EI64V (X10), V4, V8 // 077445ee + VLOXSEG8EI8V (X10), V4, V0, V8 // 070445ec + VLOXSEG8EI16V (X10), V4, V0, V8 // 075445ec + VLOXSEG8EI32V (X10), V4, V0, V8 // 076445ec + VLOXSEG8EI64V (X10), V4, V0, V8 // 077445ec + + VSOXSEG2EI8V V24, V4, (X10) // 270c452e + VSOXSEG2EI16V V24, V4, (X10) // 275c452e + VSOXSEG2EI32V V24, V4, (X10) // 276c452e + VSOXSEG2EI64V V24, V4, (X10) // 277c452e + VSOXSEG2EI8V V24, V4, V0, (X10) // 270c452c + VSOXSEG2EI16V V24, V4, V0, (X10) // 275c452c + VSOXSEG2EI32V V24, V4, V0, (X10) // 276c452c + VSOXSEG2EI64V V24, V4, V0, (X10) // 277c452c + + VSOXSEG3EI8V V24, V4, (X10) // 270c454e + VSOXSEG3EI16V V24, V4, (X10) // 275c454e + VSOXSEG3EI32V V24, V4, (X10) // 276c454e + VSOXSEG3EI64V V24, V4, (X10) // 277c454e + VSOXSEG3EI8V V24, V4, V0, (X10) // 270c454c + VSOXSEG3EI16V V24, V4, V0, (X10) // 275c454c + VSOXSEG3EI32V V24, V4, V0, (X10) // 276c454c + VSOXSEG3EI64V V24, V4, V0, (X10) // 277c454c + + VSOXSEG4EI8V V24, V4, (X10) // 270c456e + VSOXSEG4EI16V V24, V4, (X10) // 275c456e + VSOXSEG4EI32V V24, V4, (X10) // 276c456e + VSOXSEG4EI64V V24, V4, (X10) // 277c456e + VSOXSEG4EI8V V24, V4, V0, (X10) // 270c456c + VSOXSEG4EI16V V24, V4, V0, (X10) // 275c456c + VSOXSEG4EI32V V24, V4, V0, (X10) // 276c456c + VSOXSEG4EI64V V24, V4, V0, (X10) // 277c456c + + VSOXSEG5EI8V V24, V4, (X10) // 270c458e + VSOXSEG5EI16V V24, V4, (X10) // 275c458e + VSOXSEG5EI32V V24, V4, (X10) // 276c458e + VSOXSEG5EI64V V24, V4, (X10) // 277c458e + VSOXSEG5EI8V V24, V4, V0, (X10) // 270c458c + VSOXSEG5EI16V V24, V4, V0, (X10) // 275c458c + VSOXSEG5EI32V V24, V4, V0, (X10) // 276c458c + VSOXSEG5EI64V V24, V4, V0, (X10) // 277c458c + + VSOXSEG6EI8V V24, V4, (X10) // 270c45ae + VSOXSEG6EI16V V24, V4, (X10) // 275c45ae + VSOXSEG6EI32V V24, V4, (X10) // 276c45ae + VSOXSEG6EI64V V24, V4, (X10) // 277c45ae + VSOXSEG6EI8V V24, V4, V0, (X10) // 270c45ac + VSOXSEG6EI16V V24, V4, V0, (X10) // 275c45ac + VSOXSEG6EI32V V24, V4, V0, (X10) // 276c45ac + VSOXSEG6EI64V V24, V4, V0, (X10) // 277c45ac + + VSOXSEG7EI8V V24, V4, (X10) // 270c45ce + VSOXSEG7EI16V V24, V4, (X10) // 275c45ce + VSOXSEG7EI32V V24, V4, (X10) // 276c45ce + VSOXSEG7EI64V V24, V4, (X10) // 277c45ce + VSOXSEG7EI8V V24, V4, V0, (X10) // 270c45cc + VSOXSEG7EI16V V24, V4, V0, (X10) // 275c45cc + VSOXSEG7EI32V V24, V4, V0, (X10) // 276c45cc + VSOXSEG7EI64V V24, V4, V0, (X10) // 277c45cc + + VSOXSEG8EI8V V24, V4, (X10) // 270c45ee + VSOXSEG8EI16V V24, V4, (X10) // 275c45ee + VSOXSEG8EI32V V24, V4, (X10) // 276c45ee + VSOXSEG8EI64V V24, V4, (X10) // 277c45ee + VSOXSEG8EI8V V24, V4, V0, (X10) // 270c45ec + VSOXSEG8EI16V V24, V4, V0, (X10) // 275c45ec + VSOXSEG8EI32V V24, V4, V0, (X10) // 276c45ec + VSOXSEG8EI64V V24, V4, V0, (X10) // 277c45ec + // 31.7.9: Vector Load/Store Whole Register Instructions VL1RV (X10), V3 // 87018502 VL1RE8V (X10), V3 // 87018502 diff --git a/src/cmd/asm/internal/asm/testdata/riscv64error.s b/src/cmd/asm/internal/asm/testdata/riscv64error.s index 434f221fd9..113b4ad2d6 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64error.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64error.s @@ -80,6 +80,15 @@ TEXT errors(SB),$0 VSUXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register" VLOXEI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register" VSOXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register" + VLSEG2E8V (X10), V1, V3 // ERROR "invalid vector mask register" + VLSEG2E8FFV (X10), V1, V3 // ERROR "invalid vector mask register" + VSSEG2E8V V3, V1, (X10) // ERROR "invalid vector mask register" + VLSSEG2E8V (X10), X10, V1, V3 // ERROR "invalid vector mask register" + VSSSEG2E8V V3, X11, V1, (X10) // ERROR "invalid vector mask register" + VLUXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register" + VSUXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register" + VLOXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register" + VSOXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register" VL1RV (X10), V0, V3 // ERROR "too many operands for instruction" VS1RV V3, V0, (X11) // ERROR "too many operands for instruction" VADDVV V1, V2, V4, V3 // ERROR "invalid vector mask register" diff --git a/src/cmd/asm/internal/asm/testdata/riscv64validation.s b/src/cmd/asm/internal/asm/testdata/riscv64validation.s index 55bf518e68..eac1a992c3 100644 --- a/src/cmd/asm/internal/asm/testdata/riscv64validation.s +++ b/src/cmd/asm/internal/asm/testdata/riscv64validation.s @@ -43,6 +43,33 @@ TEXT validation(SB),$0 VSOXEI8V X10, V2, (X10) // ERROR "expected vector register in vd position" VSOXEI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position" VSOXEI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position" + VLSEG2E8V (X10), X10 // ERROR "expected vector register in vd position" + VLSEG2E8V (V1), V3 // ERROR "expected integer register in rs1 position" + VLSEG2E8FFV (X10), X10 // ERROR "expected vector register in vd position" + VLSEG2E8FFV (V1), V3 // ERROR "expected integer register in rs1 position" + VSSEG2E8V X10, (X10) // ERROR "expected vector register in vs1 position" + VSSEG2E8V V3, (V1) // ERROR "expected integer register in rd position" + VLSSEG2E8V (X10), V3 // ERROR "expected integer register in rs2 position" + VLSSEG2E8V (X10), X10, X11 // ERROR "expected vector register in vd position" + VLSSEG2E8V (V1), X10, V3 // ERROR "expected integer register in rs1 position" + VLSSEG2E8V (X10), V1, V0, V3 // ERROR "expected integer register in rs2 position" + VSSSEG2E8V V3, (X10) // ERROR "expected integer register in rs2 position" + VSSSEG2E8V X10, X11, (X10) // ERROR "expected vector register in vd position" + VSSSEG2E8V V3, X11, (V1) // ERROR "expected integer register in rs1 position" + VSSSEG2E8V V3, V1, V0, (X10) // ERROR "expected integer register in rs2 position" + VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position" + VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position" + VLUXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position" + VLUXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position" + VSUXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position" + VSUXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position" + VSUXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position" + VLOXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position" + VLOXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position" + VLOXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position" + VSOXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position" + VSOXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position" + VSOXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position" VL1RV (X10), X10 // ERROR "expected vector register in vd position" VL1RV (V1), V3 // ERROR "expected integer register in rs1 position" VS1RV X11, (X11) // ERROR "expected vector register in vs1 position" diff --git a/src/cmd/internal/obj/riscv/anames.go b/src/cmd/internal/obj/riscv/anames.go index f0be8f6b87..88ac746573 100644 --- a/src/cmd/internal/obj/riscv/anames.go +++ b/src/cmd/internal/obj/riscv/anames.go @@ -314,6 +314,258 @@ var Anames = []string{ "VLE16FFV", "VLE32FFV", "VLE64FFV", + "VLSEG2E8V", + "VLSEG3E8V", + "VLSEG4E8V", + "VLSEG5E8V", + "VLSEG6E8V", + "VLSEG7E8V", + "VLSEG8E8V", + "VLSEG2E16V", + "VLSEG3E16V", + "VLSEG4E16V", + "VLSEG5E16V", + "VLSEG6E16V", + "VLSEG7E16V", + "VLSEG8E16V", + "VLSEG2E32V", + "VLSEG3E32V", + "VLSEG4E32V", + "VLSEG5E32V", + "VLSEG6E32V", + "VLSEG7E32V", + "VLSEG8E32V", + "VLSEG2E64V", + "VLSEG3E64V", + "VLSEG4E64V", + "VLSEG5E64V", + "VLSEG6E64V", + "VLSEG7E64V", + "VLSEG8E64V", + "VSSEG2E8V", + "VSSEG3E8V", + "VSSEG4E8V", + "VSSEG5E8V", + "VSSEG6E8V", + "VSSEG7E8V", + "VSSEG8E8V", + "VSSEG2E16V", + "VSSEG3E16V", + "VSSEG4E16V", + "VSSEG5E16V", + "VSSEG6E16V", + "VSSEG7E16V", + "VSSEG8E16V", + "VSSEG2E32V", + "VSSEG3E32V", + "VSSEG4E32V", + "VSSEG5E32V", + "VSSEG6E32V", + "VSSEG7E32V", + "VSSEG8E32V", + "VSSEG2E64V", + "VSSEG3E64V", + "VSSEG4E64V", + "VSSEG5E64V", + "VSSEG6E64V", + "VSSEG7E64V", + "VSSEG8E64V", + "VLSEG2E8FFV", + "VLSEG3E8FFV", + "VLSEG4E8FFV", + "VLSEG5E8FFV", + "VLSEG6E8FFV", + "VLSEG7E8FFV", + "VLSEG8E8FFV", + "VLSEG2E16FFV", + "VLSEG3E16FFV", + "VLSEG4E16FFV", + "VLSEG5E16FFV", + "VLSEG6E16FFV", + "VLSEG7E16FFV", + "VLSEG8E16FFV", + "VLSEG2E32FFV", + "VLSEG3E32FFV", + "VLSEG4E32FFV", + "VLSEG5E32FFV", + "VLSEG6E32FFV", + "VLSEG7E32FFV", + "VLSEG8E32FFV", + "VLSEG2E64FFV", + "VLSEG3E64FFV", + "VLSEG4E64FFV", + "VLSEG5E64FFV", + "VLSEG6E64FFV", + "VLSEG7E64FFV", + "VLSEG8E64FFV", + "VLSSEG2E8V", + "VLSSEG3E8V", + "VLSSEG4E8V", + "VLSSEG5E8V", + "VLSSEG6E8V", + "VLSSEG7E8V", + "VLSSEG8E8V", + "VLSSEG2E16V", + "VLSSEG3E16V", + "VLSSEG4E16V", + "VLSSEG5E16V", + "VLSSEG6E16V", + "VLSSEG7E16V", + "VLSSEG8E16V", + "VLSSEG2E32V", + "VLSSEG3E32V", + "VLSSEG4E32V", + "VLSSEG5E32V", + "VLSSEG6E32V", + "VLSSEG7E32V", + "VLSSEG8E32V", + "VLSSEG2E64V", + "VLSSEG3E64V", + "VLSSEG4E64V", + "VLSSEG5E64V", + "VLSSEG6E64V", + "VLSSEG7E64V", + "VLSSEG8E64V", + "VSSSEG2E8V", + "VSSSEG3E8V", + "VSSSEG4E8V", + "VSSSEG5E8V", + "VSSSEG6E8V", + "VSSSEG7E8V", + "VSSSEG8E8V", + "VSSSEG2E16V", + "VSSSEG3E16V", + "VSSSEG4E16V", + "VSSSEG5E16V", + "VSSSEG6E16V", + "VSSSEG7E16V", + "VSSSEG8E16V", + "VSSSEG2E32V", + "VSSSEG3E32V", + "VSSSEG4E32V", + "VSSSEG5E32V", + "VSSSEG6E32V", + "VSSSEG7E32V", + "VSSSEG8E32V", + "VSSSEG2E64V", + "VSSSEG3E64V", + "VSSSEG4E64V", + "VSSSEG5E64V", + "VSSSEG6E64V", + "VSSSEG7E64V", + "VSSSEG8E64V", + "VLOXSEG2EI8V", + "VLOXSEG3EI8V", + "VLOXSEG4EI8V", + "VLOXSEG5EI8V", + "VLOXSEG6EI8V", + "VLOXSEG7EI8V", + "VLOXSEG8EI8V", + "VLOXSEG2EI16V", + "VLOXSEG3EI16V", + "VLOXSEG4EI16V", + "VLOXSEG5EI16V", + "VLOXSEG6EI16V", + "VLOXSEG7EI16V", + "VLOXSEG8EI16V", + "VLOXSEG2EI32V", + "VLOXSEG3EI32V", + "VLOXSEG4EI32V", + "VLOXSEG5EI32V", + "VLOXSEG6EI32V", + "VLOXSEG7EI32V", + "VLOXSEG8EI32V", + "VLOXSEG2EI64V", + "VLOXSEG3EI64V", + "VLOXSEG4EI64V", + "VLOXSEG5EI64V", + "VLOXSEG6EI64V", + "VLOXSEG7EI64V", + "VLOXSEG8EI64V", + "VSOXSEG2EI8V", + "VSOXSEG3EI8V", + "VSOXSEG4EI8V", + "VSOXSEG5EI8V", + "VSOXSEG6EI8V", + "VSOXSEG7EI8V", + "VSOXSEG8EI8V", + "VSOXSEG2EI16V", + "VSOXSEG3EI16V", + "VSOXSEG4EI16V", + "VSOXSEG5EI16V", + "VSOXSEG6EI16V", + "VSOXSEG7EI16V", + "VSOXSEG8EI16V", + "VSOXSEG2EI32V", + "VSOXSEG3EI32V", + "VSOXSEG4EI32V", + "VSOXSEG5EI32V", + "VSOXSEG6EI32V", + "VSOXSEG7EI32V", + "VSOXSEG8EI32V", + "VSOXSEG2EI64V", + "VSOXSEG3EI64V", + "VSOXSEG4EI64V", + "VSOXSEG5EI64V", + "VSOXSEG6EI64V", + "VSOXSEG7EI64V", + "VSOXSEG8EI64V", + "VLUXSEG2EI8V", + "VLUXSEG3EI8V", + "VLUXSEG4EI8V", + "VLUXSEG5EI8V", + "VLUXSEG6EI8V", + "VLUXSEG7EI8V", + "VLUXSEG8EI8V", + "VLUXSEG2EI16V", + "VLUXSEG3EI16V", + "VLUXSEG4EI16V", + "VLUXSEG5EI16V", + "VLUXSEG6EI16V", + "VLUXSEG7EI16V", + "VLUXSEG8EI16V", + "VLUXSEG2EI32V", + "VLUXSEG3EI32V", + "VLUXSEG4EI32V", + "VLUXSEG5EI32V", + "VLUXSEG6EI32V", + "VLUXSEG7EI32V", + "VLUXSEG8EI32V", + "VLUXSEG2EI64V", + "VLUXSEG3EI64V", + "VLUXSEG4EI64V", + "VLUXSEG5EI64V", + "VLUXSEG6EI64V", + "VLUXSEG7EI64V", + "VLUXSEG8EI64V", + "VSUXSEG2EI8V", + "VSUXSEG3EI8V", + "VSUXSEG4EI8V", + "VSUXSEG5EI8V", + "VSUXSEG6EI8V", + "VSUXSEG7EI8V", + "VSUXSEG8EI8V", + "VSUXSEG2EI16V", + "VSUXSEG3EI16V", + "VSUXSEG4EI16V", + "VSUXSEG5EI16V", + "VSUXSEG6EI16V", + "VSUXSEG7EI16V", + "VSUXSEG8EI16V", + "VSUXSEG2EI32V", + "VSUXSEG3EI32V", + "VSUXSEG4EI32V", + "VSUXSEG5EI32V", + "VSUXSEG6EI32V", + "VSUXSEG7EI32V", + "VSUXSEG8EI32V", + "VSUXSEG2EI64V", + "VSUXSEG3EI64V", + "VSUXSEG4EI64V", + "VSUXSEG5EI64V", + "VSUXSEG6EI64V", + "VSUXSEG7EI64V", + "VSUXSEG8EI64V", "VL1RE8V", "VL1RE16V", "VL1RE32V", diff --git a/src/cmd/internal/obj/riscv/cpu.go b/src/cmd/internal/obj/riscv/cpu.go index b0fcda218c..e265e04482 100644 --- a/src/cmd/internal/obj/riscv/cpu.go +++ b/src/cmd/internal/obj/riscv/cpu.go @@ -744,6 +744,272 @@ const ( AVLE32FFV AVLE64FFV + // 31.7.8. Vector Load/Store Segment Instructions + + // 31.7.8.1. Vector Unit-Stride Segment Loads and Stores + AVLSEG2E8V + AVLSEG3E8V + AVLSEG4E8V + AVLSEG5E8V + AVLSEG6E8V + AVLSEG7E8V + AVLSEG8E8V + AVLSEG2E16V + AVLSEG3E16V + AVLSEG4E16V + AVLSEG5E16V + AVLSEG6E16V + AVLSEG7E16V + AVLSEG8E16V + AVLSEG2E32V + AVLSEG3E32V + AVLSEG4E32V + AVLSEG5E32V + AVLSEG6E32V + AVLSEG7E32V + AVLSEG8E32V + AVLSEG2E64V + AVLSEG3E64V + AVLSEG4E64V + AVLSEG5E64V + AVLSEG6E64V + AVLSEG7E64V + AVLSEG8E64V + + AVSSEG2E8V + AVSSEG3E8V + AVSSEG4E8V + AVSSEG5E8V + AVSSEG6E8V + AVSSEG7E8V + AVSSEG8E8V + AVSSEG2E16V + AVSSEG3E16V + AVSSEG4E16V + AVSSEG5E16V + AVSSEG6E16V + AVSSEG7E16V + AVSSEG8E16V + AVSSEG2E32V + AVSSEG3E32V + AVSSEG4E32V + AVSSEG5E32V + AVSSEG6E32V + AVSSEG7E32V + AVSSEG8E32V + AVSSEG2E64V + AVSSEG3E64V + AVSSEG4E64V + AVSSEG5E64V + AVSSEG6E64V + AVSSEG7E64V + AVSSEG8E64V + + AVLSEG2E8FFV + AVLSEG3E8FFV + AVLSEG4E8FFV + AVLSEG5E8FFV + AVLSEG6E8FFV + AVLSEG7E8FFV + AVLSEG8E8FFV + AVLSEG2E16FFV + AVLSEG3E16FFV + AVLSEG4E16FFV + AVLSEG5E16FFV + AVLSEG6E16FFV + AVLSEG7E16FFV + AVLSEG8E16FFV + AVLSEG2E32FFV + AVLSEG3E32FFV + AVLSEG4E32FFV + AVLSEG5E32FFV + AVLSEG6E32FFV + AVLSEG7E32FFV + AVLSEG8E32FFV + AVLSEG2E64FFV + AVLSEG3E64FFV + AVLSEG4E64FFV + AVLSEG5E64FFV + AVLSEG6E64FFV + AVLSEG7E64FFV + AVLSEG8E64FFV + + // 31.7.8.2. Vector Strided Segment Loads and Stores + AVLSSEG2E8V + AVLSSEG3E8V + AVLSSEG4E8V + AVLSSEG5E8V + AVLSSEG6E8V + AVLSSEG7E8V + AVLSSEG8E8V + AVLSSEG2E16V + AVLSSEG3E16V + AVLSSEG4E16V + AVLSSEG5E16V + AVLSSEG6E16V + AVLSSEG7E16V + AVLSSEG8E16V + AVLSSEG2E32V + AVLSSEG3E32V + AVLSSEG4E32V + AVLSSEG5E32V + AVLSSEG6E32V + AVLSSEG7E32V + AVLSSEG8E32V + AVLSSEG2E64V + AVLSSEG3E64V + AVLSSEG4E64V + AVLSSEG5E64V + AVLSSEG6E64V + AVLSSEG7E64V + AVLSSEG8E64V + + AVSSSEG2E8V + AVSSSEG3E8V + AVSSSEG4E8V + AVSSSEG5E8V + AVSSSEG6E8V + AVSSSEG7E8V + AVSSSEG8E8V + AVSSSEG2E16V + AVSSSEG3E16V + AVSSSEG4E16V + AVSSSEG5E16V + AVSSSEG6E16V + AVSSSEG7E16V + AVSSSEG8E16V + AVSSSEG2E32V + AVSSSEG3E32V + AVSSSEG4E32V + AVSSSEG5E32V + AVSSSEG6E32V + AVSSSEG7E32V + AVSSSEG8E32V + AVSSSEG2E64V + AVSSSEG3E64V + AVSSSEG4E64V + AVSSSEG5E64V + AVSSSEG6E64V + AVSSSEG7E64V + AVSSSEG8E64V + + // 31.7.8.3. Vector Indexed Segment Loads and Stores + AVLOXSEG2EI8V + AVLOXSEG3EI8V + AVLOXSEG4EI8V + AVLOXSEG5EI8V + AVLOXSEG6EI8V + AVLOXSEG7EI8V + AVLOXSEG8EI8V + AVLOXSEG2EI16V + AVLOXSEG3EI16V + AVLOXSEG4EI16V + AVLOXSEG5EI16V + AVLOXSEG6EI16V + AVLOXSEG7EI16V + AVLOXSEG8EI16V + AVLOXSEG2EI32V + AVLOXSEG3EI32V + AVLOXSEG4EI32V + AVLOXSEG5EI32V + AVLOXSEG6EI32V + AVLOXSEG7EI32V + AVLOXSEG8EI32V + AVLOXSEG2EI64V + AVLOXSEG3EI64V + AVLOXSEG4EI64V + AVLOXSEG5EI64V + AVLOXSEG6EI64V + AVLOXSEG7EI64V + AVLOXSEG8EI64V + + AVSOXSEG2EI8V + AVSOXSEG3EI8V + AVSOXSEG4EI8V + AVSOXSEG5EI8V + AVSOXSEG6EI8V + AVSOXSEG7EI8V + AVSOXSEG8EI8V + AVSOXSEG2EI16V + AVSOXSEG3EI16V + AVSOXSEG4EI16V + AVSOXSEG5EI16V + AVSOXSEG6EI16V + AVSOXSEG7EI16V + AVSOXSEG8EI16V + AVSOXSEG2EI32V + AVSOXSEG3EI32V + AVSOXSEG4EI32V + AVSOXSEG5EI32V + AVSOXSEG6EI32V + AVSOXSEG7EI32V + AVSOXSEG8EI32V + AVSOXSEG2EI64V + AVSOXSEG3EI64V + AVSOXSEG4EI64V + AVSOXSEG5EI64V + AVSOXSEG6EI64V + AVSOXSEG7EI64V + AVSOXSEG8EI64V + + AVLUXSEG2EI8V + AVLUXSEG3EI8V + AVLUXSEG4EI8V + AVLUXSEG5EI8V + AVLUXSEG6EI8V + AVLUXSEG7EI8V + AVLUXSEG8EI8V + AVLUXSEG2EI16V + AVLUXSEG3EI16V + AVLUXSEG4EI16V + AVLUXSEG5EI16V + AVLUXSEG6EI16V + AVLUXSEG7EI16V + AVLUXSEG8EI16V + AVLUXSEG2EI32V + AVLUXSEG3EI32V + AVLUXSEG4EI32V + AVLUXSEG5EI32V + AVLUXSEG6EI32V + AVLUXSEG7EI32V + AVLUXSEG8EI32V + AVLUXSEG2EI64V + AVLUXSEG3EI64V + AVLUXSEG4EI64V + AVLUXSEG5EI64V + AVLUXSEG6EI64V + AVLUXSEG7EI64V + AVLUXSEG8EI64V + + AVSUXSEG2EI8V + AVSUXSEG3EI8V + AVSUXSEG4EI8V + AVSUXSEG5EI8V + AVSUXSEG6EI8V + AVSUXSEG7EI8V + AVSUXSEG8EI8V + AVSUXSEG2EI16V + AVSUXSEG3EI16V + AVSUXSEG4EI16V + AVSUXSEG5EI16V + AVSUXSEG6EI16V + AVSUXSEG7EI16V + AVSUXSEG8EI16V + AVSUXSEG2EI32V + AVSUXSEG3EI32V + AVSUXSEG4EI32V + AVSUXSEG5EI32V + AVSUXSEG6EI32V + AVSUXSEG7EI32V + AVSUXSEG8EI32V + AVSUXSEG2EI64V + AVSUXSEG3EI64V + AVSUXSEG4EI64V + AVSUXSEG5EI64V + AVSUXSEG6EI64V + AVSUXSEG7EI64V + AVSUXSEG8EI64V + // 31.7.9: Vector Load/Store Whole Register Instructions AVL1RE8V AVL1RE16V diff --git a/src/cmd/internal/obj/riscv/inst.go b/src/cmd/internal/obj/riscv/inst.go index 16f2272b03..a6a03dc565 100644 --- a/src/cmd/internal/obj/riscv/inst.go +++ b/src/cmd/internal/obj/riscv/inst.go @@ -808,46 +808,326 @@ func encode(a obj.As) *inst { return &inst{0x7, 0x0, 0x0, 0x8, -472, 0x71} case AVLE16V: return &inst{0x7, 0x5, 0x0, 0x0, 0, 0x0} + case AVLSEG2E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 512, 0x10} + case AVLSEG3E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1024, 0x20} + case AVLSEG4E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1536, 0x30} + case AVLSEG5E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -2048, 0x40} + case AVLSEG6E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1536, 0x50} + case AVLSEG7E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1024, 0x60} + case AVLSEG8E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -512, 0x70} case AVLE16FFV: return &inst{0x7, 0x5, 0x0, 0x10, 16, 0x0} + case AVLSEG2E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, 528, 0x10} + case AVLSEG3E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, 1040, 0x20} + case AVLSEG4E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, 1552, 0x30} + case AVLSEG5E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, -2032, 0x40} + case AVLSEG6E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, -1520, 0x50} + case AVLSEG7E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, -1008, 0x60} + case AVLSEG8E16FFV: + return &inst{0x7, 0x5, 0x0, 0x10, -496, 0x70} case AVLE32V: return &inst{0x7, 0x6, 0x0, 0x0, 0, 0x0} + case AVLSEG2E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 512, 0x10} + case AVLSEG3E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1024, 0x20} + case AVLSEG4E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1536, 0x30} + case AVLSEG5E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -2048, 0x40} + case AVLSEG6E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1536, 0x50} + case AVLSEG7E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1024, 0x60} + case AVLSEG8E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -512, 0x70} case AVLE32FFV: return &inst{0x7, 0x6, 0x0, 0x10, 16, 0x0} + case AVLSEG2E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, 528, 0x10} + case AVLSEG3E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, 1040, 0x20} + case AVLSEG4E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, 1552, 0x30} + case AVLSEG5E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, -2032, 0x40} + case AVLSEG6E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, -1520, 0x50} + case AVLSEG7E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, -1008, 0x60} + case AVLSEG8E32FFV: + return &inst{0x7, 0x6, 0x0, 0x10, -496, 0x70} case AVLE64V: return &inst{0x7, 0x7, 0x0, 0x0, 0, 0x0} + case AVLSEG2E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 512, 0x10} + case AVLSEG3E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1024, 0x20} + case AVLSEG4E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1536, 0x30} + case AVLSEG5E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -2048, 0x40} + case AVLSEG6E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1536, 0x50} + case AVLSEG7E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1024, 0x60} + case AVLSEG8E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -512, 0x70} case AVLE64FFV: return &inst{0x7, 0x7, 0x0, 0x10, 16, 0x0} + case AVLSEG2E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, 528, 0x10} + case AVLSEG3E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, 1040, 0x20} + case AVLSEG4E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, 1552, 0x30} + case AVLSEG5E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, -2032, 0x40} + case AVLSEG6E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, -1520, 0x50} + case AVLSEG7E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, -1008, 0x60} + case AVLSEG8E64FFV: + return &inst{0x7, 0x7, 0x0, 0x10, -496, 0x70} case AVLE8V: return &inst{0x7, 0x0, 0x0, 0x0, 0, 0x0} + case AVLSEG2E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 512, 0x10} + case AVLSEG3E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1024, 0x20} + case AVLSEG4E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1536, 0x30} + case AVLSEG5E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -2048, 0x40} + case AVLSEG6E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1536, 0x50} + case AVLSEG7E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1024, 0x60} + case AVLSEG8E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -512, 0x70} case AVLE8FFV: return &inst{0x7, 0x0, 0x0, 0x10, 16, 0x0} + case AVLSEG2E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, 528, 0x10} + case AVLSEG3E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, 1040, 0x20} + case AVLSEG4E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, 1552, 0x30} + case AVLSEG5E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, -2032, 0x40} + case AVLSEG6E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, -1520, 0x50} + case AVLSEG7E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, -1008, 0x60} + case AVLSEG8E8FFV: + return &inst{0x7, 0x0, 0x0, 0x10, -496, 0x70} case AVLMV: return &inst{0x7, 0x0, 0x0, 0xb, 43, 0x1} case AVLOXEI16V: return &inst{0x7, 0x5, 0x0, 0x0, 192, 0x6} + case AVLOXSEG2EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 704, 0x16} + case AVLOXSEG3EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1216, 0x26} + case AVLOXSEG4EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1728, 0x36} + case AVLOXSEG5EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1856, 0x46} + case AVLOXSEG6EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1344, 0x56} + case AVLOXSEG7EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -832, 0x66} + case AVLOXSEG8EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -320, 0x76} case AVLOXEI32V: return &inst{0x7, 0x6, 0x0, 0x0, 192, 0x6} + case AVLOXSEG2EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 704, 0x16} + case AVLOXSEG3EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1216, 0x26} + case AVLOXSEG4EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1728, 0x36} + case AVLOXSEG5EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1856, 0x46} + case AVLOXSEG6EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1344, 0x56} + case AVLOXSEG7EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -832, 0x66} + case AVLOXSEG8EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -320, 0x76} case AVLOXEI64V: return &inst{0x7, 0x7, 0x0, 0x0, 192, 0x6} + case AVLOXSEG2EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 704, 0x16} + case AVLOXSEG3EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1216, 0x26} + case AVLOXSEG4EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1728, 0x36} + case AVLOXSEG5EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1856, 0x46} + case AVLOXSEG6EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1344, 0x56} + case AVLOXSEG7EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -832, 0x66} + case AVLOXSEG8EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -320, 0x76} case AVLOXEI8V: return &inst{0x7, 0x0, 0x0, 0x0, 192, 0x6} + case AVLOXSEG2EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 704, 0x16} + case AVLOXSEG3EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1216, 0x26} + case AVLOXSEG4EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1728, 0x36} + case AVLOXSEG5EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1856, 0x46} + case AVLOXSEG6EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1344, 0x56} + case AVLOXSEG7EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -832, 0x66} + case AVLOXSEG8EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -320, 0x76} case AVLSE16V: return &inst{0x7, 0x5, 0x0, 0x0, 128, 0x4} + case AVLSSEG2E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 640, 0x14} + case AVLSSEG3E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1152, 0x24} + case AVLSSEG4E16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1664, 0x34} + case AVLSSEG5E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1920, 0x44} + case AVLSSEG6E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1408, 0x54} + case AVLSSEG7E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -896, 0x64} + case AVLSSEG8E16V: + return &inst{0x7, 0x5, 0x0, 0x0, -384, 0x74} case AVLSE32V: return &inst{0x7, 0x6, 0x0, 0x0, 128, 0x4} + case AVLSSEG2E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 640, 0x14} + case AVLSSEG3E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1152, 0x24} + case AVLSSEG4E32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1664, 0x34} + case AVLSSEG5E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1920, 0x44} + case AVLSSEG6E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1408, 0x54} + case AVLSSEG7E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -896, 0x64} + case AVLSSEG8E32V: + return &inst{0x7, 0x6, 0x0, 0x0, -384, 0x74} case AVLSE64V: return &inst{0x7, 0x7, 0x0, 0x0, 128, 0x4} + case AVLSSEG2E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 640, 0x14} + case AVLSSEG3E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1152, 0x24} + case AVLSSEG4E64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1664, 0x34} + case AVLSSEG5E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1920, 0x44} + case AVLSSEG6E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1408, 0x54} + case AVLSSEG7E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -896, 0x64} + case AVLSSEG8E64V: + return &inst{0x7, 0x7, 0x0, 0x0, -384, 0x74} case AVLSE8V: return &inst{0x7, 0x0, 0x0, 0x0, 128, 0x4} + case AVLSSEG2E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 640, 0x14} + case AVLSSEG3E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1152, 0x24} + case AVLSSEG4E8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1664, 0x34} + case AVLSSEG5E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1920, 0x44} + case AVLSSEG6E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1408, 0x54} + case AVLSSEG7E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -896, 0x64} + case AVLSSEG8E8V: + return &inst{0x7, 0x0, 0x0, 0x0, -384, 0x74} case AVLUXEI16V: return &inst{0x7, 0x5, 0x0, 0x0, 64, 0x2} + case AVLUXSEG2EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 576, 0x12} + case AVLUXSEG3EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1088, 0x22} + case AVLUXSEG4EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, 1600, 0x32} + case AVLUXSEG5EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1984, 0x42} + case AVLUXSEG6EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -1472, 0x52} + case AVLUXSEG7EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -960, 0x62} + case AVLUXSEG8EI16V: + return &inst{0x7, 0x5, 0x0, 0x0, -448, 0x72} case AVLUXEI32V: return &inst{0x7, 0x6, 0x0, 0x0, 64, 0x2} + case AVLUXSEG2EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 576, 0x12} + case AVLUXSEG3EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1088, 0x22} + case AVLUXSEG4EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, 1600, 0x32} + case AVLUXSEG5EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1984, 0x42} + case AVLUXSEG6EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -1472, 0x52} + case AVLUXSEG7EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -960, 0x62} + case AVLUXSEG8EI32V: + return &inst{0x7, 0x6, 0x0, 0x0, -448, 0x72} case AVLUXEI64V: return &inst{0x7, 0x7, 0x0, 0x0, 64, 0x2} + case AVLUXSEG2EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 576, 0x12} + case AVLUXSEG3EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1088, 0x22} + case AVLUXSEG4EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, 1600, 0x32} + case AVLUXSEG5EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1984, 0x42} + case AVLUXSEG6EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -1472, 0x52} + case AVLUXSEG7EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -960, 0x62} + case AVLUXSEG8EI64V: + return &inst{0x7, 0x7, 0x0, 0x0, -448, 0x72} case AVLUXEI8V: return &inst{0x7, 0x0, 0x0, 0x0, 64, 0x2} + case AVLUXSEG2EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 576, 0x12} + case AVLUXSEG3EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1088, 0x22} + case AVLUXSEG4EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, 1600, 0x32} + case AVLUXSEG5EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1984, 0x42} + case AVLUXSEG6EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -1472, 0x52} + case AVLUXSEG7EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -960, 0x62} + case AVLUXSEG8EI8V: + return &inst{0x7, 0x0, 0x0, 0x0, -448, 0x72} case AVMACCVV: return &inst{0x57, 0x2, 0x0, 0x0, -1216, 0x5a} case AVMACCVX: @@ -1114,12 +1394,68 @@ func encode(a obj.As) *inst { return &inst{0x57, 0x4, 0x0, 0x0, 1152, 0x24} case AVSE16V: return &inst{0x27, 0x5, 0x0, 0x0, 0, 0x0} + case AVSSEG2E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 512, 0x10} + case AVSSEG3E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1024, 0x20} + case AVSSEG4E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1536, 0x30} + case AVSSEG5E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -2048, 0x40} + case AVSSEG6E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1536, 0x50} + case AVSSEG7E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1024, 0x60} + case AVSSEG8E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -512, 0x70} case AVSE32V: return &inst{0x27, 0x6, 0x0, 0x0, 0, 0x0} + case AVSSEG2E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 512, 0x10} + case AVSSEG3E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1024, 0x20} + case AVSSEG4E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1536, 0x30} + case AVSSEG5E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -2048, 0x40} + case AVSSEG6E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1536, 0x50} + case AVSSEG7E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1024, 0x60} + case AVSSEG8E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -512, 0x70} case AVSE64V: return &inst{0x27, 0x7, 0x0, 0x0, 0, 0x0} + case AVSSEG2E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 512, 0x10} + case AVSSEG3E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1024, 0x20} + case AVSSEG4E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1536, 0x30} + case AVSSEG5E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -2048, 0x40} + case AVSSEG6E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1536, 0x50} + case AVSSEG7E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1024, 0x60} + case AVSSEG8E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -512, 0x70} case AVSE8V: return &inst{0x27, 0x0, 0x0, 0x0, 0, 0x0} + case AVSSEG2E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 512, 0x10} + case AVSSEG3E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1024, 0x20} + case AVSSEG4E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1536, 0x30} + case AVSSEG5E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -2048, 0x40} + case AVSSEG6E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1536, 0x50} + case AVSSEG7E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1024, 0x60} + case AVSSEG8E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -512, 0x70} case AVSETIVLI: return &inst{0x57, 0x7, 0x0, 0x0, -1024, 0x60} case AVSETVL: @@ -1158,12 +1494,68 @@ func encode(a obj.As) *inst { return &inst{0x57, 0x4, 0x0, 0x0, -1600, 0x4e} case AVSOXEI16V: return &inst{0x27, 0x5, 0x0, 0x0, 192, 0x6} + case AVSOXSEG2EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 704, 0x16} + case AVSOXSEG3EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1216, 0x26} + case AVSOXSEG4EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1728, 0x36} + case AVSOXSEG5EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1856, 0x46} + case AVSOXSEG6EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1344, 0x56} + case AVSOXSEG7EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -832, 0x66} + case AVSOXSEG8EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -320, 0x76} case AVSOXEI32V: return &inst{0x27, 0x6, 0x0, 0x0, 192, 0x6} + case AVSOXSEG2EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 704, 0x16} + case AVSOXSEG3EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1216, 0x26} + case AVSOXSEG4EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1728, 0x36} + case AVSOXSEG5EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1856, 0x46} + case AVSOXSEG6EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1344, 0x56} + case AVSOXSEG7EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -832, 0x66} + case AVSOXSEG8EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -320, 0x76} case AVSOXEI64V: return &inst{0x27, 0x7, 0x0, 0x0, 192, 0x6} + case AVSOXSEG2EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 704, 0x16} + case AVSOXSEG3EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1216, 0x26} + case AVSOXSEG4EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1728, 0x36} + case AVSOXSEG5EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1856, 0x46} + case AVSOXSEG6EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1344, 0x56} + case AVSOXSEG7EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -832, 0x66} + case AVSOXSEG8EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -320, 0x76} case AVSOXEI8V: return &inst{0x27, 0x0, 0x0, 0x0, 192, 0x6} + case AVSOXSEG2EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 704, 0x16} + case AVSOXSEG3EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1216, 0x26} + case AVSOXSEG4EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1728, 0x36} + case AVSOXSEG5EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1856, 0x46} + case AVSOXSEG6EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1344, 0x56} + case AVSOXSEG7EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -832, 0x66} + case AVSOXSEG8EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -320, 0x76} case AVSRAVI: return &inst{0x57, 0x3, 0x0, 0x0, -1472, 0x52} case AVSRAVV: @@ -1178,12 +1570,68 @@ func encode(a obj.As) *inst { return &inst{0x57, 0x4, 0x0, 0x0, -1536, 0x50} case AVSSE16V: return &inst{0x27, 0x5, 0x0, 0x0, 128, 0x4} + case AVSSSEG2E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 640, 0x14} + case AVSSSEG3E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1152, 0x24} + case AVSSSEG4E16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1664, 0x34} + case AVSSSEG5E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1920, 0x44} + case AVSSSEG6E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1408, 0x54} + case AVSSSEG7E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -896, 0x64} + case AVSSSEG8E16V: + return &inst{0x27, 0x5, 0x0, 0x0, -384, 0x74} case AVSSE32V: return &inst{0x27, 0x6, 0x0, 0x0, 128, 0x4} + case AVSSSEG2E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 640, 0x14} + case AVSSSEG3E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1152, 0x24} + case AVSSSEG4E32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1664, 0x34} + case AVSSSEG5E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1920, 0x44} + case AVSSSEG6E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1408, 0x54} + case AVSSSEG7E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -896, 0x64} + case AVSSSEG8E32V: + return &inst{0x27, 0x6, 0x0, 0x0, -384, 0x74} case AVSSE64V: return &inst{0x27, 0x7, 0x0, 0x0, 128, 0x4} + case AVSSSEG2E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 640, 0x14} + case AVSSSEG3E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1152, 0x24} + case AVSSSEG4E64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1664, 0x34} + case AVSSSEG5E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1920, 0x44} + case AVSSSEG6E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1408, 0x54} + case AVSSSEG7E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -896, 0x64} + case AVSSSEG8E64V: + return &inst{0x27, 0x7, 0x0, 0x0, -384, 0x74} case AVSSE8V: return &inst{0x27, 0x0, 0x0, 0x0, 128, 0x4} + case AVSSSEG2E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 640, 0x14} + case AVSSSEG3E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1152, 0x24} + case AVSSSEG4E8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1664, 0x34} + case AVSSSEG5E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1920, 0x44} + case AVSSSEG6E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1408, 0x54} + case AVSSSEG7E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -896, 0x64} + case AVSSSEG8E8V: + return &inst{0x27, 0x0, 0x0, 0x0, -384, 0x74} case AVSSRAVI: return &inst{0x57, 0x3, 0x0, 0x0, -1344, 0x56} case AVSSRAVV: @@ -1210,12 +1658,68 @@ func encode(a obj.As) *inst { return &inst{0x57, 0x4, 0x0, 0x0, 128, 0x4} case AVSUXEI16V: return &inst{0x27, 0x5, 0x0, 0x0, 64, 0x2} + case AVSUXSEG2EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 576, 0x12} + case AVSUXSEG3EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1088, 0x22} + case AVSUXSEG4EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, 1600, 0x32} + case AVSUXSEG5EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1984, 0x42} + case AVSUXSEG6EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -1472, 0x52} + case AVSUXSEG7EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -960, 0x62} + case AVSUXSEG8EI16V: + return &inst{0x27, 0x5, 0x0, 0x0, -448, 0x72} case AVSUXEI32V: return &inst{0x27, 0x6, 0x0, 0x0, 64, 0x2} + case AVSUXSEG2EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 576, 0x12} + case AVSUXSEG3EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1088, 0x22} + case AVSUXSEG4EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, 1600, 0x32} + case AVSUXSEG5EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1984, 0x42} + case AVSUXSEG6EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -1472, 0x52} + case AVSUXSEG7EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -960, 0x62} + case AVSUXSEG8EI32V: + return &inst{0x27, 0x6, 0x0, 0x0, -448, 0x72} case AVSUXEI64V: return &inst{0x27, 0x7, 0x0, 0x0, 64, 0x2} + case AVSUXSEG2EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 576, 0x12} + case AVSUXSEG3EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1088, 0x22} + case AVSUXSEG4EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, 1600, 0x32} + case AVSUXSEG5EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1984, 0x42} + case AVSUXSEG6EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -1472, 0x52} + case AVSUXSEG7EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -960, 0x62} + case AVSUXSEG8EI64V: + return &inst{0x27, 0x7, 0x0, 0x0, -448, 0x72} case AVSUXEI8V: return &inst{0x27, 0x0, 0x0, 0x0, 64, 0x2} + case AVSUXSEG2EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 576, 0x12} + case AVSUXSEG3EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1088, 0x22} + case AVSUXSEG4EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, 1600, 0x32} + case AVSUXSEG5EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1984, 0x42} + case AVSUXSEG6EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -1472, 0x52} + case AVSUXSEG7EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -960, 0x62} + case AVSUXSEG8EI8V: + return &inst{0x27, 0x0, 0x0, 0x0, -448, 0x72} case AVWADDVV: return &inst{0x57, 0x2, 0x0, 0x0, -960, 0x62} case AVWADDVX: diff --git a/src/cmd/internal/obj/riscv/obj.go b/src/cmd/internal/obj/riscv/obj.go index db8d663c5a..1538d03179 100644 --- a/src/cmd/internal/obj/riscv/obj.go +++ b/src/cmd/internal/obj/riscv/obj.go @@ -2151,6 +2151,260 @@ var instructions = [ALAST & obj.AMask]instructionData{ AVSOXEI32V & obj.AMask: {enc: sVIVEncoding}, AVSOXEI64V & obj.AMask: {enc: sVIVEncoding}, + // 31.7.8: Vector Load/Store Segment Instructions + AVLSEG2E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG3E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG4E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG5E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG6E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG7E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG8E8V & obj.AMask: {enc: iVEncoding}, + AVLSEG2E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG3E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG4E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG5E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG6E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG7E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG8E16V & obj.AMask: {enc: iVEncoding}, + AVLSEG2E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG3E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG4E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG5E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG6E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG7E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG8E32V & obj.AMask: {enc: iVEncoding}, + AVLSEG2E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG3E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG4E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG5E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG6E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG7E64V & obj.AMask: {enc: iVEncoding}, + AVLSEG8E64V & obj.AMask: {enc: iVEncoding}, + AVSSEG2E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG3E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG4E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG5E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG6E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG7E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG8E8V & obj.AMask: {enc: sVEncoding}, + AVSSEG2E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG3E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG4E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG5E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG6E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG7E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG8E16V & obj.AMask: {enc: sVEncoding}, + AVSSEG2E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG3E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG4E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG5E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG6E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG7E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG8E32V & obj.AMask: {enc: sVEncoding}, + AVSSEG2E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG3E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG4E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG5E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG6E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG7E64V & obj.AMask: {enc: sVEncoding}, + AVSSEG8E64V & obj.AMask: {enc: sVEncoding}, + AVLSEG2E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG3E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG4E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG5E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG6E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG7E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG8E8FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG2E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG3E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG4E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG5E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG6E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG7E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG8E16FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG2E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG3E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG4E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG5E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG6E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG7E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG8E32FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG2E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG3E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG4E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG5E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG6E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG7E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSEG8E64FFV & obj.AMask: {enc: iVEncoding}, + AVLSSEG2E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG3E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG4E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG5E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG6E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG7E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG8E8V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG2E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG3E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG4E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG5E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG6E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG7E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG8E16V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG2E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG3E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG4E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG5E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG6E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG7E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG8E32V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG2E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG3E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG4E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG5E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG6E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG7E64V & obj.AMask: {enc: iIIVEncoding}, + AVLSSEG8E64V & obj.AMask: {enc: iIIVEncoding}, + AVSSSEG2E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG3E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG4E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG5E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG6E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG7E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG8E8V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG2E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG3E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG4E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG5E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG6E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG7E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG8E16V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG2E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG3E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG4E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG5E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG6E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG7E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG8E32V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG2E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG3E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG4E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG5E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG6E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG7E64V & obj.AMask: {enc: sVIIEncoding}, + AVSSSEG8E64V & obj.AMask: {enc: sVIIEncoding}, + AVLOXSEG2EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG3EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG4EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG5EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG6EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG7EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG8EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG2EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG3EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG4EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG5EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG6EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG7EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG8EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG2EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG3EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG4EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG5EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG6EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG7EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG8EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG2EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG3EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG4EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG5EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG6EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG7EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLOXSEG8EI64V & obj.AMask: {enc: iVIVEncoding}, + AVSOXSEG2EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG3EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG4EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG5EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG6EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG7EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG8EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG2EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG3EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG4EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG5EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG6EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG7EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG8EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG2EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG3EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG4EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG5EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG6EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG7EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG8EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG2EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG3EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG4EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG5EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG6EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG7EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSOXSEG8EI64V & obj.AMask: {enc: sVIVEncoding}, + AVLUXSEG2EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG3EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG4EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG5EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG6EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG7EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG8EI8V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG2EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG3EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG4EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG5EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG6EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG7EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG8EI16V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG2EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG3EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG4EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG5EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG6EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG7EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG8EI32V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG2EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG3EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG4EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG5EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG6EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG7EI64V & obj.AMask: {enc: iVIVEncoding}, + AVLUXSEG8EI64V & obj.AMask: {enc: iVIVEncoding}, + AVSUXSEG2EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG3EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG4EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG5EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG6EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG7EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG8EI8V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG2EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG3EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG4EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG5EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG6EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG7EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG8EI16V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG2EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG3EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG4EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG5EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG6EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG7EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG8EI32V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG2EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG3EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG4EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG5EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG6EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG7EI64V & obj.AMask: {enc: sVIVEncoding}, + AVSUXSEG8EI64V & obj.AMask: {enc: sVIVEncoding}, + // 31.7.9: Vector Load/Store Whole Register Instructions AVL1RE8V & obj.AMask: {enc: iVEncoding}, AVL1RE16V & obj.AMask: {enc: iVEncoding}, @@ -3539,7 +3793,19 @@ func instructionsForProg(p *obj.Prog) []*instruction { ins.rs1 = uint32(p.From.Offset) } - case AVLE8V, AVLE16V, AVLE32V, AVLE64V, AVSE8V, AVSE16V, AVSE32V, AVSE64V, AVLMV, AVSMV: + case AVLE8V, AVLE16V, AVLE32V, AVLE64V, AVSE8V, AVSE16V, AVSE32V, AVSE64V, AVLMV, AVSMV, + AVLSEG2E8V, AVLSEG3E8V, AVLSEG4E8V, AVLSEG5E8V, AVLSEG6E8V, AVLSEG7E8V, AVLSEG8E8V, + AVLSEG2E16V, AVLSEG3E16V, AVLSEG4E16V, AVLSEG5E16V, AVLSEG6E16V, AVLSEG7E16V, AVLSEG8E16V, + AVLSEG2E32V, AVLSEG3E32V, AVLSEG4E32V, AVLSEG5E32V, AVLSEG6E32V, AVLSEG7E32V, AVLSEG8E32V, + AVLSEG2E64V, AVLSEG3E64V, AVLSEG4E64V, AVLSEG5E64V, AVLSEG6E64V, AVLSEG7E64V, AVLSEG8E64V, + AVSSEG2E8V, AVSSEG3E8V, AVSSEG4E8V, AVSSEG5E8V, AVSSEG6E8V, AVSSEG7E8V, AVSSEG8E8V, + AVSSEG2E16V, AVSSEG3E16V, AVSSEG4E16V, AVSSEG5E16V, AVSSEG6E16V, AVSSEG7E16V, AVSSEG8E16V, + AVSSEG2E32V, AVSSEG3E32V, AVSSEG4E32V, AVSSEG5E32V, AVSSEG6E32V, AVSSEG7E32V, AVSSEG8E32V, + AVSSEG2E64V, AVSSEG3E64V, AVSSEG4E64V, AVSSEG5E64V, AVSSEG6E64V, AVSSEG7E64V, AVSSEG8E64V, + AVLSEG2E8FFV, AVLSEG3E8FFV, AVLSEG4E8FFV, AVLSEG5E8FFV, AVLSEG6E8FFV, AVLSEG7E8FFV, AVLSEG8E8FFV, + AVLSEG2E16FFV, AVLSEG3E16FFV, AVLSEG4E16FFV, AVLSEG5E16FFV, AVLSEG6E16FFV, AVLSEG7E16FFV, AVLSEG8E16FFV, + AVLSEG2E32FFV, AVLSEG3E32FFV, AVLSEG4E32FFV, AVLSEG5E32FFV, AVLSEG6E32FFV, AVLSEG7E32FFV, AVLSEG8E32FFV, + AVLSEG2E64FFV, AVLSEG3E64FFV, AVLSEG4E64FFV, AVLSEG5E64FFV, AVLSEG6E64FFV, AVLSEG7E64FFV, AVLSEG8E64FFV: // Set mask bit switch { case ins.rs1 == obj.REG_NONE: @@ -3550,7 +3816,19 @@ func instructionsForProg(p *obj.Prog) []*instruction { ins.rd, ins.rs1, ins.rs2 = uint32(p.To.Reg), uint32(p.From.Reg), obj.REG_NONE case AVLSE8V, AVLSE16V, AVLSE32V, AVLSE64V, - AVLUXEI8V, AVLUXEI16V, AVLUXEI32V, AVLUXEI64V, AVLOXEI8V, AVLOXEI16V, AVLOXEI32V, AVLOXEI64V: + AVLUXEI8V, AVLUXEI16V, AVLUXEI32V, AVLUXEI64V, AVLOXEI8V, AVLOXEI16V, AVLOXEI32V, AVLOXEI64V, + AVLSSEG2E8V, AVLSSEG3E8V, AVLSSEG4E8V, AVLSSEG5E8V, AVLSSEG6E8V, AVLSSEG7E8V, AVLSSEG8E8V, + AVLSSEG2E16V, AVLSSEG3E16V, AVLSSEG4E16V, AVLSSEG5E16V, AVLSSEG6E16V, AVLSSEG7E16V, AVLSSEG8E16V, + AVLSSEG2E32V, AVLSSEG3E32V, AVLSSEG4E32V, AVLSSEG5E32V, AVLSSEG6E32V, AVLSSEG7E32V, AVLSSEG8E32V, + AVLSSEG2E64V, AVLSSEG3E64V, AVLSSEG4E64V, AVLSSEG5E64V, AVLSSEG6E64V, AVLSSEG7E64V, AVLSSEG8E64V, + AVLOXSEG2EI8V, AVLOXSEG3EI8V, AVLOXSEG4EI8V, AVLOXSEG5EI8V, AVLOXSEG6EI8V, AVLOXSEG7EI8V, AVLOXSEG8EI8V, + AVLOXSEG2EI16V, AVLOXSEG3EI16V, AVLOXSEG4EI16V, AVLOXSEG5EI16V, AVLOXSEG6EI16V, AVLOXSEG7EI16V, AVLOXSEG8EI16V, + AVLOXSEG2EI32V, AVLOXSEG3EI32V, AVLOXSEG4EI32V, AVLOXSEG5EI32V, AVLOXSEG6EI32V, AVLOXSEG7EI32V, AVLOXSEG8EI32V, + AVLOXSEG2EI64V, AVLOXSEG3EI64V, AVLOXSEG4EI64V, AVLOXSEG5EI64V, AVLOXSEG6EI64V, AVLOXSEG7EI64V, AVLOXSEG8EI64V, + AVLUXSEG2EI8V, AVLUXSEG3EI8V, AVLUXSEG4EI8V, AVLUXSEG5EI8V, AVLUXSEG6EI8V, AVLUXSEG7EI8V, AVLUXSEG8EI8V, + AVLUXSEG2EI16V, AVLUXSEG3EI16V, AVLUXSEG4EI16V, AVLUXSEG5EI16V, AVLUXSEG6EI16V, AVLUXSEG7EI16V, AVLUXSEG8EI16V, + AVLUXSEG2EI32V, AVLUXSEG3EI32V, AVLUXSEG4EI32V, AVLUXSEG5EI32V, AVLUXSEG6EI32V, AVLUXSEG7EI32V, AVLUXSEG8EI32V, + AVLUXSEG2EI64V, AVLUXSEG3EI64V, AVLUXSEG4EI64V, AVLUXSEG5EI64V, AVLUXSEG6EI64V, AVLUXSEG7EI64V, AVLUXSEG8EI64V: // Set mask bit switch { case ins.rs3 == obj.REG_NONE: @@ -3561,7 +3839,19 @@ func instructionsForProg(p *obj.Prog) []*instruction { ins.rs1, ins.rs2, ins.rs3 = ins.rs2, ins.rs1, obj.REG_NONE case AVSSE8V, AVSSE16V, AVSSE32V, AVSSE64V, - AVSUXEI8V, AVSUXEI16V, AVSUXEI32V, AVSUXEI64V, AVSOXEI8V, AVSOXEI16V, AVSOXEI32V, AVSOXEI64V: + AVSUXEI8V, AVSUXEI16V, AVSUXEI32V, AVSUXEI64V, AVSOXEI8V, AVSOXEI16V, AVSOXEI32V, AVSOXEI64V, + AVSSSEG2E8V, AVSSSEG3E8V, AVSSSEG4E8V, AVSSSEG5E8V, AVSSSEG6E8V, AVSSSEG7E8V, AVSSSEG8E8V, + AVSSSEG2E16V, AVSSSEG3E16V, AVSSSEG4E16V, AVSSSEG5E16V, AVSSSEG6E16V, AVSSSEG7E16V, AVSSSEG8E16V, + AVSSSEG2E32V, AVSSSEG3E32V, AVSSSEG4E32V, AVSSSEG5E32V, AVSSSEG6E32V, AVSSSEG7E32V, AVSSSEG8E32V, + AVSSSEG2E64V, AVSSSEG3E64V, AVSSSEG4E64V, AVSSSEG5E64V, AVSSSEG6E64V, AVSSSEG7E64V, AVSSSEG8E64V, + AVSOXSEG2EI8V, AVSOXSEG3EI8V, AVSOXSEG4EI8V, AVSOXSEG5EI8V, AVSOXSEG6EI8V, AVSOXSEG7EI8V, AVSOXSEG8EI8V, + AVSOXSEG2EI16V, AVSOXSEG3EI16V, AVSOXSEG4EI16V, AVSOXSEG5EI16V, AVSOXSEG6EI16V, AVSOXSEG7EI16V, AVSOXSEG8EI16V, + AVSOXSEG2EI32V, AVSOXSEG3EI32V, AVSOXSEG4EI32V, AVSOXSEG5EI32V, AVSOXSEG6EI32V, AVSOXSEG7EI32V, AVSOXSEG8EI32V, + AVSOXSEG2EI64V, AVSOXSEG3EI64V, AVSOXSEG4EI64V, AVSOXSEG5EI64V, AVSOXSEG6EI64V, AVSOXSEG7EI64V, AVSOXSEG8EI64V, + AVSUXSEG2EI8V, AVSUXSEG3EI8V, AVSUXSEG4EI8V, AVSUXSEG5EI8V, AVSUXSEG6EI8V, AVSUXSEG7EI8V, AVSUXSEG8EI8V, + AVSUXSEG2EI16V, AVSUXSEG3EI16V, AVSUXSEG4EI16V, AVSUXSEG5EI16V, AVSUXSEG6EI16V, AVSUXSEG7EI16V, AVSUXSEG8EI16V, + AVSUXSEG2EI32V, AVSUXSEG3EI32V, AVSUXSEG4EI32V, AVSUXSEG5EI32V, AVSUXSEG6EI32V, AVSUXSEG7EI32V, AVSUXSEG8EI32V, + AVSUXSEG2EI64V, AVSUXSEG3EI64V, AVSUXSEG4EI64V, AVSUXSEG5EI64V, AVSUXSEG6EI64V, AVSUXSEG7EI64V, AVSUXSEG8EI64V: // Set mask bit switch { case ins.rs3 == obj.REG_NONE: -- cgit v1.3-5-g45d5 From eb7c67fdc9e17959647a15db9e7781b9d447061a Mon Sep 17 00:00:00 2001 From: Xiaolin Zhao Date: Thu, 11 Sep 2025 16:30:38 +0800 Subject: cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MOVVP instruction has a larger offset range, and removes 928 instructions from the go binary on loong64. file before after Δ go 1634208 1634064 -144 gofmt 323324 323240 -84 asm 567870 567778 -92 cgo 487694 487598 -96 compile 2500266 2500142 -124 cover 530590 530498 -92 link 723804 723692 -112 preprofile 240562 240474 -88 vet 819672 819576 -96 Change-Id: Ib0efcb006d3ae3f2bceec0d6e88f3794d5e99831 Reviewed-on: https://go-review.googlesource.com/c/go/+/702715 Reviewed-by: abner chenc Reviewed-by: Mark Freeman Reviewed-by: Meidan Li Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- src/cmd/internal/obj/loong64/obj.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/internal/obj/loong64/obj.go b/src/cmd/internal/obj/loong64/obj.go index a97217d316..ea110f00cb 100644 --- a/src/cmd/internal/obj/loong64/obj.go +++ b/src/cmd/internal/obj/loong64/obj.go @@ -324,7 +324,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { q = c.ctxt.StartUnsafePoint(q, c.newprog) q = obj.Appendp(q, newprog) - q.As = mov + q.As = AMOVVP q.Pos = p.Pos q.From.Type = obj.TYPE_REG q.From.Reg = REGLINK -- cgit v1.3-5-g45d5 From 17a0fabc43342963c3e604ab66f9a6b970a5cb05 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 15 Sep 2025 14:51:40 +0200 Subject: cmd/link: remove support for darwin/386 relocations The darwin/386 port has been unsupported for years, but some relocation handling specific to it has managed to survive till now. Updates #37610 Change-Id: I27ae2ac5462c5f3ec219e9cb5dce6f83b037b816 Reviewed-on: https://go-review.googlesource.com/c/go/+/703777 Reviewed-by: Michael Knyszek Reviewed-by: Than McIntosh Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- src/cmd/link/internal/x86/asm.go | 45 ---------------------------------------- 1 file changed, 45 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/link/internal/x86/asm.go b/src/cmd/link/internal/x86/asm.go index d535e5fb4d..036514819a 100644 --- a/src/cmd/link/internal/x86/asm.go +++ b/src/cmd/link/internal/x86/asm.go @@ -224,51 +224,6 @@ func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loade su := ldr.MakeSymbolUpdater(s) su.SetRelocType(rIdx, objabi.R_ADDR) return true - - case objabi.MachoRelocOffset + ld.MACHO_GENERIC_RELOC_VANILLA*2 + 0: - su := ldr.MakeSymbolUpdater(s) - su.SetRelocType(rIdx, objabi.R_ADDR) - if targType == sym.SDYNIMPORT { - ldr.Errorf(s, "unexpected reloc for dynamic symbol %s", ldr.SymName(targ)) - } - return true - - case objabi.MachoRelocOffset + ld.MACHO_GENERIC_RELOC_VANILLA*2 + 1: - su := ldr.MakeSymbolUpdater(s) - if targType == sym.SDYNIMPORT { - addpltsym(target, ldr, syms, targ) - su.SetRelocSym(rIdx, syms.PLT) - su.SetRelocAdd(rIdx, int64(ldr.SymPlt(targ))) - su.SetRelocType(rIdx, objabi.R_PCREL) - return true - } - - su.SetRelocType(rIdx, objabi.R_PCREL) - return true - - case objabi.MachoRelocOffset + ld.MACHO_FAKE_GOTPCREL: - su := ldr.MakeSymbolUpdater(s) - if targType != sym.SDYNIMPORT { - // have symbol - // turn MOVL of GOT entry into LEAL of symbol itself - sData := ldr.Data(s) - if r.Off() < 2 || sData[r.Off()-2] != 0x8b { - ldr.Errorf(s, "unexpected GOT reloc for non-dynamic symbol %s", ldr.SymName(targ)) - return false - } - - su.MakeWritable() - writeableData := su.Data() - writeableData[r.Off()-2] = 0x8d - su.SetRelocType(rIdx, objabi.R_PCREL) - return true - } - - ld.AddGotSym(target, ldr, syms, targ, uint32(elf.R_386_GLOB_DAT)) - su.SetRelocSym(rIdx, syms.GOT) - su.SetRelocAdd(rIdx, r.Add()+int64(ldr.SymGot(targ))) - su.SetRelocType(rIdx, objabi.R_PCREL) - return true } // Handle references to ELF symbols from our own object files. -- cgit v1.3-5-g45d5 From ca0e03560df7279bc307da08db7237beb32b0d99 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 15 Sep 2025 14:59:12 +0200 Subject: cmd/link: remove support for windows/arm relocations The windows/arm port is no longer supported. We can remove the related code from cmd/link/internal/arm. For #71671 Change-Id: I00de1231482cc2f28ec5fc9dc62e81f0ba3fe481 Reviewed-on: https://go-review.googlesource.com/c/go/+/703778 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh Reviewed-by: Michael Knyszek --- src/cmd/link/internal/arm/asm.go | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go index ab816c7015..a113196d10 100644 --- a/src/cmd/link/internal/arm/asm.go +++ b/src/cmd/link/internal/arm/asm.go @@ -334,36 +334,7 @@ func machoreloc1(*sys.Arch, *ld.OutBuf, *loader.Loader, loader.Sym, loader.ExtRe } func pereloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, sectoff int64) bool { - rs := r.Xsym - rt := r.Type - - if ldr.SymDynid(rs) < 0 { - ldr.Errorf(s, "reloc %d (%s) to non-coff symbol %s type=%d (%s)", rt, sym.RelocName(arch, rt), ldr.SymName(rs), ldr.SymType(rs), ldr.SymType(rs)) - return false - } - - out.Write32(uint32(sectoff)) - out.Write32(uint32(ldr.SymDynid(rs))) - - var v uint32 - switch rt { - default: - // unsupported relocation type - return false - - case objabi.R_DWARFSECREF: - v = ld.IMAGE_REL_ARM_SECREL - - case objabi.R_ADDR: - v = ld.IMAGE_REL_ARM_ADDR32 - - case objabi.R_PEIMAGEOFF: - v = ld.IMAGE_REL_ARM_ADDR32NB - } - - out.Write16(uint16(v)) - - return true + return false } // sign extend a 24-bit integer. -- cgit v1.3-5-g45d5