mirror of git://gcc.gnu.org/git/gcc.git
runtime: provide initcontext and fixcontext for NetBSD
From-SVN: r193173
This commit is contained in:
parent
ae0b23e2ff
commit
0be1a5898f
|
|
@ -110,6 +110,28 @@ fixcontext(ucontext_t* c)
|
||||||
c->uc_mcontext.gregs[REG_FSBASE] = fs;
|
c->uc_mcontext.gregs[REG_FSBASE] = fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# elif defined(__NetBSD__)
|
||||||
|
|
||||||
|
// NetBSD has a bug: setcontext clobbers tlsbase, we need to save
|
||||||
|
// and restore it ourselves.
|
||||||
|
|
||||||
|
static __thread __greg_t tlsbase;
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
initcontext(void)
|
||||||
|
{
|
||||||
|
ucontext_t c;
|
||||||
|
|
||||||
|
getcontext(&c);
|
||||||
|
tlsbase = c.uc_mcontext._mc_tlsbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
fixcontext(ucontext_t* c)
|
||||||
|
{
|
||||||
|
c->uc_mcontext._mc_tlsbase = tlsbase;
|
||||||
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
||||||
# error unknown case for SETCONTEXT_CLOBBERS_TLS
|
# error unknown case for SETCONTEXT_CLOBBERS_TLS
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue