Rewrite for H8/300-H
[deliverable/binutils-gdb.git] / sim / h8300 / run.c
1 /* front end to the simulator.
2
3 Written by Steve Chamberlain of Cygnus Support.
4 sac@cygnus.com
5
6 This file is part of H8/300 sim
7
8
9 THIS SOFTWARE IS NOT COPYRIGHTED
10
11 Cygnus offers the following for use in the public domain. Cygnus
12 makes no warranty with regard to the software or it's performance
13 and the user accepts the software "AS IS" with all faults.
14
15 CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
16 THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
19 */
20
21 #include "bfd.h"
22 #include "sysdep.h"
23
24 int
25 main (ac, av)
26 int ac;
27 char **av;
28 {
29 bfd *abfd;
30 bfd_vma start_address;
31 asection *s;
32 int i;
33 int verbose = 0;
34 int trace = 0;
35 char *name = "";
36 for (i = 1; i < ac; i++)
37 {
38 <<<<<<< run.c
39 verbose ++;
40 }
41 else if (strcmp(av[i],"-t") == 0)
42 {
43 trace = 1;
44 }
45 else if (strcmp(av[i],"-c") == 0)
46 {
47 sim_csize(atoi(av[i+1]));
48 i++;
49 =======
50 if (strcmp (av[i], "-v") == 0)
51 {
52 verbose = 1;
53 }
54 else if (strcmp (av[i], "-t") == 0)
55 {
56 trace = 1;
57 }
58
59 else
60 {
61 name = av[i];
62 }
63 >>>>>>> 1.4
64 }
65 <<<<<<< run.c
66 else
67 =======
68 if (verbose)
69 >>>>>>> 1.4
70 {
71 <<<<<<< run.c
72 name = av[i];
73 =======
74 printf ("run %s\n", name);
75 >>>>>>> 1.4
76 }
77 <<<<<<< run.c
78 }
79 if (verbose)
80 {
81 printf("run %s\n", name);
82 }
83 abfd = bfd_openr(name,"coff-h8300");
84 =======
85 abfd = bfd_openr (name, "coff-h8300");
86 >>>>>>> 1.4
87
88 <<<<<<< run.c
89 if (abfd)
90 =======
91 if (abfd)
92 >>>>>>> 1.4
93 {
94 <<<<<<< run.c
95 if (bfd_check_format(abfd, bfd_object))
96 {
97
98 for (s = abfd->sections; s; s=s->next)
99 {
100 char *buffer = malloc(bfd_section_size(abfd,s));
101 bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
102 sim_write(s->vma, buffer, bfd_section_size(abfd,s));
103 }
104
105 start_address = bfd_get_start_address(abfd);
106 sim_store_register(
107 9,start_address);
108 sim_resume(0,0);
109 if (verbose)
110 sim_info (verbose);
111 =======
112 if (bfd_check_format (abfd, bfd_object))
113 {
114
115 for (s = abfd->sections; s; s = s->next)
116 {
117 char *buffer = malloc (bfd_section_size (abfd, s));
118 bfd_get_section_contents (abfd, s, buffer, 0, bfd_section_size (abfd, s));
119 sim_write (s->vma, buffer, bfd_section_size (abfd, s));
120 }
121
122 start_address = bfd_get_start_address (abfd);
123 sim_store_register (
124 9, start_address);
125 sim_resume (0, 0);
126 if (verbose)
127 sim_info ();
128 >>>>>>> 1.4
129
130 <<<<<<< run.c
131 return 0;
132 =======
133 return 0;
134 }
135 >>>>>>> 1.4
136 }
137
138 return 1;
139 }
This page took 0.032979 seconds and 5 git commands to generate.