/* Module support.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
#include "sim-options.h"
#include "sim-assert.h"
+#if WITH_HW
+#include "sim-hw.h"
+#endif
+
#include "libiberty.h"
/* List of all modules. */
static MODULE_INSTALL_FN * const modules[] = {
standard_install,
sim_events_install,
+#ifdef SIM_HAVE_MODEL
+ sim_model_install,
+#endif
#if WITH_ENGINE
sim_engine_install,
#endif
#if WITH_SCACHE
scache_install,
#endif
-#ifdef SIM_HAVE_MODEL
- model_install,
-#endif
#ifdef SIM_HAVE_BREAKPOINTS
sim_break_install,
+#endif
+#if WITH_HW
+ sim_hw_install,
#endif
/* Configured in [simulator specific] additional modules. */
#ifdef MODULE_LIST
int i;
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
- const char *name;
+ char *name;
asprintf (&name, "cpu%d", i);
CPU_NAME (STATE_CPU (sd, i)) = name;
}
}
+ sim_config_default (sd);
+
/* Install all configured in modules. */
if (sim_module_install (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
SIM_ASSERT (STATE_MODULES (sd) != NULL);
- if (sim_module_init (sd) != SIM_RC_OK)
- return SIM_RC_FAIL;
-
/* Set the cpu->state backlinks for each cpu. */
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
- CPU_STATE (STATE_CPU (sd, i)) = sd;
+ {
+ CPU_STATE (STATE_CPU (sd, i)) = sd;
+ CPU_INDEX (STATE_CPU (sd, i)) = i;
+ }
+
+ if (sim_module_init (sd) != SIM_RC_OK)
+ return SIM_RC_FAIL;
return SIM_RC_OK;
}
MODULE_INIT_LIST *modp;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
for (modp = modules->init_list; modp != NULL; modp = modp->next)
{
MODULE_RESUME_LIST *modp;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
for (modp = modules->resume_list; modp != NULL; modp = modp->next)
{
MODULE_SUSPEND_LIST *modp;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
for (modp = modules->suspend_list; modp != NULL; modp = modp->next)
{
MODULE_UNINSTALL_LIST *modp;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
/* Uninstall the modules. */
for (modp = modules->uninstall_list; modp != NULL; modp = modp->next)
MODULE_INFO_LIST *modp;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
for (modp = modules->info_list; modp != NULL; modp = modp->next)
{
MODULE_INIT_LIST **last;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
last = &modules->init_list;
while (*last != NULL)
MODULE_RESUME_LIST **last;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
last = &modules->resume_list;
while (*last != NULL)
MODULE_SUSPEND_LIST **last;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
last = &modules->suspend_list;
while (*last != NULL)
MODULE_UNINSTALL_LIST *l = ZALLOC (MODULE_UNINSTALL_LIST);
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
l->fn = fn;
l->next = modules->uninstall_list;
MODULE_INFO_LIST **last;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
last = &modules->info_list;
while (*last != NULL)