Open cuavas opened 5 years ago
I'm surprised perfect_quantum override isn't used in more places. Anyway, add a barrier where? Do something like: if (perfect_quantum_wasnt_set) { set perfect quantum } Then it would go wrong if device A set perfect quantum on a 1MHz CPU, and device B afterwards wants to set it on a 20MHz CPU.
or: if (my_quantum < global_quantum) { set perfect quantum } Then in theory it could still go wrong when CPU clock is changed later on.
No, add a barrier as in put a synchronisation barrier on the operation that requires synchronisation to work (e.g. a timer or a call to synchronize
on the scheduler). Devices can't set perfect quantum device as it's a global, and it will now cause a fatal error. If synchronisation barriers are too hard, use config.set_maximum_quantum
with a number that works.
c64_final_chesscard_device works fine(I tested it with daily build), the perfect quantum was added for safety. All inter-cpu comms are via gen_latch and that device is synchronized.
Cool, I'll remove the fixme on my next commit for that one.
Some slot card devices were setting perfect quantum devices. This is problematic because it's a global setting for a machine configuration. If the slot card is loaded in a system that wants to set it for a device with faster timings, it would override it causing problems. These devices need to be fixed.
The simple/lazy way to fix them is to just set an equivalent maximum quantum time – this works for multiple devices in a system, the scheduler will just choose the smallest (most restrictive) one. A better way is to add appropriate barriers to make it work.
The affected classes are (with source files and copyright holders):
c64_final_chesscard_device
(src/devices/bus/c64/fcc.cpp, @curt-coder, @happppp)c1541_base_t
(src/devices/bus/cbmiec/c1541.cpp, @curt-coder)c1571_device
(src/devices/bus/cbmiec/c1571.cpp, @curt-coder)c2031_device
(src/devices/bus/ieee488/c2031.cpp, @curt-coder)hp9122c_device
(src/devices/bus/ieee488/hp9122c.cpp, @svenschnelle)c1551_device
(src/devices/bus/plus4/c1551.cpp, @curt-coder)