[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/22] mos6522: record last_irq_levels in mos6522_set_irq()
From: |
Mark Cave-Ayland |
Subject: |
[PULL 09/22] mos6522: record last_irq_levels in mos6522_set_irq() |
Date: |
Wed, 9 Mar 2022 11:08:18 +0000 |
To detect edge-triggered IRQs it is necessary to store the last state of each
IRQ in a last_irq_levels bitmap.
Note: this is a migration break for machines which use mos6522 instances which
are g3beige/mac99 (PPC) and q800 (m68k).
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220305150957.5053-10-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/misc/mos6522.c | 11 +++++++++--
include/hw/misc/mos6522.h | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index 2c20decca1..c67123f864 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -72,6 +72,12 @@ static void mos6522_set_irq(void *opaque, int n, int level)
}
mos6522_update_irq(s);
+
+ if (level) {
+ s->last_irq_levels |= 1 << n;
+ } else {
+ s->last_irq_levels &= ~(1 << n);
+ }
}
static uint64_t get_counter_value(MOS6522State *s, MOS6522Timer *ti)
@@ -544,8 +550,8 @@ static const VMStateDescription vmstate_mos6522_timer = {
const VMStateDescription vmstate_mos6522 = {
.name = "mos6522",
- .version_id = 0,
- .minimum_version_id = 0,
+ .version_id = 1,
+ .minimum_version_id = 1,
.fields = (VMStateField[]) {
VMSTATE_UINT8(a, MOS6522State),
VMSTATE_UINT8(b, MOS6522State),
@@ -556,6 +562,7 @@ const VMStateDescription vmstate_mos6522 = {
VMSTATE_UINT8(pcr, MOS6522State),
VMSTATE_UINT8(ifr, MOS6522State),
VMSTATE_UINT8(ier, MOS6522State),
+ VMSTATE_UINT8(last_irq_levels, MOS6522State),
VMSTATE_STRUCT_ARRAY(timers, MOS6522State, 2, 0,
vmstate_mos6522_timer, MOS6522Timer),
VMSTATE_END_OF_LIST()
diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h
index 193a3dc870..babea99e06 100644
--- a/include/hw/misc/mos6522.h
+++ b/include/hw/misc/mos6522.h
@@ -133,6 +133,7 @@ struct MOS6522State {
uint64_t frequency;
qemu_irq irq;
+ uint8_t last_irq_levels;
};
#define TYPE_MOS6522 "mos6522"
--
2.20.1
- [PULL 00/22] q800-updates-for-7.0 queue 20220309, Mark Cave-Ayland, 2022/03/09
- [PULL 01/22] mos6522: add defines for IFR bit flags, Mark Cave-Ayland, 2022/03/09
- [PULL 02/22] mac_via: use IFR bit flag constants for VIA1 IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 03/22] mac_via: use IFR bit flag constants for VIA2 IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 04/22] mos6522: switch over to use qdev gpios for IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 05/22] mos6522: remove update_irq() and set_sr_int() methods from MOS6522DeviceClass, Mark Cave-Ayland, 2022/03/09
- [PULL 07/22] mos6522: add register names to register read/write trace events, Mark Cave-Ayland, 2022/03/09
- [PULL 06/22] mos6522: use device_class_set_parent_reset() to propagate reset to parent, Mark Cave-Ayland, 2022/03/09
- [PULL 08/22] mos6522: add "info via" HMP command for debugging, Mark Cave-Ayland, 2022/03/09
- [PULL 09/22] mos6522: record last_irq_levels in mos6522_set_irq(),
Mark Cave-Ayland <=
- [PULL 11/22] mos6522: implement edge-triggering for CA1/2 and CB1/2 control line IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 10/22] mac_via: make SCSI_DATA (DRQ) bit live rather than latched, Mark Cave-Ayland, 2022/03/09
- [PULL 12/22] macio/pmu.c: remove redundant code, Mark Cave-Ayland, 2022/03/09
- [PULL 13/22] macfb: add VMStateDescription for MacfbNubusState and MacfbSysBusState, Mark Cave-Ayland, 2022/03/09
- [PULL 14/22] macfb: don't use special irq_state and irq_mask variables in MacfbState, Mark Cave-Ayland, 2022/03/09
- [PULL 15/22] macfb: increase number of registers saved in MacfbState, Mark Cave-Ayland, 2022/03/09
- [PULL 19/22] esp: introduce esp_pdma_cb() function, Mark Cave-Ayland, 2022/03/09
- [PULL 16/22] macfb: add VMStateDescription fields for display type and VBL timer, Mark Cave-Ayland, 2022/03/09
- [PULL 17/22] macfb: set initial value of mode control registers in macfb_common_realize(), Mark Cave-Ayland, 2022/03/09
- [PULL 18/22] esp: introduce esp_set_pdma_cb() function, Mark Cave-Ayland, 2022/03/09