I haven't been programming in a couple of years but with all the fuss about Meltdown and Spectre I've install VS2017 and compiled the Spectre example from this pdf: https://spectreattack.com/spectre.pdf
However I have no idea how the addresses that the Spectre example takes on the command line works?
I modified the code to output the pointer address of the secret string and compiled with cl in the Native Tools Shell and it outputs something like:
00007FF6CF2210F0
Entering this address on the command line to the example it outputs the secret string correctly.
But if I make a simple program with a similar string and output that address and then feed it to the Spectre example, in another shell, I don't get the correct string.
I've been reading about virtual vs physical addresses and pages and offsets, but I'm quite lost.
So the question is:
How would you in C code calculate the physical address of a pointer?