> 
>   Hi,
> 
> > > >         if (++q->rptr == 256) {
> > > >             q->rptr = 0;
> > > >         }
> > > >     }
> > >
> > > That fails for the wraparound (rptr > wptr) case.
> > >
> > Yep, it should use a temporary data array to transfer, which I have written
> > in the previous email.
> 
> Saw it.  And this wraparound handling is also the reason why pre-save
> needs to do this too.  You want qemu versions with both 16 and 256 bytes
> buffer size interpret the vmstate stream correctly.  Therefore you
> should write out the ring buffer in a state where the buffer size is not
> needed to read it, i.e. where rptr + count < PS2_QUEUE_SIZE so you don't
> need to wrap around.
> 
So do you agree with my method to address the issue? Gerd. Thanks,


Best regards,
-Gonglei

Reply via email to