I’m reading KVM source code and confronted with x86_64 inline assembly. In the following code, what’s use of “%c”? It it new feature in x86_64 inline assembly? Any reference for new features in x86_64 inline assembly in gcc?
Many thanks
/* Check if vmlaunch of vmresume is needed */
"cmp $0, %1 \n\t"
/* Load guest registers. Don't clobber flags. */
#ifdef CONFIG_X86_64
"mov %c[cr2](%3), %%rax \n\t"
"mov %%rax, %%cr2 \n\t"
"mov %c[rax](%3), %%rax \n\t"
"mov %c[rbx](%3), %%rbx \n\t"
"mov %c[rdx](%3), %%rdx \n\t"
You can see how this works at the end of the
asmstatement:The
%3(it’s%0in the my source tree) is a reference to the local variablevmx, and%c[rax],%c[cr2]etc are the integer constant offsets of the corresponding values within thestruct vcpu_vmxthatvmxpoints to (%cmeaning “constant”).So the line:
is moving the contents of
vmx->vcpu.arch.cr2into%rax.