From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18626 invoked by alias); 14 Feb 2014 17:29:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18538 invoked by uid 89); 14 Feb 2014 17:29:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 14 Feb 2014 17:29:35 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 5A1C833F9D6; Fri, 14 Feb 2014 17:29:33 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Cc: Markus Metzger , jan.kratochvil@redhat.com, Mark Kettenis Subject: Re: [PATCH 1/2] i386-cpuid: add support for identifying a processor Date: Fri, 14 Feb 2014 17:29:00 -0000 Message-ID: <1912377.WkKB1rPacE@vapier> User-Agent: KMail/4.12.2 (Linux/3.13.0; KDE/4.12.2; x86_64; ; ) In-Reply-To: <1392294615-16416-1-git-send-email-markus.t.metzger@intel.com> References: <1392294615-16416-1-git-send-email-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5903312.NqxsIxNI8Q"; micalg="pgp-sha1"; protocol="application/pgp-signature" X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00506.txt.bz2 --nextPart5903312.NqxsIxNI8Q Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Content-length: 2272 On Thursday, February 13, 2014 13:30:14 Markus Metzger wrote: > --- /dev/null > +++ b/gdb/common/i386-cpuid.c > @@ -0,0 +1,74 @@ > +/* > + Copyright (C) 2014 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This file is free software; you can redistribute it and/or modify it > + under the terms of the GNU General Public License as published by the > + Free Software Foundation; either version 3, or (at your option) any > + later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see .= =20 > */ + > +#include "i386-cpuid.h" > + > +#if defined(__i386__) || defined(__x86_64__) > + > +/* See i386-cpuid.h. */ > + > +struct i386_cpu > +i386_this_cpu (void) > +{ > + struct i386_cpu cpu; > + unsigned int eax, ebx, ecx, edx; > + int ok; > + > + cpu.vendor =3D CV_UNKNOWN; > + > + ok =3D i386_cpuid (0, &eax, &ebx, &ecx, &edx); > + if (ok !=3D 0) > + { > + if (ebx =3D=3D signature_INTEL_ebx && ecx =3D=3D signature_INTEL_e= cx > + && edx =3D=3D signature_INTEL_edx) > + { > + unsigned int cpuid, ignore; > + > + ok =3D i386_cpuid (1, &cpuid, &ignore, &ignore, &ignore); > + if (ok !=3D 0) > + { > + cpu.vendor =3D CV_INTEL; > + > + cpu.family =3D (cpuid >> 8) & 0xf; > + cpu.model =3D (cpuid >> 4) & 0xf; > + cpu.stepping =3D cpuid & 0xf; > + > + if (cpu.family =3D=3D 0x6) > + cpu.model +=3D (cpuid >> 12) & 0xf0; > + } > + } > + } > + > + return cpu; > +} > + > +#else /* i386 && x86_64 */ > + > +/* See i386-cpuid.h. */ > + > +struct i386_cpu > +i386_this_cpu (void) > +{ > + struct i386_cpu cpu; > + > + cpu.vendor =3D CV_UNKNOWN; > + > + return cpu; > +} > + > +#endif /* i386 && x86_64 */ afaict, you don't need the #else. the non-x86 codepaths in i386-cpuid.h wi= ll=20 set the return value to 0, and your main code will treat this as an error a= nd=20 set cpu.vendor to CV_UNKNOWN. -mike= --nextPart5903312.NqxsIxNI8Q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJS/lJ/AAoJEEFjO5/oN/WBfWAQAMm1HhbkpARBlpKwfdjx9e1p p7e1b+gZAz7JYpWLYntDYNT2borDk8zw8Y3uoMqI4SHgYdroqbafkZ5EaDn2Gy17 dyxuExz1QErad2MOYb0mIo1bq0TBG6clYVvKIFEYq4LNmR7JNsadU/Ty4eRE1L2d Piy67ogRgic0rVLtVVMkJu9QEqqlMbHWjtOMU6K/RghKEIUBaiKhamlRzGsbIINS +UsstWMpffzJEd6JSTtl033XntPZ6e48c/SMlrT/rG+cqSbJNMEzbK7bvp5LbA0q 2OV//b5E6tZvCnfV3/G9sLOb9WPX+LoIV+Rnq82dRgQX24YdRrQTEuVWXb/c33pg uTMkb6xq2k1EfaSaGHqghSJecq6wjbHurV2679XqSiaQ2dokoXwgp47Lf+9UaISZ t8PlhRQJN6erOoCu22+Rvliy4FjfEj2axLzDJ0mNXFBnicItySjvP1phDYPhL4Cs 50YzMa9GoSnZL2BwlM8zN14yVT33a0zbegeWgVxmZqZUBjFewdg5ClvBBmo9WR+a 7qDDaIEixzVJpErZnMRsa85WxCNVLZxXPtc7FJQ/f1XaR9JyCgBLehaXk2LlkAl+ SItDxfL//ZOWBl7KrH9hJCcYpL3T2Si2fMjG+rFdrW2Brxg6aubfoIb4pDyu0t24 guXJfdoH+M/mNX1NXd6N =ph5H -----END PGP SIGNATURE----- --nextPart5903312.NqxsIxNI8Q--