[PATCH 2/2] sparc: Fix mistakenly cleared PSR[EF] bit.
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Jun 6 13:13:26 UTC 2019
Hello Maksim,
On 06/06/2019 14:43, Maksim Kozlov wrote:
> On Thu, 6 Jun 2019 at 09:57, Sebastian Huber
> <sebastian.huber at embedded-brains.de
> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>
>
>
> On 05/06/2019 21:22, Maksim E. Kozlov wrote:
> > ---
> > cpukit/score/cpu/sparc/cpu_asm.S | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/cpukit/score/cpu/sparc/cpu_asm.S
> b/cpukit/score/cpu/sparc/cpu_asm.S
> > index 2f3ad24510..69bbfb2748 100644
> > --- a/cpukit/score/cpu/sparc/cpu_asm.S
> > +++ b/cpukit/score/cpu/sparc/cpu_asm.S
> > @@ -682,10 +682,11 @@ isr_dispatch:
> > ld [%g6 + SPARC_PER_CPU_FP_OWNER_OFFSET], %l7
> > cmp %l6, %l7
> > bne .Ldisable_fp
> > - andn %l0, %l5, %l0
> > + nop
>
> Wouldn't it be sufficient to change this to
>
> bne,a .Ldisable_fp
> andn %l0, %l5, %l0
>
> ?
>
>
> Yes, you are right, this is my inattentiveness, and it is enough just
> to set
> an annul flag.
> If it is needed, I attached modified patch, but if you prefer, you can
> just add
> this flag yourself.
I still have problems to understand why this patch is necessary. The
current code is like this:
/*
* If we are still the floating point unit owner, then reset the
* floating point unit owner to NULL, otherwise clear PSR[EF]
in the
* interrupt frame and let the FP disabled system call do the
floating
* point context save/restore.
*/
ld [%g6 + SPARC_PER_CPU_FP_OWNER_OFFSET], %l7
cmp %l6, %l7
bne .Ldisable_fp
andn %l0, %l5, %l0
---> No matter what happens, the PSR[FP] is now cleared in %l0.
---> In this path we are the FPU owner and direct jump to ...
ba .Lthread_dispatch_done
st %g0, [%g6 + SPARC_PER_CPU_FP_OWNER_OFFSET]
.Ldisable_fp:
ba .Lthread_dispatch_done
st %l0, [%fp + ISF_PSR_OFFSET]
.Lnon_fp_thread_dispatch:
call SYM(_Thread_Do_dispatch)
mov %g6, %o0
---> ... here. From now on %l0 is no longer used and ...
#if SPARC_HAS_FPU == 1
.Lthread_dispatch_done:
#endif
[... %l0 not used ]
---> ... here it is loaded:
ldd [%fp + ISF_PSR_OFFSET], %l0 ! restore psr, PC
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list