mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
Every DriverKit MMIO mapping takes a token number (1..511) that doubles as its synthetic pointer. To keep a stale pointer from reaching a different mapping, an unmapped number was never issued again, so each session consumed about four for good: the register token, upstream's register ioremap and the kernel doorbell kmap among them. After roughly 120 session open/close cycles none were left; the doorbell kmap failed and the probe returned -ENOMEM (242: "kernel bo map failed", quarantine, restart required). The numbers are now renewed when the last mapping is unmapped. The session's register token lives from dext_open to dext_close, so an empty table means no session, no upstream module and no synthetic pointer remain. Within a session an unmapped number is still never reissued. test-session-cycles runs 300 session open/probe/close cycles through the real upstream probe and the production PCI, MMIO-token and heap code against a mock IOPCIDevice, and checks after every close that no MMIO mapping survives and that heap, DART-mapped bytes and mappings, page descriptors and threads are at their baseline. Before this change it fails at cycle 255 with the probe returning -ENOMEM. The DriverKit token bounds test also covers renewal and in-session non-reuse.