← Back to Blog 0.7.0 · KERNEL · BUG FIX · USB

Wait Bit Guard — Root Cause of x86 #DE at Enable Slot

June 23, 2026 · Sigil-Docs · sigil-kernel 9d8b2b8
kernelx86usbbugfix0.7.0

ROOT CAUSE of the x86 keyboard #DE (divide error, RBX=0) that survived 4 xHCI fixes + DMA-zero debugging.

wait_bit_set/clear tests a bit via peek32(addr,off) / bit % 2, where bit is expected to be a power-of-two MASK. But xhci_wait_event passes bit=0 for the cycle-bit check — a bit INDEX where a MASK is expected — so / 0 raises #DE.

Fix: guard bit==0 in wait_bit_set/clear — treat 0 as "bit 0" (mask=1). Paired with drivers fix af9717b which corrects the xHCI caller to pass the mask.