Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/cmd/5l/obj.c b/src/cmd/5l/obj.c
index c6f60ee..3ad636c 100644
--- a/src/cmd/5l/obj.c
+++ b/src/cmd/5l/obj.c
@@ -82,7 +82,6 @@ archinit(void)
break;
case Hlinux: /* arm elf */
case Hfreebsd:
- case Hnetbsd:
debug['d'] = 0; // with dynamic linking
elfinit();
HEADR = ELFRESERVE;
@@ -93,6 +92,17 @@ archinit(void)
if(INITRND == -1)
INITRND = 4096;
break;
+ case Hnetbsd:
+ debug['d'] = 0; // with dynamic linking
+ elfinit();
+ HEADR = ELFRESERVE;
+ if(INITTEXT == -1)
+ INITTEXT = 0x10000 + HEADR;
+ if(INITDAT == -1)
+ INITDAT = 0;
+ if(INITRND == -1)
+ INITRND = 0x10000;
+ break;
case Hnacl:
elfinit();
HEADR = 0x10000;
diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c
index 3b8e8f4..959d6a2 100644
--- a/src/cmd/6l/obj.c
+++ b/src/cmd/6l/obj.c
@@ -114,7 +114,6 @@ archinit(void)
break;
case Hlinux: /* elf64 executable */
case Hfreebsd: /* freebsd */
- case Hnetbsd: /* netbsd */
case Hopenbsd: /* openbsd */
case Hdragonfly: /* dragonfly */
case Hsolaris: /* solaris */
@@ -127,6 +126,16 @@ archinit(void)
if(INITRND == -1)
INITRND = 4096;
break;
+ case Hnetbsd: /* netbsd */
+ elfinit();
+ HEADR = ELFRESERVE;
+ if(INITTEXT == -1)
+ INITTEXT = (1<<22)+HEADR;
+ if(INITDAT == -1)
+ INITDAT = 0;
+ if(INITRND == -1)
+ INITRND = 0x200000;
+ break;
case Hnacl:
elfinit();
debug['w']++; // disable dwarf, which gets confused and is useless anyway
diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
index 3196961..501d3ef 100644
--- a/src/cmd/ld/elf.c
+++ b/src/cmd/ld/elf.c
@@ -56,7 +56,8 @@ elfinit(void)
// 32-bit architectures
case '5':
// we use EABI on both linux/arm and freebsd/arm.
- if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
+ // and change to EABI netbsd/arm
+ if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd || HEADTYPE == Hnetbsd)
hdr.flags = 0x5000002; // has entry point, Version5 EABI
// fallthrough
default:
diff --git a/src/make.bash b/src/make.bash
index fbc6f5d..4859ac3 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -121,6 +121,15 @@ case "$GOHOSTARCH" in
386) mflag=-m32;;
amd64) mflag=-m64;;
esac
+
+# In gcc 4.8 on NetBSD 7.0, need -march=armv5 flag for arm target.
+# Default target of gcc is generic-arm. however some assemble-sources
+# in golang use operator for armv5 or lator.
+
+if [ "$GOARCH" == "arm" -o -z '$GOARCH' -a "$(uname -sp)" == "NetBSD earm" ]; then
+ mflag="-march=armv5"
+fi
+
if [ "$(uname)" == "Darwin" ]; then
# golang.org/issue/5261
mflag="$mflag -mmacosx-version-min=10.6"
diff --git a/src/runtime/debug.go b/src/runtime/debug.go
index 4414dd5..7559939 100644
--- a/src/runtime/debug.go
+++ b/src/runtime/debug.go
@@ -53,6 +53,10 @@ func NumCPU() int {
return int(ncpu)
}
+func Physpagesize() int {
+ return int(physpagesz)
+}
+
// NumCgoCall returns the number of cgo calls made by the current process.
func NumCgoCall() int64 {
var n int64
diff --git a/src/runtime/defs_netbsd.go b/src/runtime/defs_netbsd.go
index b27949e..55f9b14 100644
--- a/src/runtime/defs_netbsd.go
+++ b/src/runtime/defs_netbsd.go
@@ -122,4 +122,4 @@ type Itimerval C.struct_itimerval
type McontextT C.mcontext_t
type UcontextT C.ucontext_t
-type Kevent C.struct_kevent
+type KeventT C.struct_kevent
diff --git a/src/runtime/defs_netbsd_arm.h b/src/runtime/defs_netbsd_arm.h
index 70f34af..8190f38 100644
--- a/src/runtime/defs_netbsd_arm.h
+++ b/src/runtime/defs_netbsd_arm.h
@@ -119,10 +119,12 @@ struct StackT {
struct Timespec {
int64 tv_sec;
int32 tv_nsec;
+ byte Pad_cgo_0[4];
};
struct Timeval {
int64 tv_sec;
int32 tv_usec;
+ byte Pad_cgo_0[4];
};
struct Itimerval {
Timeval it_interval;
@@ -131,18 +133,18 @@ struct Itimerval {
struct McontextT {
uint32 __gregs[17];
-#ifdef __ARM_EABI__
- byte __fpu[4+8*32+4];
-#else
- byte __fpu[4+4*33+4];
-#endif
+ byte Pad_cgo_0[4];
+ // For EABI, fpscr[4]+pad[4]+fstmx[8*32]+fpsid[4]+pad[4]
+ byte __fpu[272];
uint32 _mc_tlsbase;
+ byte Pad_cgo_1[4];
};
struct UcontextT {
uint32 uc_flags;
UcontextT *uc_link;
Sigset uc_sigmask;
StackT uc_stack;
+ byte Pad_cgo_0[4];
McontextT uc_mcontext;
int32 __uc_pad[2];
};
@@ -154,6 +156,7 @@ struct KeventT {
uint32 fflags;
int64 data;
byte *udata;
+ byte Pad_cgo_0[4];
};
diff --git a/src/runtime/mgc0.c b/src/runtime/mgc0.c
index 083beec..cee1f5c 100644
--- a/src/runtime/mgc0.c
+++ b/src/runtime/mgc0.c
@@ -330,7 +330,8 @@ scanblock(byte *b, uintptr n, byte *ptrmask)
if(obj == nil)
continue;
if(obj < arena_start || obj >= arena_used) {
- if((uintptr)obj < PhysPageSize && runtime·invalidptr) {
+ if((uintptr)obj < runtime·physpagesz &&
+ runtime·invalidptr) {
s = nil;
goto badobj;
}
@@ -1893,7 +1894,7 @@ runtime·MHeap_MapBits(MHeap *h)
n = (h->arena_used - h->arena_start) / (PtrSize*wordsPerBitmapByte);
n = ROUND(n, bitmapChunk);
- n = ROUND(n, PhysPageSize);
+ n = ROUND(n, runtime·physpagesz);
if(h->bitmap_mapped >= n)
return;
diff --git a/src/runtime/mheap.c b/src/runtime/mheap.c
index bb203d5..1ec0dfb 100644
--- a/src/runtime/mheap.c
+++ b/src/runtime/mheap.c
@@ -82,7 +82,7 @@ runtime·MHeap_MapSpans(MHeap *h)
n = (uintptr)h->arena_used;
n -= (uintptr)h->arena_start;
n = n / PageSize * sizeof(h->spans[0]);
- n = ROUND(n, PhysPageSize);
+ n = ROUND(n, runtime·physpagesz);
if(h->spans_mapped >= n)
return;
runtime·SysMap((byte*)h->spans + h->spans_mapped, n - h->spans_mapped, h->arena_reserved, &mstats.other_sys);
diff --git a/src/runtime/os_darwin.c b/src/runtime/os_darwin.c
index bbd2928..caf351f 100644
--- a/src/runtime/os_darwin.c
+++ b/src/runtime/os_darwin.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -69,6 +70,17 @@ runtime·osinit(void)
ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
if(ret >= 0)
runtime·ncpu = out;
+
+ // Maybe able to get PageSize by sysctl
+ mib[0] = 6;
+ mib[1] = 7; //HW_PAGESIZE
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+ if(ret >= 0)
+ runtime·physpagesz = (uintptr)out;
+ else
+ runtime·physpagesz = PhysPageSize;
}
#pragma textflag NOSPLIT
diff --git a/src/runtime/os_dragonfly.c b/src/runtime/os_dragonfly.c
index e372205..5becf48 100644
--- a/src/runtime/os_dragonfly.c
+++ b/src/runtime/os_dragonfly.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -16,6 +17,7 @@ extern int32 runtime·sys_umtx_wakeup(uint32*, int32);
// From DragonFly's <sys/sysctl.h>
#define CTL_HW 6
#define HW_NCPU 3
+#define HW_PAGESIZE 7
static Sigset sigset_none;
static Sigset sigset_all = { ~(uint32)0, ~(uint32)0, ~(uint32)0, ~(uint32)0, };
@@ -40,6 +42,23 @@ getncpu(void)
return 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ uint32 mib[2];
+ uintptr out, nout;
+ int32 ret;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+ if(ret >= 0)
+ return out;
+ else
+ return PhysPageSize;
+}
+
static void futexsleep(void);
#pragma textflag NOSPLIT
@@ -163,6 +182,7 @@ void
runtime·osinit(void)
{
runtime·ncpu = getncpu();
+ runtime·physpagesz = getphyspagesize();
}
#pragma textflag NOSPLIT
diff --git a/src/runtime/os_freebsd.c b/src/runtime/os_freebsd.c
index a513cb6..0220097 100644
--- a/src/runtime/os_freebsd.c
+++ b/src/runtime/os_freebsd.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -15,6 +16,7 @@ extern int32 runtime·sys_umtx_op(uint32*, int32, uint32, void*, void*);
// From FreeBSD's <sys/sysctl.h>
#define CTL_HW 6
#define HW_NCPU 3
+#define HW_PAGESIZE 7
static Sigset sigset_none;
static Sigset sigset_all = { ~(uint32)0, ~(uint32)0, ~(uint32)0, ~(uint32)0, };
@@ -39,6 +41,24 @@ getncpu(void)
return 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ uint32 mib[2];
+ uintptr out, nout;
+ int32 ret;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+ if(ret >= 0)
+ return out;
+ else
+ return PhysPageSize;
+}
+
+
// FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and
// thus the code is largely similar. See linux/thread.c and lock_futex.c for comments.
@@ -171,6 +191,7 @@ void
runtime·osinit(void)
{
runtime·ncpu = getncpu();
+ runtime·physpagesz = getphyspagesize();
}
#pragma textflag NOSPLIT
diff --git a/src/runtime/os_linux.c b/src/runtime/os_linux.c
index 0d8ffc9..ef89a50 100644
--- a/src/runtime/os_linux.c
+++ b/src/runtime/os_linux.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -113,6 +114,12 @@ getproccount(void)
return cnt ? cnt : 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ return PhysPageSize;
+}
+
// Clone, the Linux rfork.
enum
{
@@ -175,6 +182,7 @@ void
runtime·osinit(void)
{
runtime·ncpu = getproccount();
+ runtime·physpagesz = getphyspagesize();
}
// Random bytes initialized at startup. These come
diff --git a/src/runtime/os_nacl.c b/src/runtime/os_nacl.c
index 14b5583..aba1aa7 100644
--- a/src/runtime/os_nacl.c
+++ b/src/runtime/os_nacl.c
@@ -56,6 +56,7 @@ runtime·osinit(void)
{
runtime·ncpu = 1;
g->m->procid = 2;
+ runtime·physpagesz = PhysPageSize;
//runtime·nacl_exception_handler(runtime·sigtramp, nil);
}
diff --git a/src/runtime/os_netbsd.c b/src/runtime/os_netbsd.c
index 58e5bed..ec48296 100644
--- a/src/runtime/os_netbsd.c
+++ b/src/runtime/os_netbsd.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -36,6 +37,7 @@ extern int32 runtime·lwp_self(void);
// From NetBSD's <sys/sysctl.h>
#define CTL_HW 6
#define HW_NCPU 3
+#define HW_PAGESIZE 7
static int32
getncpu(void)
@@ -57,6 +59,23 @@ getncpu(void)
return 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ uint32 mib[2];
+ uintptr out, nout;
+ int32 ret;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+ if(ret >= 0)
+ return out;
+ else
+ return PhysPageSize;
+}
+
#pragma textflag NOSPLIT
uintptr
runtime·semacreate(void)
@@ -239,6 +258,7 @@ void
runtime·osinit(void)
{
runtime·ncpu = getncpu();
+ runtime·physpagesz = getphyspagesize();
}
#pragma textflag NOSPLIT
diff --git a/src/runtime/os_openbsd.c b/src/runtime/os_openbsd.c
index eebaa13..2e71c72 100644
--- a/src/runtime/os_openbsd.c
+++ b/src/runtime/os_openbsd.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -35,6 +36,7 @@ extern int32 runtime·thrwakeup(void *ident, int32 n);
// From OpenBSD's <sys/sysctl.h>
#define CTL_HW 6
#define HW_NCPU 3
+#define HW_PAGESIZE 7
static int32
getncpu(void)
@@ -55,6 +57,22 @@ getncpu(void)
else
return 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ uint32 mib[2];
+ uintptr out, nout;
+ int32 ret;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+ if(ret >= 0)
+ return out;
+ else
+ return PhysPageSize;
+}
#pragma textflag NOSPLIT
uintptr
@@ -185,6 +203,7 @@ void
runtime·osinit(void)
{
runtime·ncpu = getncpu();
+ runtime·physpagesz = getphyspagesize();
}
#pragma textflag NOSPLIT
diff --git a/src/runtime/os_plan9.c b/src/runtime/os_plan9.c
index f8c543f..c3f9030 100644
--- a/src/runtime/os_plan9.c
+++ b/src/runtime/os_plan9.c
@@ -67,6 +67,11 @@ getproccount(void)
runtime·close(fd);
return ncpu > 0 ? ncpu : 1;
}
+static uintptr
+getphyspagesize(void)
+{
+ return PhysPageSize;
+}
static int32
getpid(void)
@@ -91,6 +96,7 @@ runtime·osinit(void)
{
runtime·ncpu = getproccount();
g->m->procid = getpid();
+ runtime·physpagesz = getphyspagesize();
runtime·notify(runtime·sigtramp);
}
diff --git a/src/runtime/os_solaris.c b/src/runtime/os_solaris.c
index e16b8e6..8e14f42 100644
--- a/src/runtime/os_solaris.c
+++ b/src/runtime/os_solaris.c
@@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "signal_unix.h"
#include "stack.h"
#include "textflag.h"
@@ -108,10 +109,17 @@ getncpu(void)
return n;
}
+static uintptr
+getphyspagesize(void)
+{
+ return PhysPageSize;
+}
+
void
runtime·osinit(void)
{
runtime·ncpu = getncpu();
+ runtime·physpagesz = getphyspagesize();
}
void
diff --git a/src/runtime/os_windows.c b/src/runtime/os_windows.c
index b8b8eda..0e4cbe9 100644
--- a/src/runtime/os_windows.c
+++ b/src/runtime/os_windows.c
@@ -6,6 +6,7 @@
#include "type.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "textflag.h"
#include "arch_GOARCH.h"
#include "malloc.h"
@@ -105,7 +106,11 @@ getproccount(void)
runtime·stdcall1(runtime·GetSystemInfo, (uintptr)&info);
return info.dwNumberOfProcessors;
}
-
+static uintptr
+getphyspagesize(void)
+{
+ return PhysPageSize;
+}
void
runtime·osinit(void)
{
@@ -135,6 +140,7 @@ runtime·osinit(void)
runtime·stdcall1(runtime·timeBeginPeriod, 1);
runtime·ncpu = getproccount();
+ runtime·physpagesz = getphyspagesize();
// Windows dynamic priority boosting assumes that a process has different types
// of dedicated threads -- GUI, IO, computational, etc. Go processes use
diff --git a/src/runtime/proc.c b/src/runtime/proc.c
index 8462c4b..58b316d 100644
--- a/src/runtime/proc.c
+++ b/src/runtime/proc.c
@@ -44,6 +44,7 @@ P* runtime·allp[MaxGomaxprocs+1];
int8* runtime·goos;
int32 runtime·ncpu;
int32 runtime·newprocs;
+uintptr runtime·physpagesz;
Mutex runtime·allglock; // the following vars are protected by this lock or by stoptheworld
G** runtime·allg;
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index 177a128..f281f02 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -765,6 +765,7 @@ extern Note runtime·signote;
extern ForceGCState runtime·forcegc;
extern SchedT runtime·sched;
extern int32 runtime·newprocs;
+extern uintptr runtime·physpagesz;
/*
* common functions and data
diff --git a/src/syscall/syscall_darwin_386.go b/src/syscall/syscall_darwin_386.go
index 2074e7a..1e9c6c4 100644
--- a/src/syscall/syscall_darwin_386.go
+++ b/src/syscall/syscall_darwin_386.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_darwin_amd64.go b/src/syscall/syscall_darwin_amd64.go
index 81b1fd3..2cadc8f 100644
--- a/src/syscall/syscall_darwin_amd64.go
+++ b/src/syscall/syscall_darwin_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_dragonfly_386.go b/src/syscall/syscall_dragonfly_386.go
index ebd3d4c..a1e96d1 100644
--- a/src/syscall/syscall_dragonfly_386.go
+++ b/src/syscall/syscall_dragonfly_386.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_dragonfly_amd64.go b/src/syscall/syscall_dragonfly_amd64.go
index 70c2ffb..87a366b 100644
--- a/src/syscall/syscall_dragonfly_amd64.go
+++ b/src/syscall/syscall_dragonfly_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_386.go b/src/syscall/syscall_freebsd_386.go
index ebd3d4c..a1e96d1 100644
--- a/src/syscall/syscall_freebsd_386.go
+++ b/src/syscall/syscall_freebsd_386.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_amd64.go b/src/syscall/syscall_freebsd_amd64.go
index 70c2ffb..87a366b 100644
--- a/src/syscall/syscall_freebsd_amd64.go
+++ b/src/syscall/syscall_freebsd_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_arm.go b/src/syscall/syscall_freebsd_arm.go
index ab72871..f6998ef 100644
--- a/src/syscall/syscall_freebsd_arm.go
+++ b/src/syscall/syscall_freebsd_arm.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index 8278750..5c37784 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -7,9 +7,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go
index 74a89fb..563e2c4 100644
--- a/src/syscall/syscall_linux_amd64.go
+++ b/src/syscall/syscall_linux_amd64.go
@@ -4,6 +4,8 @@
package syscall
+import "runtime"
+
//sys Chown(path string, uid int, gid int) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
@@ -55,7 +57,7 @@ package syscall
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
//go:noescape
func gettimeofday(tv *Timeval) (err Errno)
diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go
index b127345..b5fdfc6 100644
--- a/src/syscall/syscall_linux_arm.go
+++ b/src/syscall/syscall_linux_arm.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_nacl.go b/src/syscall/syscall_nacl.go
index c2788b2..92f2395 100644
--- a/src/syscall/syscall_nacl.go
+++ b/src/syscall/syscall_nacl.go
@@ -5,6 +5,7 @@
package syscall
import (
+ "runtime"
"sync"
"unsafe"
)
@@ -291,7 +292,7 @@ func Getegid() int { return 1 }
func Geteuid() int { return 1 }
func Getgid() int { return 1 }
func Getgroups() ([]int, error) { return []int{1}, nil }
-func Getpagesize() int { return 65536 }
+func Getpagesize() int { return runtime.Physpagesize() }
func Getppid() int { return 2 }
func Getpid() int { return 3 }
func Getuid() int { return 1 }
diff --git a/src/syscall/syscall_netbsd_386.go b/src/syscall/syscall_netbsd_386.go
index 2dbff07..7f0d4fa 100644
--- a/src/syscall/syscall_netbsd_386.go
+++ b/src/syscall/syscall_netbsd_386.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_netbsd_amd64.go b/src/syscall/syscall_netbsd_amd64.go
index 5784db9..9f72b1c 100644
--- a/src/syscall/syscall_netbsd_amd64.go
+++ b/src/syscall/syscall_netbsd_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_netbsd_arm.go b/src/syscall/syscall_netbsd_arm.go
index 659698a..425c508 100644
--- a/src/syscall/syscall_netbsd_arm.go
+++ b/src/syscall/syscall_netbsd_arm.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_openbsd_386.go b/src/syscall/syscall_openbsd_386.go
index ad5ae14..85d24c5 100644
--- a/src/syscall/syscall_openbsd_386.go
+++ b/src/syscall/syscall_openbsd_386.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_openbsd_amd64.go b/src/syscall/syscall_openbsd_amd64.go
index 6181344..e11e94c 100644
--- a/src/syscall/syscall_openbsd_amd64.go
+++ b/src/syscall/syscall_openbsd_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_plan9.go b/src/syscall/syscall_plan9.go
index 618e02c..7f95723 100644
--- a/src/syscall/syscall_plan9.go
+++ b/src/syscall/syscall_plan9.go
@@ -11,7 +11,10 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
const ImplementsGetwd = true
@@ -314,7 +317,7 @@ func Gettimeofday(tv *Timeval) error {
return nil
}
-func Getpagesize() int { return 0x1000 }
+func Getpagesize() int { return runtime.Physpagesize() }
func Getegid() (egid int) { return -1 }
func Geteuid() (euid int) { return -1 }
diff --git a/src/syscall/syscall_solaris_amd64.go b/src/syscall/syscall_solaris_amd64.go
index 37cf06d..294d4ef 100644
--- a/src/syscall/syscall_solaris_amd64.go
+++ b/src/syscall/syscall_solaris_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index e89fd09..7eb9ba8 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -8,6 +8,7 @@ package syscall
import (
errorspkg "errors"
+ "runtime"
"sync"
"unicode/utf16"
"unsafe"
@@ -68,7 +69,7 @@ func UTF16PtrFromString(s string) (*uint16, error) {
return &a[0], nil
}
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
// Errno is the Windows error number.
type Errno uintptr
diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go
index f13210f..c8d7819 100644
--- a/src/cmd/dist/util.go
+++ b/src/cmd/dist/util.go
@@ -510,9 +510,10 @@ func xgetgoarm() string {
// Conservative default for cross-compilation.
return "5"
}
- if goos == "freebsd" || goos == "openbsd" {
+ if goos == "freebsd" || goos == "openbsd" || goos == "netbsd" {
// FreeBSD has broken VFP support.
// OpenBSD currently only supports softfloat.
+ // NetBSD arm supports some armv5 machines,
return "5"
}
if goos != "linux" {
diff --git a/src/cmd/link/internal/amd64/obj.go b/src/cmd/link/internal/amd64/obj.go
index 1aa4422..5362faf 100644
--- a/src/cmd/link/internal/amd64/obj.go
+++ b/src/cmd/link/internal/amd64/obj.go
@@ -161,7 +161,6 @@ func archinit() {
case obj.Hlinux, /* elf64 executable */
obj.Hfreebsd, /* freebsd */
- obj.Hnetbsd, /* netbsd */
obj.Hopenbsd, /* openbsd */
obj.Hdragonfly, /* dragonfly */
obj.Hsolaris: /* solaris */
@@ -177,6 +176,19 @@ func archinit() {
if ld.INITRND == -1 {
ld.INITRND = 4096
}
+ case obj.Hnetbsd:
+ ld.Elfinit()
+
+ ld.HEADR = ld.ELFRESERVE
+ if ld.INITTEXT == -1 {
+ ld.INITTEXT = (1 << 22) + int64(ld.HEADR)
+ }
+ if ld.INITDAT == -1 {
+ ld.INITDAT = 0
+ }
+ if ld.INITRND == -1 {
+ ld.INITRND = 0x200000
+ }
case obj.Hnacl:
ld.Elfinit()
diff --git a/src/cmd/link/internal/arm/obj.go b/src/cmd/link/internal/arm/obj.go
index 14fe7a6..a200e7b 100644
--- a/src/cmd/link/internal/arm/obj.go
+++ b/src/cmd/link/internal/arm/obj.go
@@ -121,7 +121,6 @@ func archinit() {
case obj.Hlinux, /* arm elf */
obj.Hfreebsd,
- obj.Hnetbsd,
obj.Hopenbsd:
ld.Debug['d'] = 0
// with dynamic linking
@@ -136,6 +135,20 @@ func archinit() {
if ld.INITRND == -1 {
ld.INITRND = 4096
}
+ case obj.Hnetbsd:
+ ld.Debug['d'] = 0
+ // with dynamic linking
+ ld.Elfinit()
+ ld.HEADR = ld.ELFRESERVE
+ if ld.INITTEXT == -1 {
+ ld.INITTEXT = 0x10000 + int64(ld.HEADR)
+ }
+ if ld.INITDAT == -1 {
+ ld.INITDAT = 0
+ }
+ if ld.INITRND == -1 {
+ ld.INITRND = 0x10000
+ }
case obj.Hnacl:
ld.Elfinit()
diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go
index 9dedb0e..1fb2e75 100644
--- a/src/cmd/link/internal/ld/elf.go
+++ b/src/cmd/link/internal/ld/elf.go
@@ -796,7 +796,8 @@ func Elfinit() {
// 32-bit architectures
case '5':
// we use EABI on both linux/arm and freebsd/arm.
- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd {
+ if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd ||
+ HEADTYPE == obj.Hnetbsd {
ehdr.flags = 0x5000002 // has entry point, Version5 EABI
}
fallthrough
diff --git a/src/runtime/debug.go b/src/runtime/debug.go
index b7e7971..fb73c7f 100644
--- a/src/runtime/debug.go
+++ b/src/runtime/debug.go
@@ -36,6 +36,11 @@ func NumCPU() int {
return int(ncpu)
}
+// Physpagesize returns the physical page size from runtime
+func Physpagesize() int {
+ return int(physpagesz)
+}
+
// NumCgoCall returns the number of cgo calls made by the current process.
func NumCgoCall() int64 {
var n int64
diff --git a/src/runtime/defs1_netbsd_arm.go b/src/runtime/defs1_netbsd_arm.go
index c976351..01b82fc 100644
--- a/src/runtime/defs1_netbsd_arm.go
+++ b/src/runtime/defs1_netbsd_arm.go
@@ -110,6 +110,7 @@ type stackt struct {
type timespec struct {
tv_sec int64
tv_nsec int32
+ Pad_cgo_0 [4]byte // for EABI
}
func (ts *timespec) set_sec(x int32) {
@@ -121,8 +122,9 @@ func (ts *timespec) set_nsec(x int32) {
}
type timeval struct {
- tv_sec int64
- tv_usec int32
+ tv_sec int64
+ tv_usec int32
+ Pad_cgo_0 [4]byte // for EABI
}
func (tv *timeval) set_usec(x int32) {
@@ -136,9 +138,10 @@ type itimerval struct {
type mcontextt struct {
__gregs [17]uint32
- __fpu [4 + 8*32 + 4]byte // EABI
- // __fpu [4+4*33+4]byte // not EABI
+ Pad_cgo_0 [4]byte // for EABI
+ __fpu [272]byte // for EABI, fpscr[4]+pad[4]+fstmx[8*32]+fpsid[4]+pad[4]
_mc_tlsbase uint32
+ Pad_cgo_1 [4]byte // for EABI
}
type ucontextt struct {
@@ -146,6 +149,7 @@ type ucontextt struct {
uc_link *ucontextt
uc_sigmask sigset
uc_stack stackt
+ Pad_cgo_0 [4]byte // for EABI
uc_mcontext mcontextt
__uc_pad [2]int32
}
@@ -157,6 +161,7 @@ type keventt struct {
fflags uint32
data int64
udata *byte
+ Pad_cgo_0 [4]byte // for EABI
}
// created by cgo -cdefs and then converted to Go
diff --git a/src/runtime/defs_netbsd.go b/src/runtime/defs_netbsd.go
index b27949e..55f9b14 100644
--- a/src/runtime/defs_netbsd.go
+++ b/src/runtime/defs_netbsd.go
@@ -122,4 +122,4 @@ type Itimerval C.struct_itimerval
type McontextT C.mcontext_t
type UcontextT C.ucontext_t
-type Kevent C.struct_kevent
+type KeventT C.struct_kevent
diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go
index 0dbe1ff..3d5580e 100644
--- a/src/runtime/mbarrier.go
+++ b/src/runtime/mbarrier.go
@@ -128,7 +128,7 @@ func writebarrierptr(dst *uintptr, src uintptr) {
if !writeBarrierEnabled {
return
}
- if src != 0 && (src < _PhysPageSize || src == poisonStack) {
+ if src != 0 && (src < physpagesz || src == poisonStack) {
systemstack(func() {
print("runtime: writebarrierptr *", dst, " = ", hex(src), "\n")
throw("bad pointer in write barrier")
@@ -144,7 +144,7 @@ func writebarrierptr_nostore(dst *uintptr, src uintptr) {
if !writeBarrierEnabled {
return
}
- if src != 0 && (src < _PhysPageSize || src == poisonStack) {
+ if src != 0 && (src < physpagesz || src == poisonStack) {
systemstack(func() { throw("bad pointer in write barrier") })
}
writebarrierptr_nostore1(dst, src)
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go
index fd6b4b1..fcc6451 100644
--- a/src/runtime/mbitmap.go
+++ b/src/runtime/mbitmap.go
@@ -136,7 +136,7 @@ func mHeap_MapBits(h *mheap, arena_used uintptr) {
n := (arena_used - mheap_.arena_start) / heapBitmapScale
n = round(n, bitmapChunk)
- n = round(n, _PhysPageSize)
+ n = round(n, physpagesz)
if h.bitmap_mapped >= n {
return
}
diff --git a/src/runtime/mem_linux.go b/src/runtime/mem_linux.go
index e8c8999..fe3950d 100644
--- a/src/runtime/mem_linux.go
+++ b/src/runtime/mem_linux.go
@@ -21,7 +21,7 @@ var addrspace_vec [1]byte
func addrspace_free(v unsafe.Pointer, n uintptr) bool {
var chunk uintptr
for off := uintptr(0); off < n; off += chunk {
- chunk = _PAGE_SIZE * uintptr(len(addrspace_vec))
+ chunk = physpagesz * uintptr(len(addrspace_vec))
if chunk > (n - off) {
chunk = n - off
}
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index bc4e7c1..249745e 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -307,7 +307,7 @@ func mHeap_MapSpans(h *mheap, arena_used uintptr) {
n := arena_used
n -= h.arena_start
n = n / _PageSize * ptrSize
- n = round(n, _PhysPageSize)
+ n = round(n, physpagesz)
if h.spans_mapped >= n {
return
}
@@ -788,7 +788,7 @@ func mHeap_FreeSpanLocked(h *mheap, s *mspan, acctinuse, acctidle bool, unusedsi
}
func scavengelist(list *mspan, now, limit uint64) uintptr {
- if _PhysPageSize > _PageSize {
+ if physpagesz > _PageSize {
// golang.org/issue/9993
// If the physical page size of the machine is larger than
// our logical heap page size the kernel may round up the
diff --git a/src/runtime/os1_darwin.go b/src/runtime/os1_darwin.go
index c9dba15..bd51555 100644
--- a/src/runtime/os1_darwin.go
+++ b/src/runtime/os1_darwin.go
@@ -35,6 +35,7 @@ func osinit() {
// can look at the environment first.
ncpu = getncpu()
+ physpagesz = getphyspagesz()
}
func getncpu() int32 {
@@ -49,6 +50,18 @@ func getncpu() int32 {
return 1
}
+func getphyspagesz() uintptr {
+ // Use sysctl to fetch hw.pagesize.
+ mib := [2]uint32{6, 7}
+ out := uintptr(0)
+ nout := unsafe.Sizeof(out)
+ ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ if ret >= 0 {
+ return out
+ }
+ return _PhysPageSize
+}
+
var urandom_dev = []byte("/dev/urandom\x00")
//go:nosplit
diff --git a/src/runtime/os1_dragonfly.go b/src/runtime/os1_dragonfly.go
index da70014..a5b51ed 100644
--- a/src/runtime/os1_dragonfly.go
+++ b/src/runtime/os1_dragonfly.go
@@ -10,6 +10,7 @@ import "unsafe"
const (
_CTL_HW = 6
_HW_NCPU = 3
+ _HW_PAGESIZE = 7
)
var sigset_all = sigset{[4]uint32{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)}}
@@ -25,6 +26,17 @@ func getncpu() int32 {
return 1
}
+func getphyspagesz() uintptr {
+ mib := [2]uint32{_CTL_HW, _HW_PAGESIZE}
+ out := uintptr(0)
+ nout := unsafe.Sizeof(out)
+ ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ if ret >= 0 {
+ return out
+ }
+ return _PhysPageSize
+}
+
//go:nosplit
func futexsleep(addr *uint32, val uint32, ns int64) {
systemstack(func() {
@@ -96,6 +108,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
func osinit() {
ncpu = getncpu()
+ physpagesz = getphyspagesz()
}
var urandom_dev = []byte("/dev/urandom\x00")
diff --git a/src/runtime/os1_freebsd.go b/src/runtime/os1_freebsd.go
index b18e60f..52bbf5f 100644
--- a/src/runtime/os1_freebsd.go
+++ b/src/runtime/os1_freebsd.go
@@ -10,6 +10,7 @@ import "unsafe"
const (
_CTL_HW = 6
_HW_NCPU = 3
+ _HW_PAGESIZE = 7
)
var sigset_all = sigset{[4]uint32{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)}}
@@ -25,6 +26,17 @@ func getncpu() int32 {
return 1
}
+func getphyspagesz() uintptr {
+ mib := [2]uint32{_CTL_HW, _HW_PAGESIZE}
+ out := uintptr(0)
+ nout := unsafe.Sizeof(out)
+ ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ if ret >= 0 {
+ return out
+ }
+ return _PhysPageSize
+}
+
// FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and
// thus the code is largely similar. See Linux implementation
// and lock_futex.go for comments.
diff --git a/src/runtime/os1_linux.go b/src/runtime/os1_linux.go
index 166014b..0e293e3 100644
--- a/src/runtime/os1_linux.go
+++ b/src/runtime/os1_linux.go
@@ -98,6 +98,10 @@ func getproccount() int32 {
}
return n
}
+func getphyspagesz() uintptr {
+ // XXX: How to get PAGESIZE?
+ return _PhysPageSize
+}
// Clone, the Linux rfork.
const (
@@ -171,6 +175,7 @@ var failthreadcreate = []byte("runtime: failed to create new OS thread\n")
func osinit() {
ncpu = getproccount()
+ physpagesz = getphyspagesz()
}
var urandom_dev = []byte("/dev/urandom\x00")
diff --git a/src/runtime/os1_nacl.go b/src/runtime/os1_nacl.go
index 30c3529..f7850a3 100644
--- a/src/runtime/os1_nacl.go
+++ b/src/runtime/os1_nacl.go
@@ -51,6 +51,7 @@ func unminit() {
func osinit() {
ncpu = 1
getg().m.procid = 2
+ pyhspagesz = _PhysPageSize
//nacl_exception_handler(funcPC(sigtramp), nil);
}
diff --git a/src/runtime/os1_netbsd.go b/src/runtime/os1_netbsd.go
index f4c5ca4..45d861f 100644
--- a/src/runtime/os1_netbsd.go
+++ b/src/runtime/os1_netbsd.go
@@ -23,6 +23,7 @@ var sigset_all = sigset{[4]uint32{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)
const (
_CTL_HW = 6
_HW_NCPU = 3
+ _HW_PAGESIZE = 7
)
func getncpu() int32 {
@@ -36,6 +37,17 @@ func getncpu() int32 {
return 1
}
+func getphyspagesz() uintptr {
+ mib := [2]uint32{_CTL_HW, _HW_PAGESIZE}
+ out := uintptr(0)
+ nout := unsafe.Sizeof(out)
+ ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ if ret >= 0 {
+ return out
+ }
+ return _PhysPageSize
+}
+
//go:nosplit
func semacreate() uintptr {
return 1
@@ -115,6 +127,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
func osinit() {
ncpu = getncpu()
+ physpagesz = getphyspagesz()
}
var urandom_dev = []byte("/dev/urandom\x00")
diff --git a/src/runtime/os1_openbsd.go b/src/runtime/os1_openbsd.go
index 88f6aef..f8da70b 100644
--- a/src/runtime/os1_openbsd.go
+++ b/src/runtime/os1_openbsd.go
@@ -28,6 +28,7 @@ const (
const (
_CTL_HW = 6
_HW_NCPU = 3
+ _HW_PAGESIZE = 7
)
func getncpu() int32 {
@@ -43,6 +44,18 @@ func getncpu() int32 {
return 1
}
+func getphyspagesz() uintptr {
+ mib := [2]uint32{_CTL_HW, _HW_PAGESIZE}
+ out := uintptr(0)
+ nout := unsafe.Sizeof(out)
+
+ ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ if ret >= 0 {
+ return out
+ }
+ return _PhysPageSize
+}
+
//go:nosplit
func semacreate() uintptr {
return 1
@@ -125,6 +138,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
func osinit() {
ncpu = getncpu()
+ physpagesz = getphyspagesz()
}
var urandom_dev = []byte("/dev/urandom\x00")
diff --git a/src/runtime/os1_plan9.go b/src/runtime/os1_plan9.go
index 38125a0..5107dd0 100644
--- a/src/runtime/os1_plan9.go
+++ b/src/runtime/os1_plan9.go
@@ -66,6 +66,11 @@ func getproccount() int32 {
return ncpu
}
+func getphyspagesz() uintptr {
+ // XXX: How to get PAGE_SIZE?
+ return _PhysPageSize
+}
+
var pid = []byte("#c/pid\x00")
func getpid() uint64 {
@@ -85,6 +90,7 @@ func getpid() uint64 {
func osinit() {
initBloc()
ncpu = getproccount()
+ physpagesz = getphyspagesz()
getg().m.procid = getpid()
notify(unsafe.Pointer(funcPC(sigtramp)))
}
diff --git a/src/runtime/os1_windows.go b/src/runtime/os1_windows.go
index d012034..fd194d8 100644
--- a/src/runtime/os1_windows.go
+++ b/src/runtime/os1_windows.go
@@ -130,6 +130,10 @@ func getproccount() int32 {
stdcall1(_GetSystemInfo, uintptr(unsafe.Pointer(&info)))
return int32(info.dwnumberofprocessors)
}
+func getphyspagesz() uintptr {
+ // XXX: How to get PAGESIZE ??
+ return _PhysPageSize
+}
const (
currentProcess = ^uintptr(0) // -1 = current process
@@ -157,6 +161,7 @@ func osinit() {
stdcall1(_timeBeginPeriod, 1)
ncpu = getproccount()
+ physpagesz = getphyspagesz()
// Windows dynamic priority boosting assumes that a process has different types
// of dedicated threads -- GUI, IO, computational, etc. Go processes use
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 57cd869..1a5417f 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -639,6 +639,7 @@ var (
forcegc forcegcstate
sched schedt
newprocs int32
+ physpagesz uintptr
// Information about what cpu features are available.
// Set on startup in asm_{x86,amd64}.s.
diff --git a/src/syscall/syscall_darwin_386.go b/src/syscall/syscall_darwin_386.go
index 2074e7a..72ec53a 100644
--- a/src/syscall/syscall_darwin_386.go
+++ b/src/syscall/syscall_darwin_386.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_darwin_amd64.go b/src/syscall/syscall_darwin_amd64.go
index 70b53b8..f0fc944 100644
--- a/src/syscall/syscall_darwin_amd64.go
+++ b/src/syscall/syscall_darwin_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_darwin_arm.go b/src/syscall/syscall_darwin_arm.go
index 2a7d4f2..eac95e3 100644
--- a/src/syscall/syscall_darwin_arm.go
+++ b/src/syscall/syscall_darwin_arm.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_darwin_arm64.go b/src/syscall/syscall_darwin_arm64.go
index de7a08b..fe39a7f 100644
--- a/src/syscall/syscall_darwin_arm64.go
+++ b/src/syscall/syscall_darwin_arm64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 16384 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_dragonfly_amd64.go b/src/syscall/syscall_dragonfly_amd64.go
index 70c2ffb..94149d9 100644
--- a/src/syscall/syscall_dragonfly_amd64.go
+++ b/src/syscall/syscall_dragonfly_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_386.go b/src/syscall/syscall_freebsd_386.go
index ebd3d4c..b255ad0 100644
--- a/src/syscall/syscall_freebsd_386.go
+++ b/src/syscall/syscall_freebsd_386.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_amd64.go b/src/syscall/syscall_freebsd_amd64.go
index 70c2ffb..94149d9 100644
--- a/src/syscall/syscall_freebsd_amd64.go
+++ b/src/syscall/syscall_freebsd_amd64.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_freebsd_arm.go b/src/syscall/syscall_freebsd_arm.go
index ab72871..879a1f2 100644
--- a/src/syscall/syscall_freebsd_arm.go
+++ b/src/syscall/syscall_freebsd_arm.go
@@ -4,9 +4,12 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index 9ee1c1c..5e25176 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -7,11 +7,14 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
const _SYS_dup = SYS_DUP2
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go
index 6fbef21..42a993d 100644
--- a/src/syscall/syscall_linux_amd64.go
+++ b/src/syscall/syscall_linux_amd64.go
@@ -4,6 +4,8 @@
package syscall
+import "runtime"
+
const _SYS_dup = SYS_DUP2
//sys Dup2(oldfd int, newfd int) (err error)
@@ -69,7 +71,7 @@ func Gettimeofday(tv *Timeval) (err error) {
return nil
}
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func Time(t *Time_t) (tt Time_t, err error) {
var tv Timeval
diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go
index 218d6b8..2279559 100644
--- a/src/syscall/syscall_linux_arm.go
+++ b/src/syscall/syscall_linux_arm.go
@@ -4,11 +4,14 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
const _SYS_dup = SYS_DUP2
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_linux_arm64.go b/src/syscall/syscall_linux_arm64.go
index 3d55181..330a252 100644
--- a/src/syscall/syscall_linux_arm64.go
+++ b/src/syscall/syscall_linux_arm64.go
@@ -4,6 +4,8 @@
package syscall
+import "runtime"
+
const _SYS_dup = SYS_DUP3
//sys Fchown(fd int, uid int, gid int) (err error)
@@ -65,7 +67,7 @@ func Lstat(path string, stat *Stat_t) (err error) {
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-func Getpagesize() int { return 65536 }
+func Getpagesize() int { return runtime.Physpagesize() }
//sysnb Gettimeofday(tv *Timeval) (err error)
//sysnb Time(t *Time_t) (tt Time_t, err error)
diff --git a/src/syscall/syscall_linux_ppc64x.go b/src/syscall/syscall_linux_ppc64x.go
index 10489d9..0b14f5d 100644
--- a/src/syscall/syscall_linux_ppc64x.go
+++ b/src/syscall/syscall_linux_ppc64x.go
@@ -7,6 +7,8 @@
package syscall
+import "runtime"
+
const _SYS_dup = SYS_DUP2
//sys Dup2(oldfd int, newfd int) (err error)
@@ -61,7 +63,7 @@ const _SYS_dup = SYS_DUP2
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-func Getpagesize() int { return 65536 }
+func Getpagesize() int { return runtime.Physpagesize() }
//sysnb Gettimeofday(tv *Timeval) (err error)
//sysnb Time(t *Time_t) (tt Time_t, err error)
diff --git a/src/syscall/syscall_nacl.go b/src/syscall/syscall_nacl.go
index f8f63ef..7cdb7be 100644
--- a/src/syscall/syscall_nacl.go
+++ b/src/syscall/syscall_nacl.go
@@ -5,6 +5,7 @@
package syscall
import (
+ "runtime"
"sync"
"unsafe"
)
@@ -292,7 +293,7 @@ func Getegid() int { return 1 }
func Geteuid() int { return 1 }
func Getgid() int { return 1 }
func Getgroups() ([]int, error) { return []int{1}, nil }
-func Getpagesize() int { return 65536 }
+func Getpagesize() int { return runtime.Physpagesize() }
func Getppid() int { return 2 }
func Getpid() int { return 3 }
func Getuid() int { return 1 }
diff --git a/src/syscall/syscall_netbsd_386.go b/src/syscall/syscall_netbsd_386.go
index 2dbff07..7f0d4fa 100644
--- a/src/syscall/syscall_netbsd_386.go
+++ b/src/syscall/syscall_netbsd_386.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_netbsd_amd64.go b/src/syscall/syscall_netbsd_amd64.go
index 5784db9..9f72b1c 100644
--- a/src/syscall/syscall_netbsd_amd64.go
+++ b/src/syscall/syscall_netbsd_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_netbsd_arm.go b/src/syscall/syscall_netbsd_arm.go
index 659698a..425c508 100644
--- a/src/syscall/syscall_netbsd_arm.go
+++ b/src/syscall/syscall_netbsd_arm.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_openbsd_386.go b/src/syscall/syscall_openbsd_386.go
index ad5ae14..85d24c5 100644
--- a/src/syscall/syscall_openbsd_386.go
+++ b/src/syscall/syscall_openbsd_386.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_openbsd_amd64.go b/src/syscall/syscall_openbsd_amd64.go
index 6181344..e11e94c 100644
--- a/src/syscall/syscall_openbsd_amd64.go
+++ b/src/syscall/syscall_openbsd_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_openbsd_arm.go b/src/syscall/syscall_openbsd_arm.go
index ad5ae14..85d24c5 100644
--- a/src/syscall/syscall_openbsd_arm.go
+++ b/src/syscall/syscall_openbsd_arm.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_plan9.go b/src/syscall/syscall_plan9.go
index 7968708..fec4434 100644
--- a/src/syscall/syscall_plan9.go
+++ b/src/syscall/syscall_plan9.go
@@ -11,7 +11,10 @@
package syscall
-import "unsafe"
+import (
+ "unsafe"
+ "runtime"
+)
const ImplementsGetwd = true
@@ -304,7 +307,7 @@ func Gettimeofday(tv *Timeval) error {
return nil
}
-func Getpagesize() int { return 0x1000 }
+func Getpagesize() int { return runtime.Physpagesize() }
func Getegid() (egid int) { return -1 }
func Geteuid() (euid int) { return -1 }
diff --git a/src/syscall/syscall_solaris_amd64.go b/src/syscall/syscall_solaris_amd64.go
index 67b8af1..34a5b09 100644
--- a/src/syscall/syscall_solaris_amd64.go
+++ b/src/syscall/syscall_solaris_amd64.go
@@ -4,7 +4,9 @@
package syscall
-func Getpagesize() int { return 4096 }
+import "runtime"
+
+func Getpagesize() int { return runtime.Physpagesize() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index 1006a9b..0c11168 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -8,6 +8,7 @@ package syscall
import (
errorspkg "errors"
+ "runtime"
"sync"
"unicode/utf16"
"unsafe"
@@ -75,7 +76,7 @@ func UTF16PtrFromString(s string) (*uint16, error) {
return &a[0], nil
}
-func Getpagesize() int { return 4096 }
+func Getpagesize() int { return runtime.Physpagesize() }
// Errno is the Windows error number.
type Errno uintptr
# Testing packages.
ok cmd/addr2line 6.849s
? cmd/cgo [no test files]
ok cmd/fix 0.155s
ok cmd/go 1.227s
ok cmd/gofmt 0.450s
ok cmd/nm 6.570s
--- FAIL: TestDisasmExtld (5.85s)
objdump_test.go:72: go build fmthello.go: exit status 2
# command-line-arguments
/usr/pkg/go14/pkg/tool/netbsd_arm/5l: cannot use -linkmode=external with -H netbsd
FAIL
FAIL cmd/objdump 17.515s
ok cmd/pack 48.155s
? cmd/pprof [no test files]
? cmd/yacc [no test files]
ok archive/tar 3.665s
ok archive/zip 10.480s
ok bufio 5.701s
ok bytes 3.798s
ok cmd/internal/goobj 0.021s
? cmd/internal/objfile [no test files]
? cmd/pprof/internal/commands [no test files]
? cmd/pprof/internal/driver [no test files]
? cmd/pprof/internal/fetch [no test files]
? cmd/pprof/internal/plugin [no test files]
? cmd/pprof/internal/profile [no test files]
? cmd/pprof/internal/report [no test files]
? cmd/pprof/internal/svg [no test files]
? cmd/pprof/internal/symbolizer [no test files]
? cmd/pprof/internal/symbolz [no test files]
? cmd/pprof/internal/tempfile [no test files]
ok compress/bzip2 2.451s
ok compress/flate 12.487s
ok compress/gzip 0.076s
ok compress/lzw 1.454s
ok compress/zlib 21.144s
ok container/heap 0.021s
ok container/list 0.024s
ok container/ring 0.080s
? crypto [no test files]
ok crypto/aes 1.480s
ok crypto/cipher 1.750s
ok crypto/des 0.171s
ok crypto/dsa 0.081s
ok crypto/ecdsa 0.280s
ok crypto/elliptic 2.906s
ok crypto/hmac 0.025s
ok crypto/md5 0.715s
ok crypto/rand 0.173s
ok crypto/rc4 1.570s
ok crypto/rsa 6.331s
ok crypto/sha1 0.029s
ok crypto/sha256 0.035s
ok crypto/sha512 0.077s
ok crypto/subtle 0.294s
ok crypto/tls 40.249s
ok crypto/x509 35.541s
? crypto/x509/pkix [no test files]
ok database/sql 0.760s
ok database/sql/driver 0.019s
ok debug/dwarf 0.150s
ok debug/elf 0.297s
ok debug/gosym 0.020s
ok debug/macho 0.034s
ok debug/pe 0.129s
ok debug/plan9obj 0.022s
? encoding [no test files]
ok encoding/ascii85 0.093s
ok encoding/asn1 0.036s
ok encoding/base32 0.035s
ok encoding/base64 0.040s
ok encoding/binary 0.070s
ok encoding/csv 0.038s
ok encoding/gob 0.755s
ok encoding/hex 0.024s
ok encoding/json 1.798s
ok encoding/pem 0.031s
ok encoding/xml 0.660s
ok errors 0.022s
ok expvar 1.972s
ok flag 1.020s
ok fmt 0.917s
ok go/ast 0.240s
ok go/build 1.696s
ok go/doc 0.562s
ok go/format 0.086s
ok go/parser 0.489s
ok go/printer 6.138s
ok go/scanner 0.037s
ok go/token 1.929s
? hash [no test files]
ok hash/adler32 0.090s
ok hash/crc32 0.259s
ok hash/crc64 0.019s
ok hash/fnv 0.096s
ok html 0.030s
ok html/template 1.270s
ok image 1.233s
ok image/color 0.400s
? image/color/palette [no test files]
ok image/draw 3.631s
ok image/gif 1.913s
ok image/jpeg 5.106s
ok image/png 1.268s
ok index/suffixarray 0.832s
ok io 1.170s
ok io/ioutil 0.080s
ok log 0.052s
ok log/syslog 2.573s
ok math 1.556s
ok math/big 7.557s
ok math/cmplx 2.580s
ok math/rand 5.697s
ok mime 0.080s
ok mime/multipart 2.852s
ok net 12.991s
ok net/http 50.390s
ok net/http/cgi 2.723s
ok net/http/cookiejar 0.065s
ok net/http/fcgi 0.047s
ok net/http/httptest 0.084s
ok net/http/httputil 0.779s
ok net/http/internal 1.921s
? net/http/pprof [no test files]
ok net/mail 0.855s
ok net/rpc 1.970s
ok net/rpc/jsonrpc 0.980s
ok net/smtp 0.968s
ok net/textproto 0.049s
ok net/url 0.096s
ok os 10.976s
ok os/exec 2.821s
*** Test killed: ran too long (11m0s).
FAIL os/signal 665.024s
ok os/user 0.029s
ok path 0.025s
ok path/filepath 3.123s
ok reflect 4.938s
ok regexp 3.498s
ok regexp/syntax 8.250s
--- FAIL: TestCgoSignalDeadlock (8.21s)
crash_cgo_test.go:27: expected "OK\n", but got "runtime/cgo: pthread_create failed: Cannot allocate memory\nSIGABRT: abort\nPC=0x402d6c90\n\ngoroutine 0 [idle]:\n\ngoroutine 1 [sleep]:\nmain.main()\n\t/tmp/go-build213742069/main.go:46 +0x15c\n\ngoroutine 5 [running]:\n\tgoroutine running on other thread; stack unavailable\ncreated by main.main\n\t/tmp/go-build213742069/main.go:35 +0xd4\n\ngoroutine 17 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 18 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 19 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 20 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 7 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 8 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 9 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 10 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 33 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 34 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 21 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 22 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 11 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 12 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 49 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 50 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 51 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 52 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 35 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 36 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 53 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 54 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 37 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 38 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 55 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 56 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 57 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 58 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 59 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 60 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 23 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 24 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 61 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 62 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 63 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 64 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 65 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 66 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 81 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 82 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 67 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 68 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 69 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 70 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 13 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 14 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 71 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 72 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 73 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 74 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 75 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 76 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 15 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 16 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 97 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 98 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 99 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 100 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 83 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 84 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 101 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 102 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 85 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 86 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 77 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 78 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 39 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 40 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 103 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 104 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 41 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 42 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 87 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 88 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 79 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 80 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 25 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 26 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 113 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 114 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 43 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 44 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 105 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 106 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 115 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 116 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 117 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 118 [select (no cases), locked to thread]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:44 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ngoroutine 45 [select (no cases), locked to thread]:\nmain.func·004()\n\t/tmp/go-build213742069/main.go:40 +0x20\ncreated by main.main\n\t/tmp/go-build213742069/main.go:41 +0x124\n\ngoroutine 46 [runnable]:\nmain.func·005()\n\t/tmp/go-build213742069/main.go:42\ncreated by main.main\n\t/tmp/go-build213742069/main.go:45 +0x144\n\ntrap 0x0\nerror 0x0\noldmask 0x0\nr0 0x0\nr1 0x0\nr2 0x0\nr3 0x10\nr4 0x7dc51e50\nr5 0x130000\nr6 0x71b02060\nr7 0x50612000\nr8 0x50792900\nr9 0x0\nruntime/cgo: pthread_create failed: Cannot allocate memory\nr10 0x50944460"
panic: test timed out after 10m0s
goroutine 490 [running]:
testing.func·008()
/usr/pkg/go14/src/testing/testing.go:681 +0x11c
created by time.goFunc
/usr/pkg/go14/src/time/sleep.go:129 +0x50
goroutine 1 [chan receive, 7 minutes]:
testing.RunTests(0x223f08, 0x2b3880, 0x7b, 0x7b, 0x20500)
/usr/pkg/go14/src/testing/testing.go:556 +0x814
testing.(*M).Run(0x503dc000, 0x2b8768)
/usr/pkg/go14/src/testing/testing.go:485 +0x74
main.main()
runtime/_test/_testmain.go:732 +0x1b4
goroutine 485 [syscall, 7 minutes]:
syscall.Syscall6(0x1c1, 0x159f, 0x50fefc34, 0x0, 0x503ed260, 0x0, 0x0, 0x50fefc18, 0x122f48, 0x4)
/usr/pkg/go14/src/syscall/asm_netbsd_arm.s:39 +0x8
syscall.wait4(0x159f, 0x50fefc34, 0x0, 0x503ed260, 0x60, 0x0, 0x0)
/usr/pkg/go14/src/syscall/zsyscall_netbsd_arm.go:32 +0x6c
syscall.Wait4(0x159f, 0x50fefc58, 0x0, 0x503ed260, 0x503d9470, 0x0, 0x0)
/usr/pkg/go14/src/syscall/syscall_bsd.go:162 +0x5c
os.(*Process).wait(0x503d9540, 0x1, 0x0, 0x0)
/usr/pkg/go14/src/os/exec_unix.go:22 +0xd4
os.(*Process).Wait(0x503d9540, 0x503d9480, 0x0, 0x0)
/usr/pkg/go14/src/os/doc.go:45 +0x34
os/exec.(*Cmd).Wait(0x50c35040, 0x0, 0x0)
/usr/pkg/go14/src/os/exec/exec.go:364 +0x194
os/exec.(*Cmd).Run(0x50c35040, 0x0, 0x0)
/usr/pkg/go14/src/os/exec/exec.go:246 +0x68
os/exec.(*Cmd).CombinedOutput(0x50c35040, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/pkg/go14/src/os/exec/exec.go:408 +0x2b4
runtime_test.executeTest(0x503ecf60, 0x228110, 0x32c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/pkg/go14/src/runtime/crash_test.go:64 +0xc38
runtime_test.TestCgoExternalThreadSIGPROF(0x503ecf60)
/usr/pkg/go14/src/runtime/crash_cgo_test.go:71 +0x33c
testing.tRunner(0x503ecf60, 0x2b3934)
/usr/pkg/go14/src/testing/testing.go:447 +0xf4
created by testing.RunTests
/usr/pkg/go14/src/testing/testing.go:555 +0x7e0
goroutine 489 [syscall, 7 minutes]:
syscall.Syscall(0x3, 0x4, 0x50f94000, 0x200, 0x1, 0x2be94, 0x703a2000)
/usr/pkg/go14/src/syscall/asm_netbsd_arm.s:17 +0x8
syscall.read(0x4, 0x50f94000, 0x200, 0x200, 0x503be900, 0x0, 0x0)
/usr/pkg/go14/src/syscall/zsyscall_netbsd_arm.go:872 +0x80
syscall.Read(0x4, 0x50f94000, 0x200, 0x200, 0x0, 0x0, 0x0)
/usr/pkg/go14/src/syscall/syscall_unix.go:136 +0x54
os.(*File).read(0x503bca80, 0x50f94000, 0x200, 0x200, 0x50f94000, 0x0, 0x0)
/usr/pkg/go14/src/os/file_unix.go:191 +0x5c
os.(*File).Read(0x503bca80, 0x50f94000, 0x200, 0x200, 0x1, 0x0, 0x0)
/usr/pkg/go14/src/os/file.go:95 +0x80
bytes.(*Buffer).ReadFrom(0x503ed200, 0x703b3ca8, 0x503bca80, 0x0, 0x0, 0x0, 0x0)
/usr/pkg/go14/src/bytes/buffer.go:169 +0x294
io.Copy(0x703b3c78, 0x503ed200, 0x703b3ca8, 0x503bca80, 0x0, 0x0, 0x0, 0x0)
/usr/pkg/go14/src/io/io.go:358 +0x124
os/exec.func·003(0x0, 0x0)
/usr/pkg/go14/src/os/exec/exec.go:221 +0x9c
os/exec.func·004(0x503d9470)
/usr/pkg/go14/src/os/exec/exec.go:328 +0x2c
created by os/exec.(*Cmd).Start
/usr/pkg/go14/src/os/exec/exec.go:320 +0xa50
FAIL runtime 600.268s
? runtime/cgo [no test files]
ok runtime/debug 0.049s
ok runtime/pprof 23.288s
? runtime/race [no test files]
ok sort 4.069s
ok strconv 8.643s
ok strings 2.345s
ok sync 1.047s
ok sync/atomic 10.117s
--- FAIL: TestPassFD (0.03s)
syscall_unix_test.go:131: child process ReadAll: "", <nil>; want "Hello from child process!\n"
FAIL
FAIL syscall 0.056s
ok testing 2.275s
? testing/iotest [no test files]
ok testing/quick 0.307s
ok text/scanner 0.091s
ok text/tabwriter 0.041s
ok text/template 0.361s
ok text/template/parse 0.763s
ok time 9.153s
ok unicode 0.024s
ok unicode/utf16 0.220s
ok unicode/utf8 0.312s
? unsafe [no test files]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.