On Tue, 14 Jan 2025 at 10:40, Paolo Bonzini <[email protected]> wrote: > > On 1/14/25 11:14, Peter Maydell wrote: > >> So, to my opinion, explicit cast to "long long" is necessary > >> here to get the expected behavior. > > > > I wasn't saying the existing code was necessarily correct, > > or that your proposed change was necessarily wrong. > > I was saying your patch didn't come with any analysis of > > what the actual hardware behaviour is, which is > > how you would determine whether the fix you propose > > is the correct one, or if it should be some other > > change instead. (Some of my response was trying to > > provide some of that analysis.) > I would say that the patch is more or less obvious in the sense that the > intent of the code is to model a counter (which counts up by 1 and > cannot miss a step) with a timer within a process that could be > preempted. You probably will not find an answer in the datasheet, other > than by analyzing the signal diagrams, because this scenario simply > cannot exist with a hardware counter.
Well, for a start, you want to look at the datasheet to check that this really is modelling a counter and how wide the counter is (32 bits in this case). thanks -- PMM
