stepleton
Veteran Member
Today in general chat discussion I thought I'd ask around to see if people were aware of interesting ways to get a computer to hang (or at least get stuck for a good long while) with a single instruction. This was inspired by @tomjennings 's post here which details how Novas can get stuck in an infinite loop of indirect jumps if the contents of RAM at jump destinations are set up in the right way. (I'm willing to be a bit liberal about "single instruction" and not count the code you'd need to set up the memory that allows the instruction to have this effect.)
Here's my favourite. Transputer ICs have a shift instructions but they (a) have no barrel shifter for integer ops, (b) do not range-check the shift argument, and (c) permit the shift argument to be word-size. On a 32-bit transputer, you can specify a 32-bit shift argument, which the CPU will faithfully count down as it shifts the contents of the B register one position at a time. An argument of 2^31 - 1 will keep a transputer locked up for "3 to 4 minutes" per this text.
Notes:
Here's my favourite. Transputer ICs have a shift instructions but they (a) have no barrel shifter for integer ops, (b) do not range-check the shift argument, and (c) permit the shift argument to be word-size. On a 32-bit transputer, you can specify a 32-bit shift argument, which the CPU will faithfully count down as it shifts the contents of the B register one position at a time. An argument of 2^31 - 1 will keep a transputer locked up for "3 to 4 minutes" per this text.
Notes:
- HALT instructions are boring, not interesting, and don't count.
- Tight loops by jumping to the current instruction are also boring. Ideally the processor should read the instruction only once and get stuck executing it.
- Waiting on an absent peripheral could be boring but maybe there are nifty exceptions.
- If the processor has a supervisor mode or equivalent, please note whether it's required for the wedge instruction to work.
- Things that are clearly "bugs" like the Pentium F00F bug are potentially less interesting than situations where the hang is "baked in" by the ISA's design; the Nova indirect jump looping is a good example of the processor working exactly as specified but still hanging.