Posts Tagged ‘x86’

[osdev] Invalidating a single page in the TLB

Sunday, November 16th, 2008

After a long time of no development on my kernel I decided to do some work on my paging unit. In the past I always had problems with invalidating a single page in the Translation Lookaside Buffer. I knew there was a way to do it with invlpg but I never really got to the correct inline assembly statement for a GCC compiler. It didn’t always work and had random crashes. Untill recently I was left a bit clueless since I didn’t had time to do some research on it (disassembling and looking into the opcodes.) Today I figured it out:

 
__asm__ __volatile__("invlpg (%%eax)" : : "a" (address) );

I hope this becomes useful for somebody.