From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25621 invoked by alias); 27 Nov 2012 13:05:33 -0000 Received: (qmail 25597 invoked by uid 22791); 27 Nov 2012 13:05:31 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_LV X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Nov 2012 13:05:18 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qARD59Tc018833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Nov 2012 08:05:13 -0500 Received: from host2.jankratochvil.net (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qARD51Af023051 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 27 Nov 2012 08:05:06 -0500 Date: Tue, 27 Nov 2012 13:05:00 -0000 From: Jan Kratochvil To: markus.t.metzger@intel.com Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com, palves@redhat.com, tromey@redhat.com, kettenis@gnu.org Subject: Re: [patch v4 13/13] btrace, x86: restrict to Atom Message-ID: <20121127130500.GA22431@host2.jankratochvil.net> References: <1354013351-14791-1-git-send-email-markus.t.metzger@intel.com> <1354013351-14791-14-git-send-email-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1354013351-14791-14-git-send-email-markus.t.metzger@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-11/txt/msg00723.txt.bz2 On Tue, 27 Nov 2012 11:49:11 +0100, markus.t.metzger@intel.com wrote: > 2012-11-27 Markus Metzger > > * amd64-linux-nat.c (amd64_linux_supports_btrace): New. > (_initialize_amd64_linux_nat): Change supports_btrace method. > * i386-linux-nat.c (i386_linux_supports_btrace): New. > (_initialize_i386_linux_nat): Change supports_btrace method. There is i386-nat.c for the common functions between these two files. > --- a/gdb/gdbserver/linux-x86-low.c > +++ b/gdb/gdbserver/linux-x86-low.c > @@ -1859,6 +1859,36 @@ x86_get_min_fast_tracepoint_insn_len (void) > } > } > > +/* See linux-low.h. */ > +static int > +x86_supports_btrace (void) > +{ > + unsigned int cpuid, model, family; > + > + __asm__ __volatile__ ("movl $1, %%eax;" > + "cpuid;" > + : "=a" (cpuid) > + :: "%ebx", "%ecx", "%edx"); As Mark Kettenis expressed issue with '__asm__ __volatile__' here and I also have some uncertainty about its compatibility (*), as it is in linux-* file anyway I wound find more safe and more common style in GDB to just read and parse "/proc/cpuinfo", (*) Although probably any Linux compiler needst so support it the GCC compatible way, incl. llvm and icc. > + > + family = (cpuid >> 8) & 0xf; > + model = (cpuid >> 4) & 0xf; > + > + switch (family) > + { > + case 6: > + model += (cpuid >> 12) & 0xf0; > + > + switch (model) > + { Here should be tab, not 8 spaces. > + case 28: /* Atom. */ > + case 38: In some instances of this function you list 39 and in other instances you do not. (My i7-2620M model 42 is probably a buggy one although it seems to work.) Thanks, Jan