mirror of
https://github.com/golang/go
synced 2024-11-25 04:57:56 -07:00
runtime: always initialise procid on netbsd
The correct procid is needed for unparking LWPs on NetBSD - always initialise procid in minit() so that cgo works correctly. The non-cgo case already works correctly since procid is initialised via lwp_create(). R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6257071
This commit is contained in:
parent
334bf95f9e
commit
deb93b0f7b
@ -292,6 +292,11 @@ TEXT runtime·lwp_unpark(SB),7,$-4
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
TEXT runtime·lwp_self(SB),7,$-4
|
||||
MOVL $311, AX // sys__lwp_self
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
TEXT runtime·sysctl(SB),7,$28
|
||||
LEAL arg0+0(FP), SI
|
||||
LEAL 4(SP), DI
|
||||
|
@ -61,6 +61,11 @@ TEXT runtime·lwp_unpark(SB),7,$0
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·lwp_self(SB),7,$0
|
||||
MOVL $311, AX // sys__lwp_self
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// Exit the entire program (like C exit)
|
||||
TEXT runtime·exit(SB),7,$-8
|
||||
MOVL 8(SP), DI // arg 1 - exit status
|
||||
|
@ -28,6 +28,7 @@ extern int32 runtime·lwp_create(UcontextT *context, uintptr flags, void *lwpid)
|
||||
extern void runtime·lwp_mcontext_init(void *mc, void *stack, M *m, G *g, void (*fn)(void));
|
||||
extern int32 runtime·lwp_park(Timespec *abstime, int32 unpark, void *hint, void *unparkhint);
|
||||
extern int32 runtime·lwp_unpark(int32 lwp, void *hint);
|
||||
extern int32 runtime·lwp_self(void);
|
||||
|
||||
// From NetBSD's <sys/sysctl.h>
|
||||
#define CTL_HW 6
|
||||
@ -181,9 +182,6 @@ void
|
||||
runtime·osinit(void)
|
||||
{
|
||||
runtime·ncpu = getncpu();
|
||||
|
||||
// Main thread is always LWP 1.
|
||||
m->procid = 1;
|
||||
}
|
||||
|
||||
void
|
||||
@ -196,6 +194,8 @@ runtime·goenvs(void)
|
||||
void
|
||||
runtime·minit(void)
|
||||
{
|
||||
m->procid = runtime·lwp_self();
|
||||
|
||||
// Initialize signal handling
|
||||
m->gsignal = runtime·malg(32*1024);
|
||||
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
|
||||
|
Loading…
Reference in New Issue
Block a user