mirror of
https://github.com/golang/go
synced 2024-11-08 13:36:14 -07:00
1b548dc5fb
This belongs to a series of clean-up changes (see below) for cmd/dist. This is change (9). These changes include: (1) apply minor fixes (2) restore behavior of branchtag (3) unleash bootstrap optimization for windows (4) use standard generated code header (5) remove trivial variables + functions (6) move functions for the better (7) simplify code segments (8) use bytes.Buffer for code generation (9) rename variables + functions Change-Id: I9247433d7d07a2c99d15b0a4d23164bcbc042768 Reviewed-on: https://go-review.googlesource.com/61015 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
// 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.
|
|
|
|
package main
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
var (
|
|
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
|
procGetSystemInfo = modkernel32.NewProc("GetSystemInfo")
|
|
)
|
|
|
|
// see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
|
|
type systeminfo struct {
|
|
wProcessorArchitecture uint16
|
|
wReserved uint16
|
|
dwPageSize uint32
|
|
lpMinimumApplicationAddress uintptr
|
|
lpMaximumApplicationAddress uintptr
|
|
dwActiveProcessorMask uintptr
|
|
dwNumberOfProcessors uint32
|
|
dwProcessorType uint32
|
|
dwAllocationGranularity uint32
|
|
wProcessorLevel uint16
|
|
wProcessorRevision uint16
|
|
}
|
|
|
|
const (
|
|
PROCESSOR_ARCHITECTURE_AMD64 = 9
|
|
PROCESSOR_ARCHITECTURE_INTEL = 0
|
|
)
|
|
|
|
var sysinfo systeminfo
|
|
|
|
func sysinit() {
|
|
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
|
|
switch sysinfo.wProcessorArchitecture {
|
|
case PROCESSOR_ARCHITECTURE_AMD64:
|
|
gohostarch = "amd64"
|
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
|
gohostarch = "386"
|
|
default:
|
|
fatalf("unknown processor architecture")
|
|
}
|
|
}
|