1 /* Handle 0x900000xx addresses in the sim.
3 Copyright (C) 2004-2019 Free Software Foundation, Inc.
4 Contributed by Axis Communications.
6 This file is part of the GNU simulators.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 struct cris_900000xx_hw
29 cris_io_write_buffer (struct hw
*me
, const void *source
,
30 int space
, address_word addr
, unsigned nr_bytes
)
32 static const unsigned char ok
[] = { 4, 0, 0, 0x90};
33 static const unsigned char bad
[] = { 8, 0, 0, 0x90};
34 SIM_CPU
*cpu
= hw_system_cpu (me
);
35 SIM_DESC sd
= CPU_STATE (cpu
);
36 sim_cia cia
= CPU_PC_GET (cpu
);
38 if (addr
== 0x90000004 && memcmp (source
, ok
, sizeof ok
) == 0)
39 return cris_break_13_handler (cpu
, 1, 0, 0, 0, 0, 0, 0, cia
);
40 else if (addr
== 0x90000008
41 && memcmp (source
, bad
, sizeof bad
) == 0)
42 return cris_break_13_handler (cpu
, 1, 34, 0, 0, 0, 0, 0, cia
);
44 /* If it wasn't one of those, send an invalid-memory signal. */
45 sim_core_signal (sd
, cpu
, cia
, 0, nr_bytes
, addr
,
46 write_transfer
, sim_core_unmapped_signal
);
51 /* Instance initializer function. */
54 attach_regs (struct hw
*me
, struct cris_900000xx_hw
*hw
)
56 address_word attach_address
;
59 reg_property_spec reg
;
61 if (hw_find_property (me
, "reg") == NULL
)
62 hw_abort (me
, "Missing \"reg\" property");
64 if (!hw_find_reg_array_property (me
, "reg", 0, ®
))
65 hw_abort (me
, "\"reg\" property must contain three addr/size entries");
67 hw_unit_address_to_attach_address (hw_parent (me
),
69 &attach_space
, &attach_address
, me
);
70 hw_unit_size_to_attach_size (hw_parent (me
), ®
.size
, &attach_size
, me
);
72 hw_attach_address (hw_parent (me
),
73 0, attach_space
, attach_address
, attach_size
, me
);
77 cris_900000xx_finish (struct hw
*me
)
79 struct cris_900000xx_hw
*hw
;
81 hw
= HW_ZALLOC (me
, struct cris_900000xx_hw
);
83 set_hw_io_write_buffer (me
, cris_io_write_buffer
);
88 const struct hw_descriptor dv_cris_900000xx_descriptor
[] = {
89 { "cris_900000xx", cris_900000xx_finish
, },