On Tue, 17 Jul 2001 [EMAIL PROTECTED] wrote:

> > I want all use of the cpu number removed.  It seems to be just to avoid
> > alignment problems that shouldn't happen in practice (the save area
> > should always be suitably aligned if it isn't already, and I think it
> > is already).
> The pcb_save area has the proper alignment but the dummy variable used
> in npxinit might not have the proper alignment when on the stack.

I see.  __attribute__((__^H^Haligned(16))) doesn't actually work even for
gcc because we use -mpreferred-stack-boundary=2 for the kernel.

The dummy variable should go away for other reasons: the dummy npxsave()
has no effect except possibly for the first call (from npxattach()) and
the second call (for the first call from setregs()).  For subsequent
calls from setregs(), the state must have already been saved in the pcb
of the previous owner of the CPU, or else we would be stealing the state
from the current owner.

> The enclosed patch should be a step in the right direction.

Yes, please commit it.

> @@ -926,30 +926,21 @@
>  fpusave(addr)
>       union savefpu *addr;
>  {
> -     static struct savexmm svxmm[MAXCPU];
> -     u_char oncpu = PCPU_GET(cpuid);
>       if (!cpu_fxsr)
>               fnsave(addr);
> -     else {
> -             fxsave(&svxmm[oncpu]);
> -             bcopy(&svxmm[oncpu], addr, sizeof(struct savexmm));
> -     }
> +     else
> +             fxsave(addr);
>  }

I like to use the conditional operator for simple conditionals like this:

        (cpu_fxsr ? fxsave : fnsave)(addr);


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to