From nobody Fri Apr 4 04:08:51 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1740806955; cv=none; d=zohomail.com; s=zohoarc; b=SbDpRjfsulR667uj86p5KftRsvi2D3UOkcXAImbW8g3FdwhvLdP9W7qSZatDJlW7xdalUrF+pZ3R3ViNkORnOqS5WHfAtijU6gS3BrD0mdu1BXL1Opq2Ho9B0MYMZnSsu44qu5qo8zCv8sZCNFEv1bUwo4P8o7Lwo7adoqGquwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740806955; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qktWgrah5wu4OUf0TSlgxEt6Obwe/RRcAOofQ2rBqMQ=; b=GV+vo8aXr3MY3TOyZBmrgR/Xsfk1YyMMXfcpnWhU/7lJhhLz48kRnV0JozrQIy8pQ5rt7/SlUqoK2lZG39nfQvuLa+eVuYo9fP1R6liQxLzr9xOyOwoCq7KWt2lR227IcgaGqTBo6NMmUaZw03yByB0e4cX2iuB+DOVDHOlHUy4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740806955989684.1984103026953; Fri, 28 Feb 2025 21:29:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1toFNR-0002u0-Qi; Sat, 01 Mar 2025 00:27:05 -0500 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 1toFNQ-0002tS-Rn for qemu-devel@nongnu.org; Sat, 01 Mar 2025 00:27:04 -0500 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1toFNO-00087B-TI for qemu-devel@nongnu.org; Sat, 01 Mar 2025 00:27:04 -0500 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5213GfWP005267 for ; Sat, 1 Mar 2025 05:27:01 GMT Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 453t6k06c8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 01 Mar 2025 05:27:01 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2234c09240fso52019045ad.0 for ; Fri, 28 Feb 2025 21:27:00 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe825bb346sm6930596a91.18.2025.02.28.21.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 21:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= qktWgrah5wu4OUf0TSlgxEt6Obwe/RRcAOofQ2rBqMQ=; b=Fa1S7jTVZ4LiWHxu CebjVatAUjd6gsEOqBnlR40gVaflEkLAk4f2oGsQAJIX34P8lbwFReKe1LUIRKve SneRCPK70ox2b9veaalpRd60Xv+r9iOyGr2G4D/xugaI3HVF70HAISyGbsoqUlCB v3O8tlMDwLqhFAA7G4LW7QVNfHWJjzw5NLCqLWxscIeHfS9BZaH4LcjcXkvZTJig XBu2QDyjTNkD175Ysma9+jbsHBU35ty45ewZ0Q7WqG9x0XLip05HjXIcsrwlL9Eg J1fB9h29PAAkDeq30hEYRQWk6fPlyY8ZBwd80AEYqoNgBEbHxeaqsDsYshWxaJw2 zNDzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740806820; x=1741411620; 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=qktWgrah5wu4OUf0TSlgxEt6Obwe/RRcAOofQ2rBqMQ=; b=XjwMzoDa5G+S4UK//hj8og/norB2Z1OoB+0aWfe4a8erSBOxKNiaortnGA5AK9+VXr 9ZMLtMdmtbqwBWhHsuH9RofiiMQPowpCWj8Yj+ezZduCIKIn3f9et4jglJJW+8ev7atv YgKfjoe0K8fefrGik8cu5Jz46kOC5ilBoxLjp3Dlm/+SSXqWcbqe6KGdAk8ps53SXwwj /QgwzN6ckK6ZcXc85cF50dxdYYNoQj+kHdgiNOnoR8N4gz4a88hX8kMd1+0DkxOL/S0T MPsxqbvUxLk1wVmdu4oAEiBKh2KqdnO7LBF5DUDMQoparW/FKXNKqb4AnJ5qm4l1Qj0J sJBg== X-Gm-Message-State: AOJu0Yy0SYuLKhKXkkYXTTmyvrpd7BHEZX4New7mzfIoQxoJ5sHX20L1 Vt67w8D3fsmdZrlVSwp3kT90hy6SfSweGyAPc9LV8HjC6ql49akT4z/P+yesC3Yu6Mn/aJ9SMai rMJ4tD9v21hDC1BCLFg7IatHe/rLu+z/HHhe28AgUXfjWZ15GuKh1mPjijs9f2g== X-Gm-Gg: ASbGnctrWXrP3rfNgwoJt1RzEnWnqFJMbxCnxIFP2kgQaqomFQbpYkRActNM1dBundk 7lo5rI+uX/lQ4rhTL4lYON7wBGvJV7Y+vnQF3Y3WOnKctNFKbICGy2j79LJiOJiQV5duO0Sn0NJ 3Z/QRYj+5OuQtpfq9U4kfdvoqDPH6jMDuXsqifXTwZdcCjIArt3/JEcYadm/p4hDhHyQHOeZT+d RdBaBt+mpw4RRktym5opmiyC3LDFp/MPszoquTtWylScqCpWbTlkrI2VGt2gPjET4eUznIsPDEd bRM5GWj/J4OFGGwveWCtQfcp/LPnMaJ99M0Cjh6nLplAcjEgVftv92FUq5g2I74k X-Received: by 2002:a17:902:f790:b0:21f:768:cced with SMTP id d9443c01a7336-22368f6d018mr79566945ad.8.1740806819952; Fri, 28 Feb 2025 21:26:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+dQS7lIxLUtE69EhrRxCJT0arVdXEBQ29P00z647XXC19BSpW0D/O2b9FjWF3UN+Mxa90/w== X-Received: by 2002:a17:902:f790:b0:21f:768:cced with SMTP id d9443c01a7336-22368f6d018mr79566655ad.8.1740806819591; Fri, 28 Feb 2025 21:26:59 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, richard.henderson@linaro.org, philmd@linaro.org, quic_mathbern@quicinc.com, ale@rev.ng, anjo@rev.ng, quic_mliebel@quicinc.com, ltaylorsimpson@gmail.com, alex.bennee@linaro.org, quic_mburton@quicinc.com, sidneym@quicinc.com, Brian Cain Subject: [PATCH 09/38] target/hexagon: Add guest, system reg number state Date: Fri, 28 Feb 2025 21:25:59 -0800 Message-Id: <20250301052628.1011210-10-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250301052628.1011210-1-brian.cain@oss.qualcomm.com> References: <20250301052628.1011210-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 1QG6L_FX1DU0ndjwiFk6gMHVTrmRe5ye X-Proofpoint-ORIG-GUID: 1QG6L_FX1DU0ndjwiFk6gMHVTrmRe5ye X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_01,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503010039 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1740806957455019000 From: Brian Cain Signed-off-by: Brian Cain Reviewed-by: Taylor Simpson --- target/hexagon/cpu.h | 8 ++++++++ target/hexagon/cpu.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 20ea0adcca..b7789a3c90 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -82,6 +82,14 @@ typedef struct CPUArchState { target_ulong stack_start; =20 uint8_t slot_cancelled; + +#ifndef CONFIG_USER_ONLY + /* Some system registers are per thread and some are global. */ + target_ulong t_sreg[NUM_SREGS]; + target_ulong *g_sreg; + + target_ulong greg[NUM_GREGS]; +#endif target_ulong new_value_usr; =20 MemLog mem_log_stores[STORES_MAX]; diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 0b7fc98f6c..355e1eeef3 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -288,6 +288,14 @@ static void hexagon_cpu_reset_hold(Object *obj, ResetT= ype type) set_float_detect_tininess(float_tininess_before_rounding, &env->fp_sta= tus); /* Default NaN value: sign bit set, all frac bits set */ set_float_default_nan_pattern(0b11111111, &env->fp_status); + +#ifndef CONFIG_USER_ONLY + if (cs->cpu_index =3D=3D 0) { + memset(env->g_sreg, 0, sizeof(target_ulong) * NUM_SREGS); + } + memset(env->t_sreg, 0, sizeof(target_ulong) * NUM_SREGS); + memset(env->greg, 0, sizeof(target_ulong) * NUM_GREGS); +#endif } =20 static void hexagon_cpu_disas_set_info(CPUState *s, disassemble_info *info) @@ -313,6 +321,15 @@ static void hexagon_cpu_realize(DeviceState *dev, Erro= r **errp) =20 qemu_init_vcpu(cs); cpu_reset(cs); +#ifndef CONFIG_USER_ONLY + if (cs->cpu_index =3D=3D 0) { + env->g_sreg =3D g_new0(target_ulong, NUM_SREGS); + } else { + CPUState *cpu0 =3D qemu_get_cpu(0); + CPUHexagonState *env0 =3D cpu_env(cpu0); + env->g_sreg =3D env0->g_sreg; + } +#endif =20 mcc->parent_realize(dev, errp); } --=20 2.34.1