From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18954 invoked by alias); 2 Mar 2010 16:32:42 -0000 Received: (qmail 18933 invoked by uid 22791); 2 Mar 2010 16:32:41 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-ew0-f212.google.com (HELO mail-ew0-f212.google.com) (209.85.219.212) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Mar 2010 16:32:37 +0000 Received: by ewy4 with SMTP id 4so296291ewy.8 for ; Tue, 02 Mar 2010 08:32:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.88.139 with SMTP id a11mr306236wef.74.1267547554401; Tue, 02 Mar 2010 08:32:34 -0800 (PST) In-Reply-To: <201003021556.o22FubQt010861@glazunov.sibelius.xs4all.nl> References: <20100302152826.GA28158@intel.com> <201003021556.o22FubQt010861@glazunov.sibelius.xs4all.nl> Date: Tue, 02 Mar 2010 16:32:00 -0000 Message-ID: <6dc9ffc81003020832i5c133c56k9e74522fb2516f18@mail.gmail.com> Subject: Re: PATCH: Add common files for x86 XSAVE extended state From: "H.J. Lu" To: Mark Kettenis Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-03/txt/msg00055.txt.bz2 On Tue, Mar 2, 2010 at 7:56 AM, Mark Kettenis wro= te: >> Date: Tue, 2 Mar 2010 07:28:26 -0800 >> From: "H.J. Lu" >> >> Hi, >> >> This patch adds common files for x86 XSAVE extended state. They >> are used by native x86 gdb and gdbserver to discover x86 XSAVE >> extended state support. You can see IA32/Intel64 SDM at >> >> http://developer.intel.com/products/processor/manuals/index.htm >> >> for details. OK to install? > > Huh? =A0Where does this go? =A0What's the purpose of this? > >> 2010-03-02 =A0H.J. Lu =A0 >> >> =A0 =A0 =A0 * common/i386-cpuid.h: New. >> =A0 =A0 =A0 * common/i386-xstate.c: Likewise. >> =A0 =A0 =A0 * common/i386-xstate.h: Likewise. > They will be installed in gdb/common. Native gdb and gdbserver will use them to find: 1. If extended state is supported. 2. Which extended states are supported, SSE, AVX, .... 3. The size of extended state. It is used to allocate extended state buffer for ptrace. static const struct target_desc * i386_linux_read_description (struct target_ops *ops) { gdb_assert (i386_xstate.status !=3D XSTATE_UNKNOWN); if (have_ptrace_getregset =3D=3D -1) { int tid; unsigned long long xstateregs[i386_xstate.n_of_int64]; struct iovec iov; /* GNU/Linux LWP ID's are process ID's. */ tid =3D TIDGET (inferior_ptid); if (tid =3D=3D 0) tid =3D PIDGET (inferior_ptid); /* Not a threaded program. */ iov.iov_base =3D xstateregs; iov.iov_len =3D i386_xstate.size; /* Check if PTRACE_GETREGSET works. */ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) have_ptrace_getregset =3D 0; else { int i; have_ptrace_getregset =3D 1; /* Update the XSAVE extended state size for "gcore". */ for (i =3D 0; i386_linux_regset_sections[i].sect_name !=3D NULL; i++) if (strcmp (i386_linux_regset_sections[i].sect_name, ".reg-xstate") =3D=3D 0) { i386_linux_regset_sections[i].size =3D i386_xstate.size; break; } } } /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ if (have_ptrace_getregset && (i386_xstate.xcr0 & XSTATE_AVX_MASK) =3D=3D XSTATE_AVX_MASK) return tdesc_i386_avx_linux; else return tdesc_i386_linux; } void _initialize_i386_linux_nat (void) { ... i386_xstate_init (); } --=20 H.J.