4 ms·
So, the reason that hangs win9x is that cli disables interrupts, then foo: jmp foo runs into an infinite loop. With interrupts disabled, it's impossible to pre
by daeken 14y ago
So, the reason that hangs win9x is that cli disables interrupts, then foo: jmp foo runs into an infinite loop. With interrupts disabled, it's impossible to preempt the process, so it just hangs everything.
This shouldn't work from a win32 app, though, since that runs in ring3 where cli is an illegal instruction; it should only work from VDMs.
- mich41 14y agoI know what this code is supposed to do. I wrote it myself expecting to see "General Protection Fault". IIRC, it indeed faulted when executed from main() in a C application, but somehow it hanged Windows 95/98 when inserted immediately at the _start label of a simple 32-bit assembly code. So either executables had some "run in ring3" flag which my assembler didn't set, or the pre-main() initialization code was handled in some special way (executed in supervisor mode or with broken exception handling resulting in a lockup).
- daeken 14y agoAhh, misunderstood your original statement, sorry! And yeah, it should fault; I don't see why they'd run init code in ring0, but win9x did some very strange stuff. There was some malware that I'm trying to recall that would rewrite the IDT and then trigger an interrupt, immediately running itself in ring0 -- anyone know which that was? I used to have the assembly sitting around, since it was a fun little virus to analyze.