The unit tests pass, and hand-validation of the thread state demonstrates that this code works as expected (with the exception of CPSR, as commented).

Issue: PLCR-495