RDTSCP from dlang

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 29 22:23:12 PDT 2016


On 30/08/2016 2:04 PM, kookman wrote:
> I need to access the x86_64 RDTSCP assembly instruction from D.
>
> I found this for C++:
> http://stackoverflow.com/questions/14783782/which-inline-assembly-code-is-correct-for-rdtscp
>
>
> Does anyone here know how (if?) I can do this from D?

It appears dmd's inline assembler does not support it.

So a workaround:

asm {
	// rdtscp
	db 0x0F;
	db 0x01;
	db 0xF9;
}

http://dlang.org/spec/iasm.html


More information about the Digitalmars-d-learn mailing list