public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Martin Simmons <qqxnjvamvxwx@dyxyl.com>
Cc: gdb@sourceware.org
Subject: Re: Fwd: [RFA] Fix for mcore simulator
Date: Wed, 11 Oct 2023 10:49:11 -0600	[thread overview]
Message-ID: <5894d55f-d930-43c7-8811-d1e9bcda688b@gmail.com> (raw)
In-Reply-To: <je8r8acg9f.fsf@debian-BULLSEYE-live-builder-AMD64>



On 10/10/23 15:35, Martin Simmons wrote:
>>>>>> On Thu, 5 Oct 2023 10:09:44 -0600, Jeff Law via Gdb said:
>>
>> Of course if the code is supposed to behave the same, then that points
>> to problems elsewhere (assembler, linker, simulator).  Sure enough the
>> mcore simulator was mis-handling the sign extension instructions.  The
>> simulator implementation of sextb is via paired shift-by-24 operations.
>> Similarly the simulator implements sexth via paired shift-by-16 operations.
>>
>> The temporary holding the value was declared as a "long" thus this
>> approach worked fine for hosts with a 32 bit wide long and failed
>> miserably for hosts with a 64 bit wide long.
>>
>> This patch makes the shift count automatically adjust based on the size
>> of the temporary.  It includes a simple test for sextb and sexth.  I
>> have _not_ done a full audit of the mcore simulator for more 32->64 bit
>> issues.
> 
> The use of long seems bogus to me.  Why not just declare tmp as int32_t?
That code likely predates any modernization efforts in gdbsim and 
binutils-gdb as a whole -- it's the old interp style simulator that was 
common in the 90s.

I wouldn't lose any sleep if someone took up that task (modernizing that 
codebase) but my interest in mcore is essentially zero, so it won't be me.

Jeff

      reply	other threads:[~2023-10-11 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1d854df9-b28c-41eb-af7c-e3a423885558@gmail.com>
2023-10-05 16:09 ` Jeff Law
2023-10-10 17:21   ` Tom Tromey
2023-10-10 21:35   ` Martin Simmons
2023-10-11 16:49     ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5894d55f-d930-43c7-8811-d1e9bcda688b@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=qqxnjvamvxwx@dyxyl.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).