[PATCH] Add new architectures to set_h8300h.
Michael Snyder
msnyder@redhat.com
Thu Jun 5 02:16:00 GMT 2003
... and remove an ifdef from sim/common/run.c.
-------------- next part --------------
2003-06-04 Michael Snyder <msnyder@redhat.com>
* common/run.c (main): Remove SIM_H8300 ifdef.
(usage): Ditto.
* common/sim-options.c (STANDARD_OPTIONS): Add SIM_H8300SX.
(standard_options): Add '-x' for h8/300sx.
(standard_option_handler): Add case for SIM_H8300SX.
* h8300/compile.c (set_h8300h): Replace 'flag' arguments
with a bfd_machine argument, and decode it inline.
Check for bfd_mach_h8300hn and bfd_mach_h8300sn.
Index: common/run.c
===================================================================
RCS file: /cvs/src/src/sim/common/run.c,v
retrieving revision 1.13
diff -p -r1.13 run.c
*** common/run.c 8 Jan 2003 17:18:29 -0000 1.13
--- common/run.c 5 Jun 2003 02:08:27 -0000
*************** main (ac, av)
*** 119,129 ****
/* FIXME: This is currently being rewritten to have each simulator
do all argv processing. */
- #ifdef SIM_H8300 /* FIXME: quick hack */
- while ((i = getopt (ac, av, "a:c:m:op:s:hStv")) != EOF)
- #else
while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
- #endif
switch (i)
{
case 'a':
--- 119,125 ----
*************** main (ac, av)
*** 176,189 ****
/* sim_set_verbose (1); */
break;
/* FIXME: Quick hack, to be replaced by more general facility. */
- #ifdef SIM_H8300
- case 'h':
- set_h8300h (1, 0);
- break;
- case 'S':
- set_h8300h (1, 1);
- break;
- #endif
default:
usage ();
}
--- 172,177 ----
*************** main (ac, av)
*** 288,298 ****
the signal that the simulator received; we want to return that to
indicate failure. */
- #ifdef SIM_H8300 /* FIXME: Ugh. grep for SLEEP in compile.c */
- if (sigrc == SIGILL)
- abort ();
- sigrc = 0;
- #else
/* Why did we stop? */
switch (reason)
{
--- 276,281 ----
*************** main (ac, av)
*** 311,317 ****
break;
}
- #endif
return sigrc;
}
--- 294,299 ----
*************** usage ()
*** 324,333 ****
fprintf (stderr, "-a args Pass `args' to simulator.\n");
#ifdef SIM_HAVE_SIMCACHE
fprintf (stderr, "-c size Set simulator cache size to `size'.\n");
- #endif
- #ifdef SIM_H8300
- fprintf (stderr, "-h Executable is for H8/300H.\n");
- fprintf (stderr, "-S Executable is for H8S.\n");
#endif
fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n");
#ifdef SIM_HAVE_ENVIRONMENT
--- 306,311 ----
Index: common/sim-options.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-options.c,v
retrieving revision 1.3
diff -p -r1.3 sim-options.c
*** common/sim-options.c 17 May 2002 19:09:12 -0000 1.3
--- common/sim-options.c 5 Jun 2003 02:08:27 -0000
*************** typedef enum {
*** 109,116 ****
#endif
OPTION_HELP,
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
! OPTION_H8300,
OPTION_H8300S,
#endif
OPTION_LOAD_LMA,
OPTION_LOAD_VMA,
--- 109,117 ----
#endif
OPTION_HELP,
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
! OPTION_H8300H,
OPTION_H8300S,
+ OPTION_H8300SX,
#endif
OPTION_LOAD_LMA,
OPTION_LOAD_VMA,
*************** static const OPTION standard_options[] =
*** 152,163 ****
standard_option_handler },
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
! { {"h8300h", no_argument, NULL, OPTION_H8300},
'h', NULL, "Indicate the CPU is h8/300h",
standard_option_handler },
{ {"h8300s", no_argument, NULL, OPTION_H8300S},
'S', NULL, "Indicate the CPU is h8/300s",
standard_option_handler },
#endif
#ifdef SIM_HAVE_FLATMEM
--- 153,167 ----
standard_option_handler },
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
! { {"h8300h", no_argument, NULL, OPTION_H8300H},
'h', NULL, "Indicate the CPU is h8/300h",
standard_option_handler },
{ {"h8300s", no_argument, NULL, OPTION_H8300S},
'S', NULL, "Indicate the CPU is h8/300s",
standard_option_handler },
+ { {"h8300sx", no_argument, NULL, OPTION_H8300SX},
+ 'x', NULL, "Indicate the CPU is h8/300sx",
+ standard_option_handler },
#endif
#ifdef SIM_HAVE_FLATMEM
*************** standard_option_handler (SIM_DESC sd, si
*** 357,367 ****
break;
#ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */
! case OPTION_H8300:
! set_h8300h (1,0);
break;
case OPTION_H8300S:
! set_h8300h (1,1);
break;
#endif
--- 361,374 ----
break;
#ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */
! case OPTION_H8300H:
! set_h8300h (bfd_mach_h8300h);
break;
case OPTION_H8300S:
! set_h8300h (bfd_mach_h8300s);
! break;
! case OPTION_H8300SX:
! set_h8300h (bfd_mach_h8300sx);
break;
#endif
Index: h8300/compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.28
diff -p -r1.28 compile.c
*** h8300/compile.c 4 Jun 2003 18:28:21 -0000 1.28
--- h8300/compile.c 5 Jun 2003 02:08:28 -0000
*************** sim_info (SIM_DESC sd, int verbose)
*** 4748,4762 ****
FLAG is non-zero for the H8/300H. */
void
! set_h8300h (int h_flag, int s_flag, int sx_flag)
{
/* FIXME: Much of the code in sim_load can be moved to sim_open.
This function being replaced by a sim_open:ARGV configuration
option. */
! h8300hmode = h_flag;
! h8300smode = s_flag;
! h8300sxmode = sx_flag;
}
/* Cover function of sim_state_free to free the cpu buffers as well. */
--- 4748,4767 ----
FLAG is non-zero for the H8/300H. */
void
! set_h8300h (unsigned long machine)
{
/* FIXME: Much of the code in sim_load can be moved to sim_open.
This function being replaced by a sim_open:ARGV configuration
option. */
! if (machine == bfd_mach_h8300sx)
! h8300sxmode = 1;
!
! if (machine == bfd_mach_h8300s || machine == bfd_mach_h8300sn || h8300sxmode)
! h8300smode = 1;
!
! if (machine == bfd_mach_h8300h || machine == bfd_mach_h8300hn || h8300smode)
! h8300hmode = 1;
}
/* Cover function of sim_state_free to free the cpu buffers as well. */
*************** sim_load (SIM_DESC sd, char *prog, bfd *
*** 4873,4886 ****
and bfd_openr as sim_load_file checks too. */
if (bfd_check_format (prog_bfd, bfd_object))
{
! unsigned long mach = bfd_get_mach (prog_bfd);
!
! set_h8300h (mach == bfd_mach_h8300h ||
! mach == bfd_mach_h8300s ||
! mach == bfd_mach_h8300sx,
! mach == bfd_mach_h8300s ||
! mach == bfd_mach_h8300sx,
! mach == bfd_mach_h8300sx);
}
}
--- 4878,4884 ----
and bfd_openr as sim_load_file checks too. */
if (bfd_check_format (prog_bfd, bfd_object))
{
! set_h8300h (bfd_get_mach (prog_bfd));
}
}
More information about the Gdb-patches
mailing list