Date: Fri, 3 Jan 1997 22:21:50 +1100 (EST) From: Douglas Thomas Crosher <dtc@scrooge.ee.swin.oz.au> To: freebsd-current@freebsd.org Subject: Re: i586-optimized copyin/out still broken Message-ID: <199701031121.WAA11316@scrooge.ee.swin.oz.au> In-Reply-To: <199701030215.NAA13793@godzilla.zeta.org.au> from "Bruce Evans" at Jan 3, 97 01:15:47 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> >>> Log:
> >>> Disabled i586-optimized copyin and copyout again. The fault handler
> >>> is still broken - it doesn't restore the floating point state.
>
> >Could this problem result in NaN being produced at wrong places.
>
> No, it causes kernel panics.
>
> >I filled a PR (2142) about it, maybe it could be closed then.
>
> That is much harder to fix. It is caused by the floating point state
> not being preserved across signal handlers. There are few, if any,
> valid and useful uses for floating point in signal handlers, because
> an ANSI signal handler must not make any accesses to a global object
> other than assignment to ones of type `volatile sig_atomic_t'. Thus
> preserving the state would mainly slow down signal handlers.
Will it solve the problem to add a FPU save/restore in the interrupt
handler when needed?
>From example using Martin's code example in PR 2142, the interrupt
handler would become:
void interrupt(int sig)
{
int n,i;
static int wieviel=0;
int fpu_state[27];
fpu_save(fpu_state); /* <<<<< */
setitimer(ITIMER_REAL,&timer1,&timerdummy);
bsdsignal(SIGALRM,(void *)(interrupt));
n=(int)((double)counter/(double)max*(double)80);
for (i=wieviel;i<n;i++) {
fputc(' ',stderr);
wieviel++;
}
fpu_restore(fpu_state); /* <<<<< */
}
-=-=-
.text
.global _fpu_save
.type _fpu_save,@function
.align 2,0x90
_fpu_save:
movl 4(%esp),%eax
fnsave (%eax) # Save the NPX state - Resets NPX
ret
.size _fpu_save,.-_fpu_save
.global _fpu_restore
.type _fpu_restore,@function
.align 2,0x90
_fpu_restore:
movl 4(%esp),%eax
frstor (%eax) # Restore the NPX state.
ret
.size _fpu_restore,.-_fpu_restore
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701031121.WAA11316>
