There is a 1-bit counter or actually a latch.
The NMI latch records the second NMI. Note this is edge-sensitive like
the NMI line itself.
NMI2 latched above causes the NMI handler to be invoked as the next
instruction after IRET. The latch is cleared as the interrupt is taken.