public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@transmeta.com>
To: bje@redhat.com
Cc: cgen@sources.redhat.com, hp@axis.com
Subject: m32r port breakage
Date: Tue, 10 Dec 2002 00:38:00 -0000	[thread overview]
Message-ID: <200212100838.AAA12330@xris-athlon.transmeta.com> (raw)

Yes, it's been ages since I've looked at the m32r port,
but it's the one I like to use when playing with things.
Hans-Peter has a patch he wants to go in and before it has my blessing
I want to play with it on a real port.

This patch breaks the m32r simulator.

2001-04-02  Ben Elliston  <bje@redhat.com>
	
	* sim-decode.scm (@prefix@_init_idesc_table): Compute tabsize
	using the size of the table and its elements.
	(-gen-decode-insn-globals): Define the idesc table's size to be
	the last instruction enum plus one, not @PREFIX@_INSN_MAX.
	* sim-model.scm (-gen-mach-defns): Define CPU_MAX_INSNS as the
	last instruction enum plus one, not @CPU@_INSN_MAX.

Why was @PREFIX@_INSN_MAX replaced with "last instruction enum plus one"?
For the m32r they're not the same thing.  The former takes into account
all the parallel semantic handlers causing this table in sim/m32r/decodex.c

static IDESC m32rxf_insn_data[M32RXF_INSN_SNC + 1];

to be smaller than it should be so that m32rxf_init_idesc_table
ends up clobbering memory beyond the table.

void
m32rxf_init_idesc_table (SIM_CPU *cpu)
{
  IDESC *id,*tabend;
  const struct insn_sem *t,*tend;
  int tabsize = sizeof (m32rxf_insn_data) / sizeof (IDESC);
  IDESC *table = m32rxf_insn_data;

  memset (table, 0, tabsize * sizeof (IDESC));

  /* First set all entries to the `invalid insn'.  */
  t = & m32rxf_insn_sem_invalid;
  for (id = table, tabend = table + tabsize; id < tabend; ++id)
    init_idesc (cpu, id, t);

  /* Now fill in the values for the chosen cpu.  */
  for (t = m32rxf_insn_sem, tend = t + sizeof (m32rxf_insn_sem) / sizeof (*t);
       t != tend; ++t)
    {
      init_idesc (cpu, & table[t->index], t);
      if (t->par_index != NOPAR)
	{
>>>>	  init_idesc (cpu, &table[t->par_index], t);
>>>>	  table[t->index].par_idesc = &table[t->par_index];
	}
      if (t->par_index != NOPAR)
	{
>>>>	  init_idesc (cpu, &table[t->write_index], t);
>>>>	  table[t->par_index].par_idesc = &table[t->write_index];
	}
    }

  /* Link the IDESC table into the cpu.  */
  CPU_IDESC (cpu) = table;
}

             reply	other threads:[~2002-12-10  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10  0:38 Doug Evans [this message]
2002-12-17 15:43 ` Ben Elliston
2002-12-18  9:10   ` Doug Evans

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=200212100838.AAA12330@xris-athlon.transmeta.com \
    --to=dje@transmeta.com \
    --cc=bje@redhat.com \
    --cc=cgen@sources.redhat.com \
    --cc=hp@axis.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).