From owner-cvs-all@FreeBSD.ORG Mon Jun 7 09:43:30 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 57ECB16A4CE; Mon, 7 Jun 2004 09:43:30 +0000 (GMT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 3E81743D53; Mon, 7 Jun 2004 09:43:29 +0000 (GMT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 7 Jun 2004 10:43:21 +0100 (BST) Date: Mon, 7 Jun 2004 10:43:21 +0100 From: David Malone To: src-committers@FreeBSD.ORG, cvs-src@FreeBSD.ORG, cvs-all@FreeBSD.ORG Message-ID: <20040607094321.GA32159@walton.maths.tcd.ie> References: <200406060916.i569G2m2097113@repoman.freebsd.org> <20040606091758.GA6354@VARK.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040606091758.GA6354@VARK.homeunix.com> User-Agent: Mutt/1.5.3i Sender: dwmalone@maths.tcd.ie Subject: Re: cvs commit: src/sys/amd64/amd64 fpu.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2004 09:43:30 -0000 On Sun, Jun 06, 2004 at 02:17:58AM -0700, David Schultz wrote: > It would be great if someone could pick this up and devise the > appropriate fix. I want to see this bug fixed, but I don't have the > hardware to do amd64 kernel hacking. I'm happy to help anyone who is > interested. I think I've figured out the problem. On SMP systems, fpuinit() is called before enable_sse() for secondary processors. The ldmxcsr instruction counts as a sse instruction, so you get an illegal instruction fault. The patch below switches the order of fpuinit() and enable_sse() and fixes the problem on my system anyway. David. Index: mp_machdep.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/sys/amd64/amd64/mp_machdep.c,v retrieving revision 1.237 diff -u -r1.237 mp_machdep.c --- mp_machdep.c 16 May 2004 22:11:50 -0000 1.237 +++ mp_machdep.c 7 Jun 2004 09:36:08 -0000 @@ -429,12 +429,12 @@ /* set up CPU registers and state */ cpu_setregs(); - /* set up FPU state on the AP */ - fpuinit(); - /* set up SSE registers */ enable_sse(); + /* set up FPU state on the AP */ + fpuinit(); + /* A quick check from sanity claus */ if (PCPU_GET(apic_id) != lapic_id()) { printf("SMP: cpuid = %d\n", PCPU_GET(cpuid));