3 ms·
Ah, I just reviewed the slides... looks like I don't actually mention __readfsbase(), I thought I did. Basically, on amd64, you can just read the base address
by trentnelson 12y ago
Ah, I just reviewed the slides... looks like I don't actually mention __readfsbase(), I thought I did. Basically, on amd64, you can just read the base address of one of the FS/GS segment registers and that'll be guaranteed to be unique amongst all threads in a given process.
(Funnily enough that intrinsic doesn't (or didn't at the time) appear to be exposed by MSVC, so I just stuck with __readfsdword(0x48) on Windows.)