From patchwork Mon Sep 9 17:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 826630 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp2130601wrb; Mon, 9 Sep 2024 10:30:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVP69X+GBBd9wSI59XAMD4tANk3llHMHaDCofuf1p+c3Ct5Yb6C6gN95kd4IQhvD9MIKUrc1A==@linaro.org X-Google-Smtp-Source: AGHT+IGHBEpU0QJjYefAYTxiw8dAjXU59qagAl/e+5upaipS/F4t12FPDBmJMDlNpuTLPQLXEaSQ X-Received: by 2002:a05:6830:91f:b0:710:f1cd:b237 with SMTP id 46e09a7af769-710f1cdc311mr1770971a34.20.1725903053626; Mon, 09 Sep 2024 10:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725903053; cv=none; d=google.com; s=arc-20240605; b=fpHY5ONooI8x0M1LYw1zjX0+x/tk+LtE6gsZaE1i2eaaFUeriNOeN10a8Vg1lfauL9 phRNQm5j1ZqOLx0n0p86MTsRy1jeC5ty2qNrH3cKvP5gNSiwacDITmh+uApI9gdn3ERO KuZDw/PbTNRxeDv7tS646cRn7I1MSqWwuBXPX8DbdM9zEkCrj1okoeJLC5Pf8xebttXW zVi2i0muleZ+cf831kiDFt8bDfaP8WyeISmUyJ5KQs6OrHgyZcb/SrVHzAIvXiJ77JkP d+5LrFH5kpBKFqzffe5TzEz87QEpT6LnNgUvM8YTjKKgLu+U7jeL83nZfszJny1vv/oq cZag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=V5P3AbnuXIViFNLZwcR2g2CnCbWPQ0yDuBfVcwQJfUc=; fh=4bMsMJJHDmTQNFavmZaD/iTPOPK/LdH9YFdHoY+StpE=; b=WmlOW+F97A2rXha3YVtfQAIvAJldKXhtmyEKV42O1S5v8FmmbtIVMcteabyseR/2OF Sf667m48FM9PWrrFK5fr8h7OEb6okRRagMJ5Sm7ym/vY4siirYd8nTGJL09+Tm2rtlBC fsQ1VmqBnENEtuQYcFMxsSJXUbOpd6MfLcL0pkO81kYKQACQBxrZDWnStn2x3epB+AUT QY4lBNfl7dEH9Jzq2qF3hXbeG911Bz96N9OlDWi9MzfbN0INmEIzXOkgMip3H3S7KSsj qhU5+Up2Z1MaE9uVnwRy7HnhGdj5enDb2ds+gocQN1+RHQpaydSbkDB6czgjgCFgLYkq y2BA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UNUl7Vug; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45822fb0425si58700921cf.606.2024.09.09.10.30.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Sep 2024 10:30:53 -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=UNUl7Vug; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sniCA-00068u-W9; Mon, 09 Sep 2024 13:28:59 -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 1sniC5-0005T5-F9 for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:53 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sniC3-000651-4O for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:53 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-20551eeba95so40962655ad.2 for ; Mon, 09 Sep 2024 10:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725902930; x=1726507730; 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=V5P3AbnuXIViFNLZwcR2g2CnCbWPQ0yDuBfVcwQJfUc=; b=UNUl7Vug0wAYO/M7rlhT8AfFhrK9m8HyJqnySwKMMayNRtPL/+a4ffmrdPET2aGrBr sffa9+Rg1rZUiWZnOBIbW/fETU9Pmgn/Ta/cywo7fDOchLKHT3wBC4uo7pGf/otz4LwG 8r09wFEx3HwZqyGzf8mN726BZM3EISsQ/8Hd7DBDxx1OBrzspbnb6DUTl6CtJ+4+HJDK gHb9ktByfTYrQCK9Unn7duiJDpiC3jyeIJsxaZChLxJ3d8HbEPkVtja+P59+R0K4dBTN z/po9C7+tA1HBHCX9noX+tcfJI47Znf1xf+3PiSECFAgI0w93kVTgUBzUKeuqsKyhNu8 a3qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725902930; x=1726507730; 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=V5P3AbnuXIViFNLZwcR2g2CnCbWPQ0yDuBfVcwQJfUc=; b=JmXKrazDXIwEQvKMhKnNMgVtuQAk/ZGua60aTiFk+YuUzN+jTdKffcEhXG2zfNws9f gIlJGOdimEhsLVG8YACMUK8C3uH5jdhpQyxXwOLsVSarIxQFHkxC8Kvr9dyh+8P38ZQ8 hG06entLcFH+eHxmeR6rTD2AG9QvEEFyY6SeBTg/lptbi+HiFD2FXm3UZIWvlGS9gHMq pYgSUzzmEThRz5ArjI+KuRoSGcOynXTJAAm3zk7DhYYWE8US/Hh76mPww46JlC3sDKFB 0OxztkdafAckhs7rRV3iu1panJTBAZlvBnOVDN2bghlfjCbqWglKL0wJb+axqRUqUtkM H3pw== X-Gm-Message-State: AOJu0YwB6Mp/wJ9hOn3wIlOo5jCsGog/OlLX/hjK/EgSWMPESJfcSQ9H R3n/YWZ+3NTyzHIu+vCELZkJcksOdChHnYtrssTobsWnjCYIUuwisaBJ/xrOtEXKzqkPppwLLdq M X-Received: by 2002:a17:902:cf03:b0:207:2093:99bb with SMTP id d9443c01a7336-20720939bc2mr48344855ad.31.1725902929627; Mon, 09 Sep 2024 10:28:49 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e11e02sm36539875ad.14.2024.09.09.10.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 10:28:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, daniel@0x0f.com Subject: [PATCH v3 26/26] target/m68k: Implement FPIAR Date: Mon, 9 Sep 2024 10:28:23 -0700 Message-ID: <20240909172823.649837-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240909172823.649837-1-richard.henderson@linaro.org> References: <20240909172823.649837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 So far, this is only read-as-written. Signed-off-by: Richard Henderson --- target/m68k/cpu.h | 1 + target/m68k/cpu.c | 23 ++++++++++++++++++++++- target/m68k/helper.c | 14 ++++++++------ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index a676ae0b34..9d987b42be 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -110,6 +110,7 @@ typedef struct CPUArchState { uint32_t fpsr; bool fpsr_inex1; /* live only with an in-flight decimal operand */ float_status fp_status; + uint32_t fpiar; uint64_t mactmp; /* diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index fd6c227820..e36eb3e5d6 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -392,6 +392,23 @@ static const VMStateDescription vmstate_freg = { } }; +static bool fpu_fpiar_needed(void *opaque) +{ + M68kCPU *s = opaque; + return s->env.fpiar != 0; +} + +static const VMStateDescription vmstate_fpiar = { + .name = "cpu/fpu/fpiar", + .version_id = 1, + .minimum_version_id = 1, + .needed = fpu_fpiar_needed, + .fields = (const VMStateField[]) { + VMSTATE_UINT32(env.fpiar, M68kCPU), + VMSTATE_END_OF_LIST() + } +}; + static int fpu_post_load(void *opaque, int version) { M68kCPU *s = opaque; @@ -412,7 +429,11 @@ static const VMStateDescription vmstate_fpu = { VMSTATE_STRUCT_ARRAY(env.fregs, M68kCPU, 8, 0, vmstate_freg, FPReg), VMSTATE_STRUCT(env.fp_result, M68kCPU, 0, vmstate_freg, FPReg), VMSTATE_END_OF_LIST() - } + }, + .subsections = (const VMStateDescription * const []) { + &vmstate_fpiar, + NULL + }, }; static bool cf_spregs_needed(void *opaque) diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 6fc5afd296..dae6542e6d 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -44,8 +44,8 @@ static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n) return gdb_get_reg32(mem_buf, env->fpcr); case 9: /* fpstatus */ return gdb_get_reg32(mem_buf, env->fpsr); - case 10: /* fpiar, not implemented */ - return gdb_get_reg32(mem_buf, 0); + case 10: /* fpiar */ + return gdb_get_reg32(mem_buf, env->fpiar); } return 0; } @@ -67,7 +67,8 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) case 9: /* fpstatus */ env->fpsr = ldl_p(mem_buf); return 4; - case 10: /* fpiar, not implemented */ + case 10: /* fpiar */ + env->fpiar = ldl_p(mem_buf); return 4; } return 0; @@ -89,8 +90,8 @@ static int m68k_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n) return gdb_get_reg32(mem_buf, env->fpcr); case 9: /* fpstatus */ return gdb_get_reg32(mem_buf, env->fpsr); - case 10: /* fpiar, not implemented */ - return gdb_get_reg32(mem_buf, 0); + case 10: /* fpiar */ + return gdb_get_reg32(mem_buf, env->fpiar); } return 0; } @@ -112,7 +113,8 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) case 9: /* fpstatus */ env->fpsr = ldl_p(mem_buf); return 4; - case 10: /* fpiar, not implemented */ + case 10: /* fpiar */ + env->fpiar = ldl_p(mem_buf); return 4; } return 0;