From patchwork Mon Oct 7 11:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 833343 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1920203wra; Mon, 7 Oct 2024 04:52:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWiXMglGcFlx9TAQE7lQOP0PCEFoWypGpbjlLiX7yEys+lKitihmDmZNEKudT+FFN4HCinXAQ==@linaro.org X-Google-Smtp-Source: AGHT+IFdYdZwpcYbsXcBStjDxzHkymhRGcwDeiqpVN26g3+68d7iJxGHpHkmoThxDxA79qB64ogQ X-Received: by 2002:a05:620a:19a4:b0:79f:932:86e3 with SMTP id af79cd13be357-7ae6f437217mr1819477285a.19.1728301934341; Mon, 07 Oct 2024 04:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728301934; cv=none; d=google.com; s=arc-20240605; b=es3bi8M8JK/Wv27v7AlrctsLj256vglGbgUeEvp9dxa2e4XvhYZDhhYtRexUBOPMN9 WOKRUB+38edcOGFdb0UXQ2YOitg44TfUR+ikjEp0fsodfJ+mwu9CNvu1a6MnQGR/DWmh mG4yNy7Y323s4lI3AVkSm42LyPSztFdBnnSrnWIrdP4m8yXhDtSsF0+xmhj386JCrkEv 8jjy3WLxO2cvofELZBAS4mGBsiwML4j8Qo4cx1eIi7qfeM1IiqPTq0SErOK2Bp5gwrr6 wLzlsVTIaC0Sc5s7ZbL4sAfbUFzIdw7kKPkvneKm/CoMXKqlIV9BX9BVENT8JTY/eaLN JbRg== 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=2uaBKaJEIWpYLfu+qqQkoHdGsmy7MgEbTsLbivZRrgo=; fh=hr5VfklYXLjxcS031ZwLztH7y5Zb2cX77uM8bp9xHCE=; b=O5WtUSxNunPsBgvMwa0vnaLh9dIZ7aWRg3esPFeSvz91/SmGf7X77TbG7gi5Up4/pb i8fV8piJyWEYCDOKnMwcOPNcdsbvQip0ILeRlKVEZGIxoF1M+ojoRakb2tXUtzWrTIfn goJAvxxRAoBCKHREoFt1oGdA/XFQ+jJ2pty509YSO19Y5EykW2nXsFZ201u+Sk6P+DuF 64fxPSdbme3J7mLi4m7fKpM9mwQmvK+LpT//9IbrZ/NLY6Sc3vjbrYpJ2Nu2pg4QRF4F fzyQptcZ5yB19+9NAR6Bc04hIlofH0mw4eZL6qIFBJu/BMk8XSKLXAH86uCiiGNXGEtJ wM4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=buq2WoCn; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae7562e192si623101985a.220.2024.10.07.04.52.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Oct 2024 04:52: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=@redhat.com header.s=mimecast20190719 header.b=buq2WoCn; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxmGV-0006yC-QR; Mon, 07 Oct 2024 07:51:03 -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 1sxmGP-0006nQ-Lz for qemu-devel@nongnu.org; Mon, 07 Oct 2024 07:50:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxmGN-00059H-WF for qemu-devel@nongnu.org; Mon, 07 Oct 2024 07:50:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728301855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2uaBKaJEIWpYLfu+qqQkoHdGsmy7MgEbTsLbivZRrgo=; b=buq2WoCnVFzRUYhg2kcEigmuKpXw89IT/wzXNlU+gKR+RhzSyX5kRSQPt4BThMX/GlrtSS YyEyyRcWEG039ZLniO63ZDgwK/MkklbFQhMy/w0dx26sfW1nFO3XzGRonCruHHnRpnBG6w NtroDSKucowoXEiACUfdgSO3lTPjBjo= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-xi3RG6cXPWaIjkAl0zOrVg-1; Mon, 07 Oct 2024 07:50:54 -0400 X-MC-Unique: xi3RG6cXPWaIjkAl0zOrVg-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 754151944A8A; Mon, 7 Oct 2024 11:50:52 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.194.46]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9A0F719560AE; Mon, 7 Oct 2024 11:50:50 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Thomas Huth Subject: [PULL 07/12] target/m68k: Use explicit big-endian LD/ST API Date: Mon, 7 Oct 2024 13:50:22 +0200 Message-ID: <20241007115027.243425-8-thuth@redhat.com> In-Reply-To: <20241007115027.243425-1-thuth@redhat.com> References: <20241007115027.243425-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.153, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé The M68K architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ for acc in uw w l q tul; do \ sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \ -e "s/st${acc}_p(/st${acc}_${end}_p(/" \ $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/m68k/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-ID: <20241004163042.85922-19-philmd@linaro.org> Signed-off-by: Thomas Huth --- target/m68k/gdbstub.c | 2 +- target/m68k/helper.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c index 15547e2313..136159f98f 100644 --- a/target/m68k/gdbstub.c +++ b/target/m68k/gdbstub.c @@ -52,7 +52,7 @@ int m68k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUM68KState *env = cpu_env(cs); uint32_t tmp; - tmp = ldl_p(mem_buf); + tmp = ldl_be_p(mem_buf); if (n < 8) { /* D0-D7 */ diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 4c85badd5d..9d3db8419d 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -57,15 +57,15 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) if (n < 8) { float_status s; - env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s); + env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s); return 8; } switch (n) { case 8: /* fpcontrol */ - cpu_m68k_set_fpcr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf)); return 4; case 9: /* fpstatus */ - env->fpsr = ldl_p(mem_buf); + env->fpsr = ldl_be_p(mem_buf); return 4; case 10: /* fpiar, not implemented */ return 4; @@ -107,10 +107,10 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) } switch (n) { case 8: /* fpcontrol */ - cpu_m68k_set_fpcr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf)); return 4; case 9: /* fpstatus */ - cpu_m68k_set_fpsr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpsr(env, ldl_be_p(mem_buf)); return 4; case 10: /* fpiar, not implemented */ return 4;