public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* m32r port breakage
@ 2002-12-10  0:38 Doug Evans
  2002-12-17 15:43 ` Ben Elliston
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2002-12-10  0:38 UTC (permalink / raw)
  To: bje; +Cc: cgen, hp

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;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: m32r port breakage
  2002-12-10  0:38 m32r port breakage Doug Evans
@ 2002-12-17 15:43 ` Ben Elliston
  2002-12-18  9:10   ` Doug Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2002-12-17 15:43 UTC (permalink / raw)
  To: Doug Evans; +Cc: cgen, hp

>>>>> "Doug" == Doug Evans <dje@transmeta.com> writes:

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

  Doug> This patch breaks the m32r simulator.

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

  Doug> Why was @PREFIX@_INSN_MAX replaced with "last instruction enum plus one"?

A port I was doing had an instruction called "MAX" that generated the
symbol @PREFIX@_INSN_MAX.  Rather than change the name of the sentinel
value, I decided to clean this up to avoid any further problems.  I
guess I got carried away. :-( Perhaps you could change the sentinel
value's name to @PREFIX@_INSN__MAX?

Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: m32r port breakage
  2002-12-17 15:43 ` Ben Elliston
@ 2002-12-18  9:10   ` Doug Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Evans @ 2002-12-18  9:10 UTC (permalink / raw)
  To: Ben Elliston; +Cc: cgen, hp

Ben Elliston writes:
 >   Doug> Why was @PREFIX@_INSN_MAX replaced with "last instruction enum plus one"?
 > 
 > A port I was doing had an instruction called "MAX" that generated the
 > symbol @PREFIX@_INSN_MAX.  Rather than change the name of the sentinel
 > value, I decided to clean this up to avoid any further problems.  I
 > guess I got carried away. :-( Perhaps you could change the sentinel
 > value's name to @PREFIX@_INSN__MAX?

Let's do that.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-18 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10  0:38 m32r port breakage Doug Evans
2002-12-17 15:43 ` Ben Elliston
2002-12-18  9:10   ` Doug Evans

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).