// GOOS is the running program's operating system target:
// one of darwin, freebsd, linux, and so on.
-const GOOS string = sys.TheGoos
+const GOOS string = sys.GOOS
// GOARCH is the running program's architecture target:
// 386, amd64, arm, or s390x.
-const GOARCH string = sys.TheGoarch
+const GOARCH string = sys.GOARCH
dumpint(sys.PtrSize)
dumpint(uint64(mheap_.arena_start))
dumpint(uint64(mheap_.arena_used))
- dumpint(sys.TheChar)
+ dumpstr(sys.GOARCH)
dumpstr(sys.Goexperiment)
dumpint(uint64(ncpu))
}
--- /dev/null
+// Copyright 2014 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 sys
+
+type ArchFamilyType int
+
+const (
+ AMD64 ArchFamilyType = iota
+ ARM
+ ARM64
+ I386
+ MIPS64
+ PPC64
+ S390X
+)
package sys
const (
- TheChar = '8'
+ ArchFamily = I386
BigEndian = 0
CacheLineSize = 64
PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl
package sys
const (
- TheChar = '6'
+ ArchFamily = AMD64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 4096
package sys
const (
- TheChar = '6'
+ ArchFamily = AMD64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
package sys
const (
- TheChar = '5'
+ ArchFamily = ARM
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
package sys
const (
- TheChar = '7'
+ ArchFamily = ARM64
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 65536
package sys
const (
- TheChar = '0'
+ ArchFamily = MIPS64
BigEndian = 1
CacheLineSize = 32
PhysPageSize = 16384
package sys
const (
- TheChar = '0'
+ ArchFamily = MIPS64
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 16384
package sys
const (
- TheChar = '9'
+ ArchFamily = PPC64
BigEndian = 1
CacheLineSize = 64
PhysPageSize = 65536
package sys
const (
- TheChar = '9'
+ ArchFamily = PPC64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 65536
package sys
const (
- TheChar = 'z'
+ ArchFamily = S390X
BigEndian = 1
CacheLineSize = 256
PhysPageSize = 4096
fmt.Fprintf(&buf, "// +build !android\n\n") // must explicitly exclude android for linux
}
fmt.Fprintf(&buf, "package sys\n\n")
- fmt.Fprintf(&buf, "const TheGoos = `%s`\n\n", target)
+ fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
for _, goos := range gooses {
value := 0
if goos == target {
var buf bytes.Buffer
fmt.Fprintf(&buf, "// generated by gengoos.go using 'go generate'\n\n")
fmt.Fprintf(&buf, "package sys\n\n")
- fmt.Fprintf(&buf, "const TheGoarch = `%s`\n\n", target)
+ fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target)
for _, goarch := range goarches {
value := 0
if goarch == target {
package sys
-const TheGoarch = `386`
+const GOARCH = `386`
const Goarch386 = 1
const GoarchAmd64 = 0
package sys
-const TheGoarch = `amd64`
+const GOARCH = `amd64`
const Goarch386 = 0
const GoarchAmd64 = 1
package sys
-const TheGoarch = `amd64p32`
+const GOARCH = `amd64p32`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `arm`
+const GOARCH = `arm`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `arm64`
+const GOARCH = `arm64`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `mips64`
+const GOARCH = `mips64`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `mips64le`
+const GOARCH = `mips64le`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `ppc64`
+const GOARCH = `ppc64`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `ppc64le`
+const GOARCH = `ppc64le`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoarch = `s390x`
+const GOARCH = `s390x`
const Goarch386 = 0
const GoarchAmd64 = 0
package sys
-const TheGoos = `android`
+const GOOS = `android`
const GoosAndroid = 1
const GoosDarwin = 0
package sys
-const TheGoos = `darwin`
+const GOOS = `darwin`
const GoosAndroid = 0
const GoosDarwin = 1
package sys
-const TheGoos = `dragonfly`
+const GOOS = `dragonfly`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `freebsd`
+const GOOS = `freebsd`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `linux`
+const GOOS = `linux`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `nacl`
+const GOOS = `nacl`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `netbsd`
+const GOOS = `netbsd`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `openbsd`
+const GOOS = `openbsd`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `plan9`
+const GOOS = `plan9`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `solaris`
+const GOOS = `solaris`
const GoosAndroid = 0
const GoosDarwin = 0
package sys
-const TheGoos = `windows`
+const GOOS = `windows`
const GoosAndroid = 0
const GoosDarwin = 0
// Scan local variables if stack frame has been allocated.
size := frame.varp - frame.sp
var minsize uintptr
- switch sys.TheChar {
- case '7':
+ switch sys.ArchFamily {
+ case sys.ARM64:
minsize = sys.SpAlign
default:
minsize = sys.MinFrameSize
// Adjust local variables if stack frame has been allocated.
size := frame.varp - frame.sp
var minsize uintptr
- switch sys.TheChar {
- case '7':
+ switch sys.ArchFamily {
+ case sys.ARM64:
minsize = sys.SpAlign
default:
minsize = sys.MinFrameSize
}
// Adjust saved base pointer if there is one.
- if sys.TheChar == '6' && frame.argp-frame.varp == 2*sys.RegSize {
+ if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.RegSize {
if !framepointer_enabled {
print("runtime: found space for saved base pointer, but no framepointer experiment\n")
print("argp=", hex(frame.argp), " varp=", hex(frame.varp), "\n")
throw("missing stack in newstack")
}
sp := gp.sched.sp
- if sys.TheChar == '6' || sys.TheChar == '8' {
+ if sys.ArchFamily == sys.AMD64 || sys.ArchFamily == sys.I386 {
// The call to morestack cost a word.
sp -= sys.PtrSize
}