From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2604 invoked by alias); 4 Mar 2010 18:02:28 -0000 Received: (qmail 2400 invoked by uid 22791); 4 Mar 2010 18:02:27 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM X-Spam-Check-By: sourceware.org Received: from mga06.intel.com (HELO orsmga101.jf.intel.com) (134.134.136.21) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Mar 2010 18:02:21 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 04 Mar 2010 09:59:18 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.107]) by orsmga001.jf.intel.com with ESMTP; 04 Mar 2010 10:02:00 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 42EFB81239A; Thu, 4 Mar 2010 10:02:19 -0800 (PST) Date: Thu, 04 Mar 2010 18:02:00 -0000 From: "H.J. Lu" To: GDB Subject: PATCH: 1/6: Add AVX support Message-ID: <20100304180219.GA10826@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) 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/msg00196.txt.bz2 AVX registers are saved and restored via the XSAVE extended state. The extended control register 0 (the XFEATURE_ENABLED_MASK register), XCR0, is used to determine which states, x87, SSE, AVX, ... are supported in the XSAVE extended state. XCR0 can be read with the new "xgetbv" instruction. The xstate_bv field at byte offset 512 in the XSAVE extended state indicates what states the current process is in. If the feature bit is cleared, the corresponding registers should be read as 0. If we update a register, we should set the corresponding feature bit. We added PTRACE_GETREGSET and PTRACE_SETREGSET to Linux kernel to fetch and store AVX registers with ptrace. Linux kernel also stores XCR0 at the first 8 bytes of the software usable bytes, starting at byte offset 464. There are total 6 patches to add AVX support for Linux. The first patch to provide AVX XML target decriptions is at http://sourceware.org/ml/gdb-patches/2010-03/msg00092.html They support: 1. Backward compatible. If AVX isn't supported, SSE will be used. 2. Forward compatible. If new state beyond AVX is supported in the XSAVE extended state, only AVX state will be used. 3. XMM pseudo register. When AVX is available, $xmmX can be used to access the lower 128bit of $ymmX. 4. Remote gdb protocol extension. GDB will send x86:xstate=BYTES:xcr0=VALUE in qSupported request packet to indicate that GDB supports x86 XSAVE extended state. BYTES specifies the maximum size in bytes of x86 XSAVE extended state GDB supports. VALUE specifies the maximum value of XCR0 GDB supports. Gdbserver will select the best target description supported by GDB, based on BYTES and VALUE. The older gdbserver will always return SSE target. To support AVX on other OSes, the following changes are needed: 1. Kernel support to get/set the XSAVE extended state. 2. Provide target to_read_description to return SSE or AVX target description. 3. Update gdbarch_core_read_description to return SSE or AVX target description based on contents of core dump. H.J.