インラインアセンブリの正確な解釈は本当に不思議です。
私は基本的にインラインアセンブリがどのように見えるかを知っています:
__asm__ __volatile__(asms : output: input: clobber);
以下は例です:
void cpuGetMSR(uint32_t msr, uint32_t *lo, uint32_t *hi)
{
asm volatile("rdmsr" : "=a"(*lo), "=d"(*hi) : "c"(msr));
}
void cpuSetMSR(uint32_t msr, uint32_t lo, uint32_t hi)
{
asm volatile("wrmsr" : : "a"(lo), "d"(hi), "c"(msr));
}
どちらにも「クロバー」部分はありません。
まず、cpuGetMSR では、
"Read variable msr and store it %ecx, and write %eax value to *lo, and write %edx value to *hi"
正しい解釈ですか?しかし、rdmsr はどこに行くのでしょうか? cpuGetMSR() と cpuSetMsr() の解釈を手伝ってくれる人が必要です。ありがとう