Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] h8300 sim uses inconsistent memory sizes
@ 2004-06-27  5:34 Alexandre Oliva
  2004-06-28 14:51 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2004-06-27  5:34 UTC (permalink / raw)
  To: gdb-patches

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

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

end of thread, other threads:[~2004-06-28 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-27  5:34 [patch] h8300 sim uses inconsistent memory sizes Alexandre Oliva
2004-06-28 14:51 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox