Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [patch] h8300 sim uses inconsistent memory sizes
Date: Sun, 27 Jun 2004 05:34:00 -0000	[thread overview]
Message-ID: <or8ye9r2dz.fsf@livre.redhat.lsd.ic.unicamp.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

sd->memory_size was only initialized in init_pointers(), that was
called before the executable was loaded and the machine-type detection
was run.  Even though sim_load() duplicated most of the code in
init_pointers(), it failed to update the memory_size in sd, so if we
attempted to run code from a memory location not available on the
original h8300, we'd get a confusing illegal-instruction error,
because h8_get_cache_idx would return -1.

This patch updates sim_load() such that it matches init_pointers() in
this regard.  Ok to install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sim-h8sx-update-memory-size.patch --]
[-- Type: text/x-patch, Size: 776 bytes --]

Index: sim/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* h8300/compile.c (sim_load): Update sd->memory_size.

Index: sim/h8300/compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.40
diff -u -p -r1.40 compile.c
--- sim/h8300/compile.c 10 Jun 2004 20:22:17 -0000 1.40
+++ sim/h8300/compile.c 27 Jun 2004 05:28:19 -0000
@@ -5096,6 +5096,7 @@ sim_load (SIM_DESC sd, char *prog, bfd *
 		     calloc (sizeof (char), memory_size));
   h8_set_cache_idx_buf (sd, (unsigned short *) 
 			calloc (sizeof (short), memory_size));
+  sd->memory_size = memory_size;
   h8_set_eightbit_buf (sd, (unsigned char *) calloc (sizeof (char), 256));
 
   /* `msize' must be a power of two.  */

[-- Attachment #3: Type: text/plain, Size: 188 bytes --]


-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

             reply	other threads:[~2004-06-27  5:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  5:34 Alexandre Oliva [this message]
2004-06-28 14:51 ` Andrew Cagney

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=or8ye9r2dz.fsf@livre.redhat.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=gdb-patches@sources.redhat.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