how to set control register 0 (cr0) bits in x86-64 using gcc assembly on linux
问题 I am using the following code to set the cr0 bit to disable cache. When I compile this #include <stdio.h> int main() { __asm__("pushl %eax\n\t" "mov %cr0,%eax;\n\t" "orl $(1 << 30),%eax;\n\t" "mov %eax,%cr0;\n\t" "wbinvd\n\t" "popl %eax" ); return 0; } I am getting error saying that the operands are invalid for mov. Can anyone please point me to a good gcc x86-64 guide for doing these kinds of things? Also what exactly is wrong with the above code? 回答1: Ok, so finally I wrote the following