threadentry(void *v)
{
ThreadStart ts;
+ stack_t ss;
ts = *(ThreadStart*)v;
free(v);
*/
setg_gcc((void*)ts.g);
+ // On DragonFly, a new thread inherits the signal stack of the
+ // creating thread. That confuses minit, so we remove that
+ // signal stack here before calling the regular mstart. It's
+ // a bit baroque to remove a signal stack here only to add one
+ // in minit, but it's a simple change that keeps DragonFly
+ // working like other OS's. At this point all signals are
+ // blocked, so there is no race.
+ memset(&ss, 0, sizeof ss);
+ ss.ss_flags = SS_DISABLE;
+ sigaltstack(&ss, nil);
+
crosscall_amd64(ts.fn);
return nil;
}
threadentry(void *v)
{
ThreadStart ts;
+ stack_t ss;
ts = *(ThreadStart*)v;
free(v);
*/
setg_gcc((void*)ts.g);
+ // On NetBSD, a new thread inherits the signal stack of the
+ // creating thread. That confuses minit, so we remove that
+ // signal stack here before calling the regular mstart. It's
+ // a bit baroque to remove a signal stack here only to add one
+ // in minit, but it's a simple change that keeps NetBSD
+ // working like other OS's. At this point all signals are
+ // blocked, so there is no race.
+ memset(&ss, 0, sizeof ss);
+ ss.ss_flags = SS_DISABLE;
+ sigaltstack(&ss, nil);
+
crosscall_386(ts.fn);
return nil;
}
threadentry(void *v)
{
ThreadStart ts;
+ stack_t ss;
ts = *(ThreadStart*)v;
free(v);
*/
setg_gcc((void*)ts.g);
+ // On NetBSD, a new thread inherits the signal stack of the
+ // creating thread. That confuses minit, so we remove that
+ // signal stack here before calling the regular mstart. It's
+ // a bit baroque to remove a signal stack here only to add one
+ // in minit, but it's a simple change that keeps NetBSD
+ // working like other OS's. At this point all signals are
+ // blocked, so there is no race.
+ memset(&ss, 0, sizeof ss);
+ ss.ss_flags = SS_DISABLE;
+ sigaltstack(&ss, nil);
+
crosscall_amd64(ts.fn);
return nil;
}
threadentry(void *v)
{
ThreadStart ts;
+ stack_t ss;
ts = *(ThreadStart*)v;
free(v);
+ // On NetBSD, a new thread inherits the signal stack of the
+ // creating thread. That confuses minit, so we remove that
+ // signal stack here before calling the regular mstart. It's
+ // a bit baroque to remove a signal stack here only to add one
+ // in minit, but it's a simple change that keeps NetBSD
+ // working like other OS's. At this point all signals are
+ // blocked, so there is no race.
+ memset(&ss, 0, sizeof ss);
+ ss.ss_flags = SS_DISABLE;
+ sigaltstack(&ss, nil);
+
crosscall_arm1(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
uc.uc_link = nil
uc.uc_sigmask = sigset_all
- lwp_mcontext_init(&uc.uc_mcontext, stk, mp, mp.g0, funcPC(mstart))
+ lwp_mcontext_init(&uc.uc_mcontext, stk, mp, mp.g0, funcPC(netbsdMstart))
ret := lwp_create(unsafe.Pointer(&uc), 0, unsafe.Pointer(&mp.procid))
if ret < 0 {
}
}
+// netbsdMStart is the function call that starts executing a newly
+// created thread. On NetBSD, a new thread inherits the signal stack
+// of the creating thread. That confuses minit, so we remove that
+// signal stack here before calling the regular mstart. It's a bit
+// baroque to remove a signal stack here only to add one in minit, but
+// it's a simple change that keeps NetBSD working like other OS's.
+// At this point all signals are blocked, so there is no race.
+//go:nosplit
+func netbsdMstart() {
+ signalstack(nil)
+ mstart()
+}
+
func osinit() {
ncpu = getncpu()
}
MOVQ R13, g_m(DI)
MOVQ DI, g(CX)
+ // On DragonFly, a new thread inherits the signal stack of the
+ // creating thread. That confuses minit, so we remove that
+ // signal stack here before calling the regular mstart. It's
+ // a bit baroque to remove a signal stack here only to add one
+ // in minit, but it's a simple change that keeps DragonFly
+ // working like other OS's. At this point all signals are
+ // blocked, so there is no race.
+ SUBQ $8, SP
+ MOVQ $0, 0(SP)
+ CALL runtime·signalstack(SB)
+ ADDQ $8, SP
+
CALL runtime·stackcheck(SB)
CALL runtime·mstart(SB)