Skip to content

Commit 8774420

Browse files
committed
remove unused code and update syscall code bindings
1 parent 56a6bba commit 8774420

File tree

3 files changed

+488
-516
lines changed

3 files changed

+488
-516
lines changed

windows/mkwinsyscall/mkwinsyscall.go

+5-33
Original file line numberDiff line numberDiff line change
@@ -542,37 +542,6 @@ func (f *Fn) ParamPrintList() string {
542542
return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `)
543543
}
544544

545-
// ParamCount return number of syscall parameters for function f.
546-
func (f *Fn) ParamCount() int {
547-
n := 0
548-
for _, p := range f.Params {
549-
n += len(p.SyscallArgList())
550-
}
551-
return n
552-
}
553-
554-
// SyscallParamCount determines which version of Syscall/Syscall6/Syscall9/...
555-
// to use. It returns parameter count for correspondent SyscallX function.
556-
func (f *Fn) SyscallParamCount() int {
557-
n := f.ParamCount()
558-
switch {
559-
case n <= 3:
560-
return 3
561-
case n <= 6:
562-
return 6
563-
case n <= 9:
564-
return 9
565-
case n <= 12:
566-
return 12
567-
case n <= 15:
568-
return 15
569-
case n <= 42: // current SyscallN limit
570-
return n
571-
default:
572-
panic("too many arguments to system call")
573-
}
574-
}
575-
576545
// Syscall determines which SyscallX function to use for function f.
577546
func (f *Fn) Syscall() string {
578547
return syscalldot() + "SyscallN"
@@ -584,9 +553,12 @@ func (f *Fn) SyscallParamList() string {
584553
for _, p := range f.Params {
585554
a = append(a, p.SyscallArgList()...)
586555
}
587-
for len(a) < f.SyscallParamCount() {
588-
a = append(a, "0")
556+
557+
// Check if the number exceeds the current SyscallN limit
558+
if len(a) > 42 {
559+
panic("too many arguments to system call")
589560
}
561+
590562
return strings.Join(a, ", ")
591563
}
592564

windows/registry/zsyscall_windows.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)