m1n1.agx.channels: Complain if the ring pointer overflows

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2022-08-31 11:08:33 +09:00
parent 0e8a522845
commit 7a38d14a0c

View file

@ -44,6 +44,9 @@ class GPURXChannel(GPUChannel):
wptr = self.state.WRITE_PTR.val wptr = self.state.WRITE_PTR.val
rptr = self.state.READ_PTR.val rptr = self.state.READ_PTR.val
if wptr >= self.ring_size:
raise Exception(f"wptr = {wptr:#x} > {self.ring_size:#x}")
while rptr != wptr: while rptr != wptr:
msg = self.iface.readmem(self.ring_addr + self.item_size * rptr, msg = self.iface.readmem(self.ring_addr + self.item_size * rptr,
self.item_size) self.item_size)