From patchwork Thu Jun 6 03:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801970 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp96321wro; Wed, 5 Jun 2024 20:30:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWeRajsofBcS6rgDRW1okRKFDthrzBT7k79RDGENzqsAyftRWa/WgpkSazoqd5dz+h0oI3EGJNFqOCwFEvrG5Ep X-Google-Smtp-Source: AGHT+IHNPZzbKDOMTxbZYBBOaCsj2jEFSpZlvaA3qTqGUdZicP7eb1Bz0NVF8I/5zIC45duooHAQ X-Received: by 2002:a05:6830:4b9:b0:6f8:e8e1:ae73 with SMTP id 46e09a7af769-6f943483f2amr5158654a34.20.1717644614928; Wed, 05 Jun 2024 20:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717644614; cv=none; d=google.com; s=arc-20160816; b=AG2znvMkuT032NaSTI3tVLhBtUPlriPAuAN5GjEvHtbP8jsvMkm7rYSdamlhaSHw3Y SZgmlVCs7WauvN1bD5BPP2mxmC/OUYHKZVrT2UzYl8MoM0uyn5bytxA5TydnqTChMEp/ /YKmmhTzG/BpVw85ooGArNoUCnL0YrfG5cYq2tyg8FdSl5EKXs5UnjvNhXzEqn0R6mic YFzpkq2bcPbMWfWO02RKWL8iXUgkgpYdvjAydLanB8cYoogAymIm3izVDqCA2VoHcxAu YAO16cCAAVeCNjf4UjsGKnCThgsLubxYl0g0LUyAikFhzQmYQJsa/udHD8yx26lgczqt k8Yg== 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=1OdJEwOKA51hh/7jatyHlydDt1TQ7phcNBkbolfhN74=; fh=DfUxOGz7MnM49MBgqH5VPROGi+97fYtPWhcEZCG1Y5Q=; b=NY/4wN+hlih64GBJaD4UAHXyy+b9JRMNcum8Z4nYhA1P/QMIObp/e2Pxb/PhmQkdFN S3nU4EXxBWyGabBqyxSvcxHSMbAd0CMV6W6ZOOVhNxpsVzKdINruEZ/xxr0uj7hho7VN obAMRf7omX65h3zdPh21BGUoawUHnPR3IXXCnzsHrAfVJk5Wotam2yUuhPPNdPuBv6Qt 9x+KLbuQIMKcYyAskMmIZD2ta28VftiaGUK16OqIPlF4E9dUXMWXiCqnzNq3CLGLCklO AhOXO/u1OlD+YKLyotIMIVWfb/WHfLeXLjleJwkQnrIKSGFxvYc6pBY4cshoI3PHnpK9 A++w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CSM/W7SI"; 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 af79cd13be357-7953284d886si50310285a.13.2024.06.05.20.30.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 20:30:14 -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="CSM/W7SI"; 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 1sF3p5-0003cj-FN; Wed, 05 Jun 2024 23:29:55 -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 1sF3or-0003X8-7r for qemu-devel@nongnu.org; Wed, 05 Jun 2024 23:29:41 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sF3ok-0003mU-6r for qemu-devel@nongnu.org; Wed, 05 Jun 2024 23:29:40 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-6ce533b6409so345279a12.1 for ; Wed, 05 Jun 2024 20:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717644572; x=1718249372; 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=1OdJEwOKA51hh/7jatyHlydDt1TQ7phcNBkbolfhN74=; b=CSM/W7SIRu8RNzQ4aHIKpWqNjK6iGijmrnrDw/9SNv6kjVmkzAlfu8aE6+bbsVzl38 XEFE3Eoi6WOGy4I7BkdIndyARf6kOxC7VVRGAVRtL6LSIl2h9G3QkkxxbAYD+tKpykjU T32rwQ66cjAbt1fAUegK5j5FFPXn2SUdfEygm7WgSgXQS98zk51FQnAzhfGWAD1GmfOV aQachKpEATxznCXXkguETMqnyNS5MQ474KoFJq4i+GVzssKlSAX5ruaDOUNgKOc+RngY 3tkJM8fwAp7VtE360Xl+qHDdnslyr+CuH2Vq4ngKkLSSZ55b9bsgBDrxuRzLKyHqmZa9 oo6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717644572; x=1718249372; 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=1OdJEwOKA51hh/7jatyHlydDt1TQ7phcNBkbolfhN74=; b=m5amh1UJUIQ/W4CH7e2rdr54Yaxh5FWmj+XrGvGz+LuoDWRwfZZmEjknBybZecLjeQ Ol6P2RLcfwWplNFTO9hk9Ot0xacGhwxrUcQjHSgD5JJaGUEMwW+D8dMAxuDnzs2M+kbX 3TJZeiFBN71udb1d9gn3+FplMds9olbA6M+HjI/MA1xvkn29rM4goezWRmpKjU3WQAbY OifZUeBKy7a/Fb2pMfPsOqqGd3jGruiaVb2JfU2H2RT3Zc+0iJGN4uRk4xkB3yBleopU ZqHqplIFQKXy3Z0B789QaJ1Z9vAPvQnXe22zWiPzNBnrqRyMnBBmbyiD0n4BSgvS5yiH Utcg== X-Gm-Message-State: AOJu0YyQiZpLqduw6pNzj9vDwBgfdhfG2Z+OwOHBjtZjcOlgMj2vPVjX eAFiLBwGFywxj1xMV9RnrjZdgdyg1zCGY7crq3+XwfcmWqVe5WMEQt6tGR5VQuUbsn31HUZLa5P g X-Received: by 2002:a17:90a:e547:b0:2c2:792c:b5c4 with SMTP id 98e67ed59e1d1-2c27daf9835mr4356506a91.10.1717644572360; Wed, 05 Jun 2024 20:29:32 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c254a76729sm4826265a91.0.2024.06.05.20.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 20:29:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pierrick.bouvier@linaro.org, alex.bennee@linaro.org Subject: [PATCH v2 5/9] target/i386: Split out gdb-internal.h Date: Wed, 5 Jun 2024 20:29:22 -0700 Message-Id: <20240606032926.83599-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606032926.83599-1-richard.henderson@linaro.org> References: <20240606032926.83599-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Reviewed-by: Alex Bennée Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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 4acf485879..96b4382a5d 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "gdbstub/helpers.h" +#include "gdb-internal.h" #ifdef TARGET_X86_64 static const int gpr_map[16] = {