From patchwork Tue Apr 16 04:06:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 789207 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp104763wrb; Mon, 15 Apr 2024 21:07:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV4nXSrVRodZua5iSEb4Eau9EjpzHTFxrDzTOEExXioL9M1i2zrh01OzG9qgzSiumYiQN75a9eMl0HBL/8neHSV X-Google-Smtp-Source: AGHT+IG9XRDxmXCmraBhbqQbO0SLnZ+7ZWsjq1q1d27wrUTdmNFrTqHTPnkkDPdNl98j3mV3iXE1 X-Received: by 2002:a05:622a:a027:b0:437:3729:41ed with SMTP id jt39-20020a05622aa02700b00437372941edmr1868066qtb.0.1713240446048; Mon, 15 Apr 2024 21:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713240446; cv=none; d=google.com; s=arc-20160816; b=KU8CUua9YpVWzkItRElkpsfD1Slayu37BvzF5dY3R6UnvBxi8qdxNz8Xb+J95rFhnQ lN+/eztVoZFt/54cSKmomm3AefcGvQMS5uFnpIJYblwSJ0V3N9nuXnxNTqY2NQgDKdo6 fIDTh4ItlGHg5WY853vIyJHs4Tm4qN/qcJRH/FiqHWSFAYA/VXpVsEo1QRwuRQJSR6FH R6Gv0IhsEvmSom1p9nKUNDL8PuHgxmQfEls+mwJSZYZSwmR6olz+UY+FkJnrwCMVUaD9 WiVEXdZS5eO3QxkKSKYCDGVf3DjyHt6dqemnsD15CDHZcS69CdLMKvQWp5/8qxqH1c34 q7AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cliU8saQcbFVDKE5SoNvV+Ccq9QeWmSvOygbDeWVqyc=; fh=HGMLmPLDRBgS2M2DmRioi6Q+pUL3jqoEM8UtJkY6Dtg=; b=MVF7DMwmeD36vqS+YBiKizKBxqYq/0+VA7WorcHRBt6hrUkc3OfS4atpb5ja1Gd7xY jLEpm2RnF8x79V8kIhAiZ7UAgjjYvfEGcfaNbmUU9gcdy3A/LZhHsxDdjQNhsXLWbOQE e/SOM9Z1i03tNsRTji9aGlJ5DrieAOKin0BDIDM1/5fbIkudhvUw8kFAeJzNlp7Um/d7 adpGg7rurCilCTVKtURkWRjzSxK63nrSa5DXTpkBkNfNZvBtSnY/uCNuZKEamJahiQOH Tf+Lbs/eshbz88jVM4YvawZKzhLM2mq8JXSHw90oEc2N54KRyMJpgaOY7ohhp1t17Ufg Kkdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=luzu0gxg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12-20020a05622a14cc00b00434587753a0si11643416qtx.119.2024.04.15.21.07.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Apr 2024 21:07:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=luzu0gxg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwa5O-0008FA-Ni; Tue, 16 Apr 2024 00:06:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwa5L-00086k-Vk for qemu-devel@nongnu.org; Tue, 16 Apr 2024 00:06:20 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwa5K-0007AS-1A for qemu-devel@nongnu.org; Tue, 16 Apr 2024 00:06:19 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1e2c725e234so35216825ad.1 for ; Mon, 15 Apr 2024 21:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713240375; x=1713845175; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cliU8saQcbFVDKE5SoNvV+Ccq9QeWmSvOygbDeWVqyc=; b=luzu0gxgEWpKRlZGu5XpCFtm6bU5c27OYDieBqxPoxVX0KE77Z2oL5dTwpC10j14VQ WWvM/jur3wZh1f7J2IPhklnQeCjUp/MOpUNGb6T5zeBsAxFXBxaw3p43wZJW4JTl4zox HW0KBYDfkKuDwrxgxv3aI/M9Th+BtWSpVRhCoXcdmXuF2N8u1anHUr1azZyd3FXurdUR KhNnAYnkm4BQaqGvFrFguPqa+DxaENiX1t6IEdmfCGnHnZpkH19k6aj/53z0mz2hZy6v mVf7oElgr3QfszFtVlb9XytDuu/TPJghoI4+3GRXiwr6mtmtbFNC1aRJhwnlHYLi0A7W 4kBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713240375; x=1713845175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cliU8saQcbFVDKE5SoNvV+Ccq9QeWmSvOygbDeWVqyc=; b=P2bbQIvH1OGu1Pp00FIiipBpHLOq0bYkTfhxAWc/DR8wdYY+kslu0QFQdhXBQvUDW9 5df8xP2NvXyMQd8WiIHAbLguJe2eK3VAjmKrqp41mJzsnaQD8BGN2AxaqmS/OwiLOW0M lmYSGNL3dNmvC1/OnUE35ISd7QyG/5ixByzc0gK83BHI4/1y5RAz0wN5Cu9FoevarFeI uVuXFezEDxVjQfesLG2/sTx745330U7lN9C8GgNxRE5t9DGVxpUDTJSFB2uPhlCdmQG+ BgMtKpdRqHlNQk/68oh+oBhyptzE9fFGN5OboEq+Uc0N1kW+rifnacTWAAYbTI2+uN8g AKDg== X-Gm-Message-State: AOJu0YzeqxsYX1aImKuM+uMG6Rsrald/Nuy5utfuZQJR5sTvjY6DXrsm EP+DZ12CD7sd9nyqzfQRp+44hQLxGHMCsaujRUwDdOp3HWWuFX6I+P73hK1dV40f6rm/3UnFJyG D X-Received: by 2002:a17:902:e741:b0:1e5:5c69:fcda with SMTP id p1-20020a170902e74100b001e55c69fcdamr2235414plf.26.1713240375547; Mon, 15 Apr 2024 21:06:15 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id l1-20020a170902f68100b001e3e244e5c0sm8694439plg.78.2024.04.15.21.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 21:06:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pierrick.bouvier@linaro.org Subject: [PATCH 5/7] target/i386: Split out gdb-internal.h Date: Mon, 15 Apr 2024 21:06:07 -0700 Message-Id: <20240416040609.1313605-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416040609.1313605-1-richard.henderson@linaro.org> References: <20240416040609.1313605-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- target/i386/gdb-internal.h | 65 ++++++++++++++++++++++++++++++++++++++ target/i386/gdbstub.c | 1 + 2 files changed, 66 insertions(+) create mode 100644 target/i386/gdb-internal.h diff --git a/target/i386/gdb-internal.h b/target/i386/gdb-internal.h new file mode 100644 index 0000000000..7cf4c1a656 --- /dev/null +++ b/target/i386/gdb-internal.h @@ -0,0 +1,65 @@ +/* + * x86 gdb server stub + * + * Copyright (c) 2003-2005 Fabrice Bellard + * Copyright (c) 2013 SUSE LINUX Products GmbH + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef I386_GDB_INTERNAL_H +#define I386_GDB_INTERNAL_H + +/* + * Keep these in sync with assignment to + * gdb_num_core_regs in target/i386/cpu.c + * and with the machine description + */ + +/* + * SEG: 6 segments, plus fs_base, gs_base, kernel_gs_base + */ + +/* + * general regs -----> 8 or 16 + */ +#define IDX_NB_IP 1 +#define IDX_NB_FLAGS 1 +#define IDX_NB_SEG (6 + 3) +#define IDX_NB_CTL 6 +#define IDX_NB_FP 16 +/* + * fpu regs ----------> 8 or 16 + */ +#define IDX_NB_MXCSR 1 +/* + * total ----> 8+1+1+9+6+16+8+1=50 or 16+1+1+9+6+16+16+1=66 + */ + +#define IDX_IP_REG CPU_NB_REGS +#define IDX_FLAGS_REG (IDX_IP_REG + IDX_NB_IP) +#define IDX_SEG_REGS (IDX_FLAGS_REG + IDX_NB_FLAGS) +#define IDX_CTL_REGS (IDX_SEG_REGS + IDX_NB_SEG) +#define IDX_FP_REGS (IDX_CTL_REGS + IDX_NB_CTL) +#define IDX_XMM_REGS (IDX_FP_REGS + IDX_NB_FP) +#define IDX_MXCSR_REG (IDX_XMM_REGS + CPU_NB_REGS) + +#define IDX_CTL_CR0_REG (IDX_CTL_REGS + 0) +#define IDX_CTL_CR2_REG (IDX_CTL_REGS + 1) +#define IDX_CTL_CR3_REG (IDX_CTL_REGS + 2) +#define IDX_CTL_CR4_REG (IDX_CTL_REGS + 3) +#define IDX_CTL_CR8_REG (IDX_CTL_REGS + 4) +#define IDX_CTL_EFER_REG (IDX_CTL_REGS + 5) + +#endif diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index ebb000df6a..9662509b82 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "include/gdbstub/helpers.h" +#include "gdb-internal.h" #ifdef TARGET_X86_64 static const int gpr_map[16] = {