Patent ID: 7136991

Claim:
A microprocessor, for running a multitasking operating system, the microprocessor having a memory coupled thereto, the microprocessor comprising: a register, saved and restored by the operating system on a task switch; a flag register, coupled to said register, for storing a flag which if set indicates a task switch possibly occurred, wherein the microprocessor sets said flag when it executes an instruction that loads said register; and a random number generator (RNG), coupled to said register, for generating random numbers based on one or more control values stored in a control register, wherein said control register is not saved and restored by the operating system on a task switch, wherein the microprocessor includes a first instruction for loading said values into said control register and also for loading said values into said register, wherein the microprocessor also includes a second instruction for storing said random numbers to the memory, and for copying said values from said register to said control register if said flag is set.