From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zcwAJAuKq2N1TgoAWB0awg (envelope-from ) for ; Tue, 27 Dec 2022 19:12:59 -0500 Received: by simark.ca (Postfix, from userid 112) id 860E01E222; Tue, 27 Dec 2022 19:12:59 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=HWmxP9zx; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 simark.ca (Postfix) with ESMTPS id 144451E0D3 for ; Tue, 27 Dec 2022 19:12:59 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FF433858C30 for ; Wed, 28 Dec 2022 00:12:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FF433858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672186377; bh=9D+FCxSLMyENsTmg2IgeP0RPW3Gra8SgB869HTcUkIo=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=HWmxP9zx7TIOx8C2gVeiAV7xUN2G/itj10vZG79mBgfq9twXXO91qHmlcJtrBVdVx FFqk/Tt+UKHsa3YWXKYkaYj9BoAZzTgEkwaC0sWCUnD9Q29RirpnrxI9Opf7IjVS4J Zh6iCtYQqUyHOeADbpn0acKJflLgoxECax5b7p4g= Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 5778C3858D37 for ; Wed, 28 Dec 2022 00:12:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5778C3858D37 Received: by smtp.gentoo.org (Postfix, from userid 559) id 7E3B9340FB0; Wed, 28 Dec 2022 00:12:35 +0000 (UTC) Date: Tue, 27 Dec 2022 19:12:33 -0500 To: Dragan Mladjenovic Cc: gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu , Faraz Shahbazker Subject: Re: [PATCH v5 4/4] sim: mips: Add simulator support for mips32r6/mips64r6 Message-ID: References: <20220202101725.23671-1-Dragan.Mladjenovic@syrmia.com> <20220202101725.23671-5-Dragan.Mladjenovic@syrmia.com> <5c3f02e8-737d-c992-f321-abbe7a60e249@syrmia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="asWm2poSGWS1AlJF" Content-Disposition: inline In-Reply-To: <5c3f02e8-737d-c992-f321-abbe7a60e249@syrmia.com> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --asWm2poSGWS1AlJF Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 27 Dec 2022 20:35, Dragan Mladjenovic wrote: > On 25-Dec-22 01:26, Mike Frysinger wrote: > > On 02 Feb 2022 11:17, Dragan Mladjenovic wrote: > >> --- a/sim/mips/configure.ac > >> +++ b/sim/mips/configure.ac > >> @@ -216,6 +227,7 @@ if test ${sim_gen} =3D MULTI; then > >> #include "sim-main.h" > >> #include "multi-include.h" > >> #include "elf-bfd.h" > >> +#include "elfxx-mips.h" > >> #include "elf/mips.h" > >> =20 > >> #define SD sd > >> @@ -235,7 +247,11 @@ sim_engine_run (SIM_DESC sd, > >> & EF_MIPS_ARCH_ASE_MICROMIPS) > >> mach =3D bfd_mach_mips_micromips; > >> else > >> - mach =3D STATE_ARCHITECTURE (SD)->mach; > >> + { > >> + mach =3D _bfd_elf_mips_mach (elf_elfheader (STATE_PROG_BFD (sd))= ->e_flags); > >> + if (!mach) > >> + mach =3D STATE_ARCHITECTURE (SD)->mach; > >> + } > >=20 > > why do you need this logic in the main engine run routine ? why isn't = the > > STATE_ARCHITECTURE value already set to the correct value ? if it isn'= t set > > correctly all the time, this can lead to incorrect behavior elsewhere w= hen > > code checks it. > >=20 > > when the sim is opened, the bfd_mach is either explicitly passed in (wh= ich > > gdb does), or initialized with a call to the bfd library APIs. see the > > sim/common/sim-utils.c:sim_analyze_program code. >=20 > Sorry but the exact reason for doing so eludes me. It is done on=20 > internal jump for gdb 8 to gdb 10, permissibly to allow running > binary even whet set arch forces older mips isa, but I see little > use of that outside of testsuite maybe. i'd argue that if you load a binary for one ISA, then force the runtime to use a different one, and the result crashes, then the sim is WAI. it should behave as real hardware does, and if you load a binary that needs a newer ISA than a CPU provides, it won't work. do you know if there's a testsuite, sim or gdb, that exercises this ? -mike --asWm2poSGWS1AlJF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmOrifEACgkQQWM7n+g3 9YE6Ng/8C1L/cOAgaiXmokauwbZ5Ha4WPeuWbO7wuBx3m6GUjkoo3FTLDS86h4AJ 6fV46gKLCg0i9tb/YX2uFh9Z/K64YYIprFC9BKSSrOw5nhYTdZgjS3T5O67d881q q37pLx2AALUNnVnNh525JgKdcWCQImQpEq0SW7p7eA+XP4/TxAam6ATPfVnHS0hC ZYooLvGRVfNPldZhHGQJesYt0fI/sZCz81LcDWdECzbA62KlNwpdoPpPseTyU57V lQCFPUKwKVPWkGU/fRnPrcULvhgM6HJjzGXf00UsF5xvlKw1wkxwOsqJbofZFEyK KpN2FoR865g1MDNo32ikV9CQQ3a7hjwiErH+MU1SNlz0fNVwa/ulCQ9shK4MbphC fmd9rHiVjMADzOmVURHWXcmyyabKN5Ya2y9VPC96CpA18VRtcKeEYk8aPpIi1DEv HIWTfG1qBPzs2/HFlGTemXS5p6fF4vAJwKtqfjiTRWHZT3Gh3Md+y+mTwg/4B8ha nSQ0XzKIQQunQ0iNfxUIEYaiZalQuPzS6aG78Z0LChDVZFCa/oxST4evIMaPZ89J SBXF/AwpNK/hliFvUGHMzGBs1L5imCqkhEFYX/q/JfTXoDHyzlsZuLV4LHAdXg0l VcaRS2Gz3J38RQiFMrmHoMSxMaiwETcdgct8afimH+hs271Szwc= =4N04 -----END PGP SIGNATURE----- --asWm2poSGWS1AlJF--