Date: Wed, 3 Aug 2011 03:29:29 +0200 From: Robert Millan <rmh@debian.org> To: "Jayachandran C." <c.jayachandran@gmail.com> Cc: freebsd-mips@freebsd.org Subject: Re: [PATCH] Retrieval of TLS pointer via RDHWR Message-ID: <CAOfDtXP20PQfLbYyZNOHSjQb9QpJ3h81mjhQBk9kThkEyrrmRg@mail.gmail.com> In-Reply-To: <AANLkTi=n3zdHbDAypFqBtqSd_sr-mReXMjDzwQ9s5e3D@mail.gmail.com> References: <AANLkTimg3CUk0p8YPyepiumEHvKo2F6jdVA0=1CefYrQ@mail.gmail.com> <AANLkTikxHUj%2BGe3YyJOWMQne31D=uY_712Qveq=Dmh2A@mail.gmail.com> <AANLkTimyqAWFo5Ddd8_UAL654iGquCMnEjFETUnsFdxO@mail.gmail.com> <AANLkTi=nyXw3Tw-BnhAMwob4yP0-TSxeh5f_wEjtEfQ9@mail.gmail.com> <4D1A1B83.5070602@bsdimp.com> <AANLkTim1eqsA9xzPM9H48-3%2B1DKdDpUxrEE=YQ%2Bv-Vdh@mail.gmail.com> <AANLkTi=zjYMG-9P-EoxJjCz=ibUiXESbqLAq_D=e-X%2BN@mail.gmail.com> <4D1A5142.5090205@bsdimp.com> <AANLkTi=vNvPHw_gaKYkKRwTAvkNrLDbx%2BDC_3y9pUH-U@mail.gmail.com> <AANLkTinF4QWRWfZi_B3b=6RriD1k90j0qTiPcD9cvO6H@mail.gmail.com> <AANLkTi=n3zdHbDAypFqBtqSd_sr-mReXMjDzwQ9s5e3D@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2011/1/10 Jayachandran C. <c.jayachandran@gmail.com>: > |+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0trapframe->pc +=3D sizeof(int); > > This will mis-behave if the rdhwr is in a branch delay slot. You > should either signal 'SIGILL' in this case or do an emulate branch (if > the rdhwr is can be used in a branch delay slot). Excuse me for the delay in replying, I had to investigate to figure this out and didn't find the time. It appears that rdhwr is allowed in a branch delay slot, but since it is known to be more costly, GCC developers avoid using it there, see: http://gcc.gnu.org/ml/gcc/2006-07/msg00488.html http://gcc.gnu.org/ml/gcc/2006-07/msg00494.html So I guess it'll be best to emulate it for correctness, knowing that this path will seldom be used. What do you think? Another doubt I have is that I don't get the distinction between the trapframe here: struct thread *td =3D curthread; [...] struct trapframe *locr0 =3D td->td_frame; and this one: register_t trap(struct trapframe *trapframe) { Do both correspond to userland CPU context for current thread? Thanks! --=20 Robert Millan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXP20PQfLbYyZNOHSjQb9QpJ3h81mjhQBk9kThkEyrrmRg>