Commit 43704759 authored by Jordan Rhee's avatar Jordan Rhee Committed by Brad Fitzpatrick

syscall: support windows/arm

Updates #26148

Change-Id: I008502232642237270b7c8a2efb4a378345d06fd
Reviewed-on: https://go-review.googlesource.com/128716
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 33960341
......@@ -9,6 +9,7 @@ package syscall
import (
errorspkg "errors"
"internal/race"
"runtime"
"sync"
"unicode/utf16"
"unsafe"
......@@ -340,12 +341,19 @@ const ptrSize = unsafe.Sizeof(uintptr(0))
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365542(v=vs.85).aspx
func setFilePointerEx(handle Handle, distToMove int64, newFilePointer *int64, whence uint32) error {
var e1 Errno
if ptrSize == 8 {
switch runtime.GOARCH {
default:
panic("unsupported architecture")
case "amd64":
_, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 4, uintptr(handle), uintptr(distToMove), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0, 0)
} else {
case "386":
// distToMove is a LARGE_INTEGER:
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx
_, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 5, uintptr(handle), uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0)
case "arm":
// distToMove must be 8-byte aligned per ARM calling convention
// https://msdn.microsoft.com/en-us/library/dn736986.aspx#Anchor_7
_, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 6, uintptr(handle), 0, uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence))
}
if e1 != 0 {
return errnoErr(e1)
......
// Copyright 2018 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 syscall
type WSAData struct {
Version uint16
HighVersion uint16
Description [WSADESCRIPTION_LEN + 1]byte
SystemStatus [WSASYS_STATUS_LEN + 1]byte
MaxSockets uint16
MaxUdpDg uint16
VendorInfo *byte
}
type Servent struct {
Name *byte
Aliases **byte
Port uint16
Proto *byte
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment