From owner-freebsd-current Tue Jul 17 3:48:12 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 44D9D37B403; Tue, 17 Jul 2001 03:48:08 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA22434; Tue, 17 Jul 2001 20:47:40 +1000 Date: Tue, 17 Jul 2001 20:45:25 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Tor.Egge@fast.no Cc: juriy@aviaport.ru, freebsd-current@FreeBSD.ORG, peter@FreeBSD.ORG Subject: Re: kernel with SSE is unstable In-Reply-To: <200107170951.LAA72393@midten.fast.no> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 17 Jul 2001 Tor.Egge@fast.no 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); Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message