Using rdpmc within Go


For research purposes, I need to read the host TSC within a VMware VM. In order to do so, I need to be able to execute rdpmc 0x10000. I have had no issue doing that in C++, using inline assembly (I don’t really need the code to be portable). However, when I try to approach the same problem from Go, I am completely unable to reach the same result.
I have tried using C and also using assembly directly. As of now, I have the following code in the same directory within a pre-existing project:

#include "textflag.h"

// func RdPmcTsc() uint64
    MOVL $0x10000, DX


package rdpmctsc

func RdPmcTsc() uint64

I have looked everywhere for more information on how to do this, but I haven’t succeeded in implementing it yet. I can provide whatever other information you may need, but any help would be really appreciated

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.