VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

UniPCemu currently gives the current CPU requesting the bus lock, where CPUs are handled in order of execution(during a clock, CPU 0 has priority over CPU 1).

But afaik, it should be fair use, thus allowing both to obtain the lock somehow?
How should I implement this? Assign some priority to all CPUs for being able to lock? How should this be done(everything is in a loop: cycle CPU0, Then CPU1 etc., finally hardware). So now CPU0 > CPU1 > hardware.

Anyone?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 1, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just adjusted the priorities a bit. Once a single CPU requests the bus, it gets pending. If another CPU doesn't do the same on the same cycle, it gets acnowledged and immediately starts it's memory access on said cycle.

But if two CPUs simultaneously request the bus with a lock, a random number gets generated which determines the CPU which gets control of the bus(simple random() function in this case). So in that case either of the two randomly gets control of the bus to do it's thing(also supposed to fix deadlocks because of either CPU getting priority access when getting into a deadlock due to identical instruction/instruction phase timings).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io