* interp.c (sim_prepare_for_program): Look up the image for the
authorStephane Carrez <stcarrez@nerim.fr>
Tue, 13 Aug 2002 08:52:02 +0000 (08:52 +0000)
committerStephane Carrez <stcarrez@nerim.fr>
Tue, 13 Aug 2002 08:52:02 +0000 (08:52 +0000)
reset vector and set cpu_use_elf_start to 1 if not found.
(sim_open): Do not set cpu_use_elf_start.

sim/m68hc11/ChangeLog
sim/m68hc11/interp.c

index d6c38630a541f77f26a94fbe3d27fd9bfe373d92..fc85e60219823436bbf6a868d35c1a580dfb1cd7 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-13  Marko Kohtala  <marko.kohtala@luukku.com>
+
+       * interp.c (sim_prepare_for_program): Look up the image for the 
+       reset vector and set cpu_use_elf_start to 1 if not found.
+       (sim_open): Do not set cpu_use_elf_start.
+
 2002-08-13  Marko Kohtala  <marko.kohtala@luukku.com>
 
        * interp.c (sim_hw_configure): Return 1 for success.
index 8889da6cc7dfc37dc240a6a198f23f182d1b4f86..74674ce2969c856875724e8d0dc7013623b47f30 100644 (file)
@@ -306,7 +306,31 @@ sim_prepare_for_program (SIM_DESC sd, struct _bfd* abfd)
 
   if (abfd != NULL)
     {
+      asection *s;
       cpu->cpu_elf_start = bfd_get_start_address (abfd);
+      /* See if any section sets the reset address */
+      cpu->cpu_use_elf_start = 1;
+      for (s = abfd->sections; s && cpu->cpu_use_elf_start; s = s->next) 
+        {
+          if (s->flags & SEC_LOAD)
+            {
+              bfd_size_type size;
+
+              size = bfd_get_section_size_before_reloc (s);
+              if (size > 0)
+                {
+                  bfd_vma lma;
+
+                  if (STATE_LOAD_AT_LMA_P (sd))
+                    lma = bfd_section_lma (abfd, s);
+                  else
+                    lma = bfd_section_vma (abfd, s);
+
+                  if (lma <= 0xFFFE && lma+size >= 0x10000)
+                    cpu->cpu_use_elf_start = 0;
+                }
+            }
+        }
     }
 
   /* reset all state information */
@@ -333,7 +357,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
 
   cpu_initialize (sd, cpu);
 
-  cpu->cpu_use_elf_start = 1;
   if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
     {
       free_state (sd);
This page took 0.027154 seconds and 4 git commands to generate.