You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
+
#include "bfd.h"
#include "libiberty.h"
-#include "gdb/remote-sim.h"
+#include "sim/sim.h"
#include "sim-main.h"
#include "sim-base.h"
static void
do_call (SIM_CPU *cpu, unsigned int npc)
{
- SIM_DESC sd = CPU_STATE (cpu);
+ const struct avr_sim_state *state = AVR_SIM_STATE (CPU_STATE (cpu));
unsigned int sp = read_word (REG_SP);
/* Big endian! */
sram[sp--] = cpu->pc;
sram[sp--] = cpu->pc >> 8;
- if (sd->avr_pc22)
+ if (state->avr_pc22)
{
sram[sp--] = cpu->pc >> 16;
cpu->cycles++;
/* Fall through */
case OP_ret:
{
- SIM_DESC sd = CPU_STATE (cpu);
+ const struct avr_sim_state *state = AVR_SIM_STATE (CPU_STATE (cpu));
unsigned int sp = read_word (REG_SP);
- if (sd->avr_pc22)
+ if (state->avr_pc22)
{
cpu->pc = sram[++sp] << 16;
cpu->cycles++;
struct bfd *abfd, char * const *argv)
{
int i;
- SIM_DESC sd = sim_state_alloc (kind, cb);
+ SIM_DESC sd = sim_state_alloc_extra (kind, cb, sizeof (struct avr_sim_state));
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ /* Set default options before parsing user options. */
+ current_alignment = STRICT_ALIGNMENT;
+
/* The cpu data is kept in a separately allocated chunk of memory. */
- if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK)
+ if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
{
free_state (sd);
return 0;
}
- {
- /* XXX: Only first core gets profiled ? */
- SIM_CPU *cpu = STATE_CPU (sd, 0);
- STATE_WATCHPOINTS (sd)->pc = &cpu->pc;
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (cpu->pc);
- }
-
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
{
free_state (sd);
sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
char * const *argv, char * const *env)
{
+ struct avr_sim_state *state = AVR_SIM_STATE (sd);
SIM_CPU *cpu = STATE_CPU (sd, 0);
SIM_ADDR addr;
sim_pc_set (cpu, addr);
if (abfd != NULL)
- sd->avr_pc22 = (bfd_get_mach (abfd) >= bfd_mach_avr6);
+ state->avr_pc22 = (bfd_get_mach (abfd) >= bfd_mach_avr6);
return SIM_RC_OK;
}