From 7a38d14a0cb0409e3d84480c1ba4e4e2328502c7 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 31 Aug 2022 11:08:33 +0900 Subject: [PATCH] m1n1.agx.channels: Complain if the ring pointer overflows Signed-off-by: Asahi Lina --- proxyclient/m1n1/agx/channels.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxyclient/m1n1/agx/channels.py b/proxyclient/m1n1/agx/channels.py index cd3f00fa..b4135467 100644 --- a/proxyclient/m1n1/agx/channels.py +++ b/proxyclient/m1n1/agx/channels.py @@ -44,6 +44,9 @@ class GPURXChannel(GPUChannel): wptr = self.state.WRITE_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: msg = self.iface.readmem(self.ring_addr + self.item_size * rptr, self.item_size)