How to read eax outside of my own process's state?
I want to make an rng that uses CPU registers for randomness/entropy (a personal project). The problem is, when I access the eax register through a C program, it increments upwards at a constant rate. I think this is because of two things
1) I wrote a sleep function that uses a while loop for waiting (hence the incrementing upwards) and 2) the eax register is reverted back to its old state whenever my program gets runtime (I overlooked process state saving). Is it possible to read eax when my program is not running on the cpu, or to fix the constant incrementation?
Ive tried reading from different registers, but usually they will just give a different issue - for example, ebx stays constant. I haven't tried every register, though.
One idea I have is to make a system call/some kernel space code that reads eax and outputs it to a file, and have the kernel run it periodically. I dont know if this would fix the underlying issue, though. Any suggestions?
|