+ sim_set_pc (abfd->start_address);
+}
+
+/*
+ * This is a utility routine that sim_load() can call to do the work.
+ * The result is 0 for success, non-zero for failure.
+ *
+ * Eg: int sim_load (bfd *bfd, char *prog) { return sim_load_standard (bfd); }
+ */
+
+sim_load_standard (abfd)
+ bfd *abfd;
+{
+ asection *s;
+
+ s = abfd->sections;
+ while (s != (asection *)NULL)
+ {
+ if (s->flags & SEC_LOAD)
+ {
+ int i;
+ int delta = 4096;
+ char *buffer = xmalloc (delta);
+ printf_filtered ("%s\t: 0x%4x .. 0x%4x ",
+ s->name, s->vma, s->vma + s->_raw_size);
+ for (i = 0; i < s->_raw_size; i+= delta)
+ {
+ int sub_delta = delta;
+ if (sub_delta > s->_raw_size - i)
+ sub_delta = s->_raw_size - i ;
+
+ bfd_get_section_contents (abfd, s, buffer, i, sub_delta);
+ sim_write (s->vma + i, buffer, sub_delta);
+ printf_filtered ("*");
+ fflush (stdout);
+ }
+ printf_filtered ("\n");
+ free (buffer);
+ }
+ s = s->next;
+ }
+
+ return 0;