企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
https://stackoverflow.com/questions/7415515/how-to-access-the-control-registers-cr0-cr2-cr3-from-a-program-getting-segmenta Ask Question 10 5 I have written a program which tries to read from and write to the control registers. The program compiles fine, but when the inline assembly is about to be executed, it produces a segmentation fault. Code: void instructions(int val) { int i; int value; for(i = 0; i < val; i++) __asm__("mov %cr0, %eax"); } I used GDB and stepped through each assembly line and it is on the mov %cr0,%eax that the segmentation fault is occurring. Anyone who knows what is wrong?