for a C++ project I'm currently working on I have the following situation:
adr1 is an address in memory that will be randomly selected from a mapped memory for every run of my program. Now I want to write to this address using the MOVNTI
(https://www.felixcloutier.com/x86/movnti) instruction. However, I'm pretty new to inline assembly and do not know which constraints and which data-type to use for this.
My current code:
asm volatile(
"movntiq %%rax, %[in1] \n"
:
: [in1] "m" (adr1)
);
I tried using the "i" and "c" constraints for the input variable but the compiler does not write the assembly code I want to have. What I want to have written in the end is this (let's say adr1 = 0x12345678):
movntiq %%rax, 0x12345678
However, the compiler currently creates this:
movntiq %%rax, -8(%rbp)
How do I have to set the constraints and variable type of adr1 to achieve my goal?