summaryrefslogtreecommitdiff
path: root/src/pkg/syscall
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2010-03-19 15:17:18 -0700
committerAlex Brainman <alex.brainman@gmail.com>2010-03-19 15:17:18 -0700
commitdb1a98562d847585493114ed45d706e495e4b845 (patch)
tree2ef1362489a468725350fd0e98acd6db2f6c6679 /src/pkg/syscall
parent4e5a8e703d13488509e56f7dd9a89b78c7861cff (diff)
downloadgolang-db1a98562d847585493114ed45d706e495e4b845.tar.gz
syscall: mksyscall_mingw.sh emitting shorter calls (to Syscall or Syscall6) when there are fewer arguments
R=rsc CC=golang-dev http://codereview.appspot.com/622041 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/syscall')
-rwxr-xr-xsrc/pkg/syscall/mksyscall_mingw.sh16
-rw-r--r--src/pkg/syscall/zsyscall_mingw_386.go10
2 files changed, 18 insertions, 8 deletions
diff --git a/src/pkg/syscall/mksyscall_mingw.sh b/src/pkg/syscall/mksyscall_mingw.sh
index 4913b3655..52fb1c3bb 100755
--- a/src/pkg/syscall/mksyscall_mingw.sh
+++ b/src/pkg/syscall/mksyscall_mingw.sh
@@ -109,7 +109,7 @@ while(<>) {
# Go function header.
$text .= sprintf "func %s(%s) (%s) {\n", $func, join(', ', @in), join(', ', @out);
- # Prepare arguments to Syscall9.
+ # Prepare arguments to Syscall.
my @args = ();
my $n = 0;
foreach my $p (@in) {
@@ -138,8 +138,18 @@ while(<>) {
}
# Determine which form to use; pad args with zeros.
- my $asm = "Syscall9";
- if(@args <= 9) {
+ my $asm = "Syscall";
+ if(@args <= 3) {
+ while(@args < 3) {
+ push @args, "0";
+ }
+ } elsif(@args <= 6) {
+ $asm = "Syscall6";
+ while(@args < 6) {
+ push @args, "0";
+ }
+ } elsif(@args <= 9) {
+ $asm = "Syscall9";
while(@args < 9) {
push @args, "0";
}
diff --git a/src/pkg/syscall/zsyscall_mingw_386.go b/src/pkg/syscall/zsyscall_mingw_386.go
index c2bc912ac..4c16ac5d6 100644
--- a/src/pkg/syscall/zsyscall_mingw_386.go
+++ b/src/pkg/syscall/zsyscall_mingw_386.go
@@ -16,13 +16,13 @@ var (
)
func GetLastError() (lasterrno int) {
- r0, _, _ := Syscall9(procGetLastError, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ r0, _, _ := Syscall(procGetLastError, 0, 0, 0)
lasterrno = int(r0)
return
}
func LoadLibrary(libname string) (handle uint32, errno int) {
- r0, _, e1 := Syscall9(procLoadLibraryW, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0, 0, 0, 0, 0, 0, 0)
+ r0, _, e1 := Syscall(procLoadLibraryW, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0)
handle = uint32(r0)
if uint32(r0) == 0 {
errno = int(e1)
@@ -33,7 +33,7 @@ func LoadLibrary(libname string) (handle uint32, errno int) {
}
func FreeLibrary(handle uint32) (ok bool, errno int) {
- r0, _, e1 := Syscall9(procFreeLibrary, uintptr(handle), 0, 0, 0, 0, 0, 0, 0, 0)
+ r0, _, e1 := Syscall(procFreeLibrary, uintptr(handle), 0, 0)
ok = bool(r0 != 0)
if uint32(r0) == 0 {
errno = int(e1)
@@ -44,7 +44,7 @@ func FreeLibrary(handle uint32) (ok bool, errno int) {
}
func GetProcAddress(module uint32, procname string) (proc uint32, errno int) {
- r0, _, e1 := Syscall9(procGetProcAddress, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0, 0, 0, 0, 0, 0, 0)
+ r0, _, e1 := Syscall(procGetProcAddress, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0)
proc = uint32(r0)
if uint32(r0) == 0 {
errno = int(e1)
@@ -55,7 +55,7 @@ func GetProcAddress(module uint32, procname string) (proc uint32, errno int) {
}
func GetVersion() (ver uint32, errno int) {
- r0, _, e1 := Syscall9(procGetVersion, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ r0, _, e1 := Syscall(procGetVersion, 0, 0, 0)
ver = uint32(r0)
if uint32(r0) == 0 {
errno = int(e1)