[Gmp-commit] /var/hg/gmp-5.0: mpn/x86_64/fat/fat.c: abort iff longmode-capabl...

mercurial at gmplib.org mercurial at gmplib.org
Sun May 27 09:46:51 CEST 2012


details:   /var/hg/gmp-5.0/rev/ffdad0cda019
changeset: 13582:ffdad0cda019
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun May 27 09:42:04 2012 +0200
description:
mpn/x86_64/fat/fat.c: abort iff longmode-capable-bit is turned off.

diffstat:

 ChangeLog            |   4 ++++
 mpn/x86_64/fat/fat.c |  43 +++++++++----------------------------------
 2 files changed, 13 insertions(+), 34 deletions(-)

diffs (100 lines):

diff -r 5e296f996b87 -r ffdad0cda019 ChangeLog
--- a/ChangeLog	Thu May 24 14:26:27 2012 +0200
+++ b/ChangeLog	Sun May 27 09:42:04 2012 +0200
@@ -1,3 +1,7 @@
+2012-05-27 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/x86_64/fat/fat.c: abort iff longmode-capable-bit is turned off.
+
 2012-05-24  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpz/n_pow_ui.c: Cast non-limb count_leading_zeros argument.
diff -r 5e296f996b87 -r ffdad0cda019 mpn/x86_64/fat/fat.c
--- a/mpn/x86_64/fat/fat.c	Thu May 24 14:26:27 2012 +0200
+++ b/mpn/x86_64/fat/fat.c	Sun May 27 09:42:04 2012 +0200
@@ -1,4 +1,4 @@
-/* x86 fat binary initializers.
+/* x86_64 fat binary initializers.
 
    Contributed to the GNU project by Kevin Ryde (original x86_32 code) and
    Torbjorn Granlund (port to x86_64)
@@ -7,7 +7,7 @@
    THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
    COMPLETELY IN FUTURE GNU MP RELEASES.
 
-Copyright 2003, 2004, 2009, 2011 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2009, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -187,6 +187,11 @@
   family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
   model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
 
+  /* Check extended feature flags */
+  __gmpn_cpuid (dummy_string, 0x80000001);
+  if ((dummy_string[4 + 29 / 8] & (1 << (29 - 3 * 8))) == 0)
+    abort (); /* longmode-capable-bit turned off! */
+
   /*********************************************************/
   /*** WARNING: keep this list in sync with config.guess ***/
   /*********************************************************/
@@ -194,30 +199,9 @@
     {
       switch (family)
 	{
-	case 4:
-	case 5:
-	  abort ();		/* 32-bit processors */
-
 	case 6:
 	  switch (model)
 	    {
-	    case 0x00:
-	    case 0x01:
-	    case 0x02:
-	    case 0x03:
-	    case 0x04:
-	    case 0x05:
-	    case 0x06:
-	    case 0x07:
-	    case 0x08:
-	    case 0x09:		/* Banias */
-	    case 0x0a:
-	    case 0x0b:
-	    case 0x0c:
-	    case 0x0d:		/* Dothan */
-	    case 0x0e:		/* Yonah */
-	      abort ();		/* 32-bit processors */
-
 	    case 0x0f:		/* Conroe Merom Kentsfield Allendale */
 	    case 0x10:
 	    case 0x11:
@@ -276,10 +260,6 @@
     {
       switch (family)
 	{
-	case 5:
-	case 6:
-	  abort ();
-
 	case 15:		/* k8 */
 	case 16:		/* k10 */
 	  /* CPUVEC_SETUP_athlon */
@@ -290,14 +270,9 @@
     {
       switch (family)
 	{
-	case 5:
-	  abort ();		/* 32-bit processors */
-
 	case 6:
-	  if (model < 15)
-	    abort ();		/* 32-bit processors */
-
-	  CPUVEC_SETUP_nano;
+	  if (model >= 15)
+	    CPUVEC_SETUP_nano;
 	  break;
 	}
     }


More information about the gmp-commit mailing list