From 96bd0b1d4c34bf22d8fa6d4710cae334b842f37d Mon Sep 17 00:00:00 2001 From: Martin Möhrmann Date: Wed, 28 Oct 2020 22:43:59 +0100 Subject: runtime: move ppc64/aix cpu feature detection to internal/cpu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Additionally removed unused PPC64.IsPOWER8 CPU feature detection. Change-Id: I1411b03d396a72e08d6d51f8a1d1bad49eaa720e Reviewed-on: https://go-review.googlesource.com/c/go/+/266077 Trust: Martin Möhrmann Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Tobias Klauser --- src/runtime/os2_aix.go | 5 +++-- src/runtime/os_aix.go | 21 --------------------- 2 files changed, 3 insertions(+), 23 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os2_aix.go b/src/runtime/os2_aix.go index 31ac6ddf79..428ff7f225 100644 --- a/src/runtime/os2_aix.go +++ b/src/runtime/os2_aix.go @@ -518,9 +518,10 @@ func sigaltstack(new, old *stackt) { } //go:nosplit -func getsystemcfg(label uint) uintptr { +//go:linkname internal_cpu_getsystemcfg internal/cpu.getsystemcfg +func internal_cpu_getsystemcfg(label uint) uint { r, _ := syscall1(&libc_getsystemcfg, uintptr(label)) - return r + return uint(r) } func usleep1(us uint32) diff --git a/src/runtime/os_aix.go b/src/runtime/os_aix.go index 9a6b8aec7c..0c501be96a 100644 --- a/src/runtime/os_aix.go +++ b/src/runtime/os_aix.go @@ -7,7 +7,6 @@ package runtime import ( - "internal/cpu" "unsafe" ) @@ -94,7 +93,6 @@ func semawakeup(mp *m) { func osinit() { ncpu = int32(sysconf(__SC_NPROCESSORS_ONLN)) physPageSize = sysconf(__SC_PAGE_SIZE) - setupSystemConf() } // newosproc0 is a version of newosproc that can be called before the runtime @@ -340,25 +338,6 @@ func walltime1() (sec int64, nsec int32) { return ts.tv_sec, int32(ts.tv_nsec) } -const ( - // getsystemcfg constants - _SC_IMPL = 2 - _IMPL_POWER8 = 0x10000 - _IMPL_POWER9 = 0x20000 -) - -// setupSystemConf retrieves information about the CPU and updates -// cpu.HWCap variables. -func setupSystemConf() { - impl := getsystemcfg(_SC_IMPL) - if impl&_IMPL_POWER8 != 0 { - cpu.HWCap2 |= cpu.PPC_FEATURE2_ARCH_2_07 - } - if impl&_IMPL_POWER9 != 0 { - cpu.HWCap2 |= cpu.PPC_FEATURE2_ARCH_3_00 - } -} - //go:nosplit func fcntl(fd, cmd, arg int32) int32 { r, _ := syscall3(&libc_fcntl, uintptr(fd), uintptr(cmd), uintptr(arg)) -- cgit v1.3-6-g1900