Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I would like to disable the level 1 and level 2 caches of my CPU. I wrote a kernel module to set the 30th bit of the control register cr0. But when I try to insert the module with insmod, the system freezes. I am using a Thinkpad X41 with a Pentium M and kernel 2.6.32-40-generic #87-Ubuntu SMP. What can I do to determine the reason for the freeze?
As I just found out, the syntax for the mov instruction with control registers is not as I expected: in Intel syntax, the destination register comes first in cases where control registers are involved. I adopted the code of the module in the first post.
However, the overall result stays the same, the system freezes when the module is inserted. I found out that the module runs without problems with this line commented out:
"or eax,(1 << 30)\n\t"
(But it also has no effect because cr0 is not altered.)
Disabling cpu caches gives you a pentium I like processor!!!
The addition of Cache on CPU was one of the best upgrades to cpu architecture and is used to retain temporal data / instructions. as nini09 have said, you cannot disable it at fly, but certain BIOS would give you the option at boot time. Is there any special requirement, or is only homework / test?
After some investigation, I found out that the module runs fine (with the corrections from my second post). I just didn't wait long enough after fixing the mov cr0, eax bug, misinterpreating the slow behavior of the system with disabled caches as a complete freeze. My apologies for that.
The code posted by whizje is also working, of course. I didn't find an option for cache disabling in the BIOS of my machine.