From: Michael Snyder <msnyder@redhat.com>
To: Kazu Hirata <kazu@cs.umass.edu>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Unreviewed patches
Date: Sat, 01 Feb 2003 01:27:00 -0000 [thread overview]
Message-ID: <3E3B229D.67F2E805@redhat.com> (raw)
In-Reply-To: <20030130.234517.112286807.kazu@cs.umass.edu>
[-- Attachment #1: Type: text/plain, Size: 2521 bytes --]
Kazu Hirata wrote:
>
> Hi Michael,
>
> Thanks for reviewing the patches.
>
> > > [RFA] sim/h8300/h8300.c: Fix the handling of bxor.
> > > http://sources.redhat.com/ml/gdb-patches/2003-01/msg00328.html
> >
> > For this one, I find the expression "!!(ea & m)" a bit obscure.
> > How about "(ea & m) != 0)"?
>
> Sure. Does this mean the patch is OK to apply with your sugestion?
Yes.
> > > [RFA] sim/h8300/compile.c: Fix the handling of extu.w.
> > > http://sources.redhat.com/ml/gdb-patches/2002-12/msg00685.html
> >
> > When you say "an 8-bit wide register that does not exist",
> > do you mean "that isn't simulated"? It seems to me that
> > the more correct solution is that breg[] is not big enough.
> > It ought to be at least 24 words, if not 32.
>
> Well, H8/300H and H8S have 8 32-bit registers, from er0 to er7. Each
> of them can be treated as two 16-bit wide registers. That is, er0 is
> split into e0 and r0. Furthermore, the lower half, r0, can be divided
> into two parts, r0h and r0l. The organization of one register looks
> like so:
>
> 31 24 23 16 15 8 7 0
> +--------+--------+--------+--------+
> | N/A | N/A | r0h | r0l |
> +--------+--------+--------+--------+
> | e0 | r0 |
> +-----------------+-----------------+
> | er0 |
> +-----------------------------------+
>
> Now, "extu.w r0" zero-extends the value of r0l and stores the result
> to r0. The H8 simulator without my patch correctly handles this. A
> problem arises when the simulator sees "extu.w e0". The correct
> behavior is to zero-extend the lower half of e0 and store the result
> into e0. However, GET_B_REG in the simulator has no way to refer to
> the lower half of the e0. The real hardware does not even have this,
> so I decided to take e0 and clear the upper half of e0, which also
> works for "extu.w r0". Just take r0 and clear the upper half of r0.
Yes, thanks. My problem is this: your patch uses a host-order
sign-extend to simulate a target-order sign-extend. If the host
and target have different byte orders, you lose. That's probably
why the simulator uses breg[] to fetch bytes, instead of using
wreg and masking.
I suggest that it would be comparatively easy to extend the
breg[] array so that it would cover at least the first three
bytes in the register (and possibly all four, just because
it's no extra effort). Something like the attached.
Then the code that references breg[] does not need to change.
[-- Attachment #2: tmp.diff --]
[-- Type: text/plain, Size: 884 bytes --]
*************** compile (SIM_DESC sd, int pc)
*** 777,784 ****
}
! static unsigned char *breg[18];
! static unsigned short *wreg[18];
static unsigned int *lreg[18];
#define GET_B_REG(X) *(breg[X])
--- 777,784 ----
}
! static unsigned char *breg[32];
! static unsigned short *wreg[16];
static unsigned int *lreg[18];
#define GET_B_REG(X) *(breg[X])
*************** init_pointers (SIM_DESC sd)
*** 1065,1077 ****
while (p < e)
{
if (*p == 0x22)
- {
breg[i] = p;
- }
if (*p == 0x33)
- {
breg[i + 8] = p;
! }
p++;
}
--- 1065,1077 ----
while (p < e)
{
if (*p == 0x22)
breg[i] = p;
if (*p == 0x33)
breg[i + 8] = p;
! if (*p == 0x11)
! breg[i + 16] = p;
! if (*p == 0x00)
! breg[i + 24] = p;
p++;
}
next prev parent reply other threads:[~2003-02-01 1:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-30 6:03 Kazu Hirata
2003-01-31 2:36 ` Michael Snyder
2003-01-31 4:54 ` Kazu Hirata
2003-02-01 1:27 ` Michael Snyder [this message]
2003-02-01 3:23 ` Kazu Hirata
2003-02-03 20:30 ` Michael Snyder
2003-02-03 23:30 ` Kazu Hirata
2003-02-05 22:41 ` Michael Snyder
-- strict thread matches above, loose matches on Subject: below --
2007-10-11 14:51 Kazu Hirata
2007-10-04 12:04 Kazu Hirata
2003-01-17 4:33 Kazu Hirata
2002-07-01 6:55 Joern Rennecke
2002-07-01 8:47 ` Elena Zannoni
2002-07-01 10:10 ` Joern Rennecke
2002-07-01 14:24 ` Elena Zannoni
2002-07-01 15:01 ` Joern Rennecke
2002-07-02 12:32 ` Elena Zannoni
2002-07-03 13:49 ` Joern Rennecke
2002-07-12 4:59 ` Elena Zannoni
2002-07-12 5:47 ` Joern Rennecke
2002-07-12 8:23 ` Andrew Cagney
2002-07-17 11:30 ` Joern Rennecke
2002-07-17 13:04 ` Andrew Cagney
2002-08-05 6:47 ` Elena Zannoni
2002-07-12 11:36 ` Elena Zannoni
2002-06-19 14:29 Joern Rennecke
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=3E3B229D.67F2E805@redhat.com \
--to=msnyder@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kazu@cs.umass.edu \
/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