IA32 processors have two ways of flushing TLB. Moving the CR3 value to itself:
and using invlpg instruction:ASMV("movl %cr3,%eax");
ASMV("movl %eax,%cr3");
I am remapping some logical pages in the page table to different physical pages. After remapping, I must flush the TLB.ASMV("invlpg %0" : : "m"(addr));
My test application allocates 10 char arrays of 4KB each, remaps the physical pages (it is a page coloring mechanism), and initializes the first position of the array with 'A' + (array number from 1 to 10). Then, it prints the first character.
When I use the first method of flushing the TLB, the character printed is not 'A', it is a completely strange character. On the other hand, when I use the invlpg instruction, it correctly prints 'A'.
Does anyone have any clue about this behavior? The processor is an intel i7-2600.
Best regards,
Giovani