This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] h8300 sim uses inconsistent memory sizes


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?

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.  */
-- 
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}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]